How to turn off all smart lights with one dumb switch?

Hey there! I’ve got some IKEA smart lights in my living room and I’ve got one hardware switch connected to some of those but not all. I’d like to find a way to set a trigger to detect when one of my lights becomes unavailable.
I have got this, but it doesn’t work.

alias: If light goes offline then activate scene
description: ""
  - platform: state
      - light.spot_1
    to: unavailable
      hours: 0
      minutes: 0
      seconds: 2
condition: []
  - service: scene.turn_on
      entity_id: scene.woonkamer_lampen_uit
    metadata: {}
mode: single

The automation is triggered when ‘spot_1’ is unavailable for 2 seconds and will then (I presume) turn all living lights off?

What exactly doesn’t work? The trigger? The scene? Have you check the Log in the left side panel?

You can manually test the scene if it works.
Then unplug ‘spot_1’ which should make it unavailable. You can check this in the developer tools.

If both work as expected, let us know what still is not working.

Thanks for the tip! I can see the triggering doesn’t work. There are two problems.

  • At the developer tools the lightbulb is still registered as ‘on’ for the next 5 minutes. (It is weird that the other two lights are still ‘on’ even though they are on the same switch, powered off) Keep in mind it is an Ikea tradfri lightbulb and the Ikea gateway.
  • The second problem is when the light becomes unavailable, it does not trigger the automation.

Now I do think this setup is not going to work because the ‘unavailable’ status is not reliable enough. Any ideas on doing things differently? The idea is that my partner (and I) can just smash the regular old light switch and then homeassistant turns off all the other lights that are not connected to this switch.

Well, basically you are taking the right approach. But the 5 minute delay (from the hub) is in the way.

My suggestion would be to buy a cheap IKEA remote and leave the physical switch alone.

Another approach might be that if you hit the old switch one or more lights turn off. You can intercept this trigger (to “off”) and perform the action as planned.