Rounding of number

Hello,
I’m checking the state of a number value, but it seems to fail on the rounding.
and in the template editor
when only showing this number it simplay says ‘0’


but while adding a 2nd request is suddenly says 0.0

for me this is confusing.
my automation checked state ‘0’ which was failing, now I changed it to ‘0.0’ to just hope it will work next time.

for a numeric state check I can only use above and below,

what would be the advised check in an automation?

  • template,
  • state
  • numeric state
  • somthing else?

I use state, but that should be ‘0.0’ then

The stupid template editor interprets results, templates do not. So if the result looks like a number the template editor will call it a number. Even if it is a string. This has been complained about but the devs prefer it this way for some unknown reason.

States are always strings. You need to convert it to a number with the float filter ...)|float == 0

1 Like