My Roborock S7 has a entity called “Total clean count”. My idea was to send the roboter after every second cleaning directly to the bin to easily clean him.
Is there a way to get if the Total clean count is even or odd?
“float” is a filter that converts the output of “states(‘sensor.your_clean_count’)” to a floating point number - it has decimals in it (an integer is a whole number)
all states in HA are strings. Even if the value looks like a number it’s actually a string.
you need to convert the string into a number (either a float or integer) in order to do math on the values.
..... % 2).......
takes the modulus of the converted number.
so there are three independent functions going on in that template…
first convert "states(‘sensor.your_clean_count’) " to a float using the | float filter. then take the modulus of the resulting floating point number using % 2. then compare the result to 0.