Inconsistent datatype for switch

Hi Guys,
I’m trying to move my persistence from influx to timescale. I see a “strange” behavior like switch items are stored as “ON” and “OFF” with datatype as string. While this is perfectly understandable as a human reader this give some problem with aggregations.

Another thing that I noticed is that, in influx, the same values are stored as 1 or 0 letting me to evaluate in rules, for example, if a switch is pressed more than half the time in the latest 24h (this is used to made statistics about my hvac for example and react in a rule).

Am I missing something in configuration? I tried to cast the SWITCH type to a smallint but, of course, “ON” will not be interpreted as 1…

Any hint is welcome!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.