WTH Can't I easily mirror a light/switch

Maybe it is just me but I would have thought - make this light copy the state of this light would be a fairly common automation. I have an outside light that is Zwave and some garden lights that are mqtt. When I turn my outside light on/off I want the mqtt light to do the same.

This either takes two automations one for on and one for off (if not using templates) or one automation if using templates. Couldn’t creating a link between the two just be an interface and select both entitites to link.

Tbh not my biggest concern but certainly a WTH moment I had.

You could use a light group and control that instead.

1 Like

It works fine if you use the new chooser.

- id: light_dependency
  alias: Light dependency
  description: "Switch lights to same state"
  trigger:
    platform: state
    entity_id: light.patio
  action:
    - choose:
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.state == 'on' }}"
          sequence:
            - service: light.turn_on
              entity_id:
                - light.garden
        - conditions:
            - condition: template
              value_template: "{{ trigger.to_state.state == 'off' }}"
          sequence:
            - service: light.turn_off
              entity_id:
                - light.garden
2 Likes

This doesn’t work as I often turn the outside light on using the switch on the wall.

Right, so that switch itself is also part of Home Assistant in your case? (so 2 entities basically, the light + a switch entity)

I think my use of the phrase “switch” might have been ambigious so to explain.

So I’ve got a Zwave in wall Fibaro Dimmer module that controls the outside light bulb but also has a pysical switch on the wall - it can be turned on/off via Home Assistant or via the physical switch on the wall.

I’ve also got a Sonoff Basic that is in home assistant as an MQTT light.

So when I turn on the physical wall switch it turns the light on directly not using home assistant but as it is Zwave Home Assistant gets the message and changes the state of light.outside from off to on. At that point I want Home Assistant to send a message to the light.garden to turn on.

Then the reverse when I turn the physical wall switch off.

That is a lot better than when I last checked it out. Wonder if we could make it:

- condition: trigger
  value: on

to make it even more obvious.