By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS IoT Events

Sort by most recent
  • 1
  • 2
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

AWS IoT Timestream Rule Action write: Problem with float and int values

Hello, we have some sensors that send multiple variables (temp, humidity, pressure) through the IoT core writing them to timestream and dynamoDB at the same time using an IoT rule (SQL 2016-03-23). We are having some problems with rejected values when trying to write those values. Cloudwatch says: ``` "failedAction": "TimestreamAction", "errorMessage": "Failed to write records to Timestream. The error received was 'One or more records have been rejected. See RejectedRecords for details. (Service: AmazonTimestreamWrite; Status Code: 419; Error Code: RejectedRecordsException; Request ID: xxx; Proxy: null), Rejected records: [{RecordIndex: 9, Reason: Measure name already has an assigned measure value type. Each measure name can have only one measure value type and cannot be changed.,}]'. Message arrived on mit/decoded, Action: timestream, Database: sensordata-timestream-db, Table: mit-timestream-table" ``` The natural type of the values is `double` and the first write in timestream defined that measurement with the correct type. The problem relies when some of the measurements are with decimal part equal to zero (which can be interpreted as an `int`), for example `13.0`. In this case Timestream detects it as an `int` instead of `double` and rejects the measurement. Reading the documentation and different questions here in re:Post, I saw that a possible solution is to cast the variable as double, but seems not be working. This is how we are casting it: ``` SELECT cast(event.payload_sensordata.Hum_SHT as double) as Hum_SHT .... FROM .... ``` Another way we have tested without luck is casting as `DECIMAL` instead of `double`. This is what we are seeing in both tables: ![Enter image description here](/media/postImages/original/IMcxwgiNJ3RMaxmJoljYSYLw) Any thoughts on how to solve this within the IoT rule? Thanks!
2
answers
0
votes
50
views
asked 2 months ago
  • 1
  • 2
  • 12 / page