Trigger automation when Hue light switched off manually (unavailable)

I have a room where I want to be able to manually turn on the light switch and trigger an automation to turn on various other lights/sockets. I have achieved this using the Philips Hue ‘power on’ behaviour and then having an automation to turn on a scene when the main light is turned on.

The challenge is when the light is switched off (at the switch).
Hue does not seem to report that this light is now ‘unavailable’ and still allows control from HA (even though nothing happens). It will probably time out after a while but that is prohibitively long to trigger an automation.

I’ve trigged polling the device in Node-Red but that uses the HA state and so it still shows as ‘on’ until the timeout has elapsed.

Any ideas?

Otherwise, I’ll have to grab a no-neutral z-wave switch.

2 Likes

Hi,

I’m interested in the same thing! It sounds like a good idea to control several lights with the same physical switch. I tried this (from here):

trigger:
  - platform: state
    entity_id: sensor.yourentity
    to: 'unavailable'
    for:
      seconds: 5

but it does not seem to trigger once the light becomes unavailable.

It would be really nice to trigger automations when a light becomes unavailable or becomes available again.

1 Like

Interested in using the ‘unavailable’ state here too, has anyone worked this out yet?

2 Likes

Interested as well!
Did anybody ever figure this one out?

I am also interested in this topic.
I want to switch on the fan in my bathroom when the (Hue-)light is switched on, better said: when the light gets powered. And I want to switch the fan off when I switch off the light (i.e. when the light gets unpowered, i.e. when the light becomes unavailable for Hue network).
I just moved from Node Red to Home Assistant.
With Node Red, triggering an action when a HUE device becomes unavailable is no problem at all.
But with Home Assistant this problem seems to be unsoved? Can this be true?

Just tried this again, and it seems to be working just fine.

alias: "turn off sleeping room ceiling "
description: ""
trigger:
  - platform: state
    entity_id:
      - light.sleeping_room_lamp
    to: unavailable
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: b418cedb3f80984c1dce84334741c005
    entity_id: light.hue_ambiance_lamp_1
    domain: light
mode: single

There is a short delay of 3-5 seconds, but I do t mind.

1 Like