Problem with "Set device value" in scene

I’m trying to operate a Thermostat radiator valve TV02-Zigbee with a separate Temperature & humidity sensor WSD500A.
In my scene I’m using “Set device value” with “computed” value.
For debugging I’m sending all values via Telegram. All input values look correct.

In the Zigbee2mqtt log I see 2 messages to the Thermostat with current_heating_setpoint (only copied the current_heating_setpoint part here):
1st message: “current_heating_setpoint”:16.920000000000005
2nd message: “current_heating_setpoint”:-145960468.4

Looking at the 1st message shows that calculating the value is working fine.
However for some reason there is a second message sending a scrambled value to the Thermostat.

Using “Set device value” with simple mode does also result in 2 messages.
After some trials it looks like values with 2 and more digits after the decimal point result in the scrambled values in the 2nd message.

Looks like a proper rounding could solve the issue.

Is there a rounding mechanism available in the “computed” field?
What maths capabilities does the “computed” field provide?

Thanks for your message!

I think there is a round function in this field, but I tried it and cannot get it to work :thinking:

We use MathJS behind the scene.

I’ll talk to the developer who worked on this and let you know!

I don’t think we have the feature currently! Can you create a feature request on the forum? :slightly_smiling_face:

I did some trial and error, discovering that indeed a rounding function is implemented.




Still I would be interested in the implemeted math capabilities.

Nice finding!

We use MathJS and the “evaluation” function:

The code where we define this “evaluate” function is here: