Really simple automation not available

alias: Licht aan na zonsondergang
description: ""
  - platform: sun
    event: sunset
    offset: "15"
condition: []
  - type: turn_on
    device_id: 967b5a9aa969aa530af52b1fa3cb2138
    entity_id: c0bf20fb04447f5ea66cdac0419a68fa
    domain: switch
  - type: turn_on
    device_id: 42e4308597b6dc1ed7ed8a259429436a
    entity_id: fd7b3c7772198d1c03a41d8c52cd1c51
    domain: switch
  - type: turn_on
    device_id: 4385e7992aa5caa688d44c07bae2e975
    entity_id: 12dbb70078c7013ab51cbc9917cd06e3
    domain: switch
mode: single

Worked fine for years, since a couple of versions errors out with “automation not available”. All lights work fine when testing the actions. The sun goes up and down as usual, so what gives?

Automations using device ids become unavailable if any of the devices they depend on do.

If so, why does HA write this YAML if I configure using the GUI? And; why do the devices respond instantly while testing?

Change it to:

  - service: switch.turn_on
        - switch.entity1
        - switch.entity2
        - switch.entity3

…and I bet it will work. :laughing:

It writes that yaml if you pick a device instead of picking an entity. that is the right yaml for devices. but the article specified why you should be pickig entities instead