HTTP request: calculation of value sent

Good evening,

I don’t know how to « cast » the result which seems to be sent as a string, whereas a numeric value is expected in the following case:

Your help would be appreciated, thank you in advance,
Have a nice evening,
Jean

Hi @jean_bruder :slight_smile:

Indeed, it’s not possible to do what you’re doing; you need to break down the calculation and the sending of the JSON.

  1. You can change the state of a sensor to a « calculated » value in « Control a device ».
  2. Then, you can inject this calculated value into a JSON like you do here.

Hello @pierre-gilles

I don’t know how to apply your answer to my scene: the value calculated to be sent via HTTP/POST comes from an operation on a value received via HTTP/GET to which a value is added/removed, and must be in numeric format. How can I use the calculated value of a device?

Thanks,
Jean

You can use a virtual device (MQTT integration) that serves as a « buffer » for the final value that you then send over HTTP.