- id: paralelo_arandela_2
  alias: Paralelo - Arandela 2
  description: Espelha os dois interruptores na hora. Só reage a acionamento de pessoa
    (físico, app, Alexa); ignora mudanças vindas de automações, o que evita o loop.
  triggers:
  - trigger: state
    entity_id: light.sala_de_tv_interruptor_sala_de_tv_switch_4
    to:
    - 'on'
    - 'off'
    id: switch.arandela_2_sonoff_1001d7dae2
  - trigger: state
    entity_id: switch.arandela_2_sonoff_1001d7dae2
    to:
    - 'on'
    - 'off'
    id: light.sala_de_tv_interruptor_sala_de_tv_switch_4
  conditions:
  - condition: template
    value_template: '{{ trigger.from_state is not none and trigger.from_state.state
      in [''on'',''off''] and trigger.to_state.context.parent_id is none }}'
  actions:
  - action: homeassistant.turn_{{ trigger.to_state.state }}
    target:
      entity_id: '{{ trigger.id }}'
  mode: queued
  max: 10
  max_exceeded: silent
