Show unavailable as off

I have a hue light in my son’s room (via z2m) which he switches off with the normal wall switch (I still need to put something behind it like a sonoff) But in the meantime I would like Home assistant to show the light as off when it’s unavailable. Is this possible?

I hate the fact that it shows unavailable because it’s cut from power and it would be a nicer view if it just states as off.

It’s already the case. My hue lights that are power off due to a switch as shown as unavailable state

You need to set up a template sensor for that.

  - binary_sensor:
      - name: "sons room"
        state: "{{ "on" if states('light.sons_light') == "on" else "off" }}"

Getting that as a feature request and making that change in HA, it will never happen.
The state is unknown because it is unknown. If you want to map that to something else then feel free to do so, but it will not happen as a standard feature.


Im sorry i think I might be stupid but:

  - binary_sensor:
    - name: "Damian light
      state: "{{ "on" if states('light.damian_lamp') == "on" else "off" }}"

I have this but home assistant doesnt like it:

bad indentation of a mapping entry (225:19)

 222 | template:
 223 |   - binary_sensor:
 224 |     - name: "Damian light"
 225 |       state: "{{ "on" if states('light.damian_lamp')  ...

You are right…
I’m the stupid. I used the same quote, and both in the same template. :man_facepalming:

  - binary_sensor:
    - name: "Damian light"
      state: "{{ 'on' if states('light.damian_lamp') == 'on' else 'off' }}"

You are a hero. Thank you a lot.

Final question if I may ask.
All lights are sliders which you can turn on and off. I know that its not possible to turn it on and off in the template but is it possible to view it as a slider instead of the words on and off?

No is an answer aswell :slight_smile:

Most things is possible.
You probably could create a light template if you want to go super fancy.

Template Light - Home Assistant (

I think… if you use the template above as the value_template then it should behave as a light when the mains is connected, and else just not work.
I have never tried it but I think if you add all the other parameters then you essentially get a new light entity that can replace the other on the dashboard.

1 Like

Thanks again.

I was playing around and it works now.

The binary sensor is not needed for this:

  - platform: template
      friendly_name: "Damian light"
      value_template: "{{ is_state('light.damian_lamp', 'on' )}}"
       service: light.turn_on
         entity_id: light.damian_lamp
       service: light.turn_off
         entity_id: light.damian_lamp

This shows the light as on like normal and when it’s unavailable it just switches to off. instead of the “unavailable” text.