Smart switches turning on after a reboot

The automation reacts on ANY state change to toggle the light. So it also reacts to the switch being unavailable during a reboot and then changing to an available state. That is why it misbehaves.

Unfortunately it is a device trigger. Those are best avoided for several reasons, among which that afaik this problem cannot be fixed with this type of trigger. It can of course be fixed, but for that I need to know what entities it has (if any) or what events it emits.

Assuming there is an entity for the switch (I see light domain?) the automation would look something like below. Replace with the entities of your specific devices:

alias: "Switch: Living Room Lamp"
description: ""
triggers:
  - trigger: state
    entity_id: light.livingroom_switch
    not_from:
      - unavailable
      - unknown
    not_to:
      - unavailable
      - unknown
conditions: []
actions:
  - action: light.toggle
    metadata: {}
    data: {}
    target:
      entity_id: light.livingroom
mode: single

Notice I also replaced the device action with a light action. That is not needed, but advised. Also there you would need to put in the right entity id. Why it is wise to change it too is explained here:

1 Like