Automation for "dummy" dimmer to control actual dimmer

I have zigbee dimmer switches throughout my house to control the lights, in each the upstairs and downstairs hallways there is essentially a “dummy” dimmer switch that only receives power and aren’t directly wired into any lightin circuits.

I had set up a basic automation for each dummy switch to trigger an actual switch to turn on the lights, so you can switch the light on upstairs while being downstairs and vice versa.

alias: Landing switch
description: ""
triggers:
  - type: changed_states
    device_id: a
    entity_id: a
    domain: light
    trigger: device
conditions: []
actions:
  - type: toggle
    device_id: b
    entity_id: b
    domain: light
mode: single

This seems ot have caused a small inconveniece where every time there is any kind of power fluctuation to the house, the automation triggers and the lights come on. I’ve had it happen randomly in the middle of the day and even been woken up by it in the middle of the night. Another drawback of the basic automation is that the dimmer function doesn’t work so the light is either on or off which can be confusing for people.

I had the idea that HA can look at the voltage of the dummy switch and set the actual switch voltage to match but have no idea where to start with YAML or if it would even work. Any ideas or code is much appreciated.

Don’t use device automations.

Use a state trigger and define the states you want or don’t want. Also use an action template rather than just blindly toggling the light (in case they get out of sync). e.g. this will cause light b to follow light a.

triggers:
  - trigger: state
    entity_id: light.a
    not_to:  # will trigger on changing to all other states but not..
      - unknown
      - unavailable
actions:
  - action: "light.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: light.b