Template sensors stoped working

I have this code in my “sensors.yaml”, and for some reason the state of the “bedroom tornado ac power” is “unknown”

the tamplete itself renders good values when i check it in the “developer tools”
but for some reason the sensor does not.

it worked fine last year when i wrote it, and haven’t used it during winter. now its summer again and yesterday i realized its not working…

any ideas? what am i missing.

  - platform: template
    sensors:
      bedroom_tornado_ac_power:
        friendly_name: "Bedroom tornado ac Power"
        icon_template: mdi:power-plug
        device_class: "power"
        value_template: "{% if states('sensor.sonoff_100107ee35_power') | float > 20 %} on {% elif states('sensor.sonoff_100107ee35_power') | float < 20%} off {% endif %}"

cheers

OK

i figured is was the:

device_class: "power"

that caused the problem with the sensor for me. probably some changes withing latest’s versions.
as soon as i removed it, the sensor renders correctly again

i m living this post as it might help others.

cheers.