Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

290
Vistas
How to force AWS Timestream to always interpret a number as double in an IoTCore rule?

Sensor payload decoders are mostly provided as javascript code by the sensor manufacturers. As I'm using different sensor types, I want to use the original decoders without rewriting them in other languages. So I'm using an AWS Lambda (NodeJS) within AWS IoTCore rules for decoding the different sensor payloads, which works fine.

In a succeeding IoTCore rule, I want to send the decoded sensor payload to an AWS Timestream database. AWS Timestream data types are fixed during the first write. So, if the first measurement value "temperature" was a float number like 23.14 degree, the measurement type is fixed to a Timestream::Double type, which is what I want.

However, if the sensor measures a value of a flat 23.0 degrees the next time, then the Timestream write operation leads to the error "Measure name already has an assigned measure value type. Each measure name can have only one measure value type and cannot be changed."

The reason lies in the AWS Timestream parser, which works like so: A numeric value without a decimal point is interpreted as a BigInt type. So,...

> const f1 = 23.4
> const f2 = 23.0
> console.log(f1, typeof f1, f2, typeof f2)
 23.4 'number' 23 'number'
parseFloat(23.14) // becomes Javascript::Number 23.14 Timestream::Double. ==> ok!
parseFloat(23.00) // becomes Javascript::Number 23    Timestream::BigInt  ==> Error! 

I don't want to use parseFloat(23.00).toFixed(2) as it becomes a string value, nor parseFloat(23.00) + 0.001 as it is changing the value and requires always converting/rounding values when processing the AWS Timestream values later on.

How to solve that?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Solved by skipping the IoTCore rule framework and writing in Lambda directly to Timestream, there I can explicitly set the measureValueType = "DOUBLE" , which avoids that kind of problem.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda