Merging Z-Wave Relays

I have 2 z-wave relays that are built in the wall behind the switch. (Qubino Flush 2 Relays)

When I turn on switch 1 (manually) the light at the output of the relay switches on (default behaviour).

What I want to do is to link multiple relays, so that when I toggle one switch, both lights come on, and when I then turn of the second relay, both lights should turn off.

I tried doing this by using Z-Wave Group Associations, but this creates a loop as I need the linking to work both ways.

I have tried making a Template Light, which does link the lights, but only when operated from the HA frontend, not when I use the physical switches.

I’ve also tried making automations, 2 per relay (so 4 in total) to cover all the switching possibilities (e.g. 1 to turn on light 1 when I turn on light 2, 1 to turn off light 1 when I turn off light 2, 1 to turn on light 2 when I turn on light 1, and 1 to turn off light 2 when I turn off light 1). But I’ve never got this to work unfortunately.

Basically I need the value template of the Template light to react to both the switches. Or is there another way I could get this functionality (maybe via more elegant automation(s) or scripts?)

Here are the automations I tried: https://pastebin.com/UXELPMt9
Here is the Template Light I tried: https://pastebin.com/4V6EsK4Z (the level template is like this because I have milights behind these relays, but I don’t really need this linking to happen at that level, so just ignore that)(more info on that: Combining Z-wave Relay with Milight light )

You should be able to simplify those automations, when either switch turns on, turn them both on, when either switch turns off, turn both off.

1 Like

Thanks! I’m now trying this for the ‘on’ automation:

- action:
  - alias: Zet keukenspots aan
    data:
      entity_id:
        - switch.relais_keuken_eiland_een
        - switch.relais_keuken_tuindeur_een
    service: switch.turn_on
  alias: koppel inschakeling verlichting keuken doorloop
  id: ‘1510517358206’
  trigger:
    - entity_id: switch.relais_keuken_eiland_een
      from: ‘off’
      platform: state
      to: ‘on’
    - entity_id: switch.relais_keuken_tuindeur_een
      from: ‘off’
      platform: state
      to: ‘on’

Manually triggering this from the frontend turns both switches on, so that’s something. However it doesn’t trigger when I toggle either of the switches from off to on.

EDIT: okay, it’s working. Kind off, it takes about 30s before the second relay comes on. Is there any way I can make this leaner so it’s faster? (Or is due to having a busy/large home-assistant install on a rpi3?)