Automation to Mirror two Smart Switches

Not “dumb”, “detached”.

This will make the dayroom switch follow the indoor switch (on and off):

alias: Indoor sw controlling dayroom sw
description: ''
trigger:
  - platform: state
    entity_id: switch.your_indoor_switch_here
condition: []
action:
  - service: "switch.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: switch.your_dayroom_sw_here
mode: single

However this does not allow the dayroom switch to alter the indoor switch. Adding another automation to do the reverse (dayrrom switch to control the indoor switch) gets a bit loopy (literally) without a condition in both automations:

alias: Indoor sw controlling dayroom sw
description: ''
trigger:
  - platform: state
    entity_id: switch.your_indoor_switch_here
condition:
  condition: template
  value_template: "{{ states('switch.your_dayroom_sw_here') != trigger.to_state.state }}"
action:
  - service: "switch.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: switch.your_dayroom_sw_here
mode: single
alias: Dayroom sw controlling indoor sw 
description: ''
trigger:
  - platform: state
    entity_id: switch.your_dayroom_switch_here
condition:
  condition: template
  value_template: "{{ states('switch.your_indoor_sw_here') != trigger.to_state.state }}"
action:
  - service: "switch.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: switch.your_indoor_sw_here
mode: single

With these two automations whatever you do to one switch will be reflected by the other and you can keep your existing motion and door automations.

1 Like