Sensor - Device Class

Hi All,

i have an issue with a sensor configured, when the state changed from off to on, the color of the entity is not changing to yellow, it’s remain the same.

This is the code under sensor: in configuration.yaml

  - platform: template
    sensors:
      sensor_40:
        friendly_name: 'Hp Printer'
        value_template: "{% if is_state('device_tracker.c4_65_16_69_73_c0', 'home') %}on{% else %}off{% endif %}"

i also configured under customize: the class of the device to power:

    sensor.sensor_40:
      device_class: power
      

screenshot of the entity:

Any idea why it’s not working?

Only binary_sensor entities change color :wink:

Thank you! Can you share where it’s written?

In your binary_sensor config instead of your sensor config

@Tinkerer tried still not working would you mind help with code?

@yoni3210

other question how did you create the sensor printed pages?

Tried… what?

binary_sensor:
  - platform: template
    sensors:
      sensor_40:
        friendly_name: 'HP Printer'
        value_template: "{{ if is_state('device_tracker.c4_65_16_69_73_c0', 'home') }}"

But see the docs - you can’t have multiple binary_sensor: lines.

follow this thread, there is a script pulling the data