Wall Switch Automation

Hi,

i have a zigbee wall switch with 2 gang…they are integrated as switches, and I should control the lighting of one light bulb.

having 2 switches, I need that when one turns on the other turns on and the other way around, so I created 2 automations like this to on and off the light:

- id: 'luce_sybaris_on'
  alias: Luce Sybaris ON
  description: ''
  trigger:
  - platform: state
    entity_id: switch.luce_sybaris
    to: 'on'
    from: 'off'
  - platform: state
    entity_id: switch.luce_sybaris2
    to: 'on'
    from: 'off'
  condition: []
  action:
  - service: light.turn_on
    data:
      kelvin: 6500
      brightness_pct: 100
    target:
      entity_id: light.sybaris
  - data_template:
      entity_id: |
        {% if trigger.to_state.entity_id == "switch.luce_sybaris" %}
          switch.luce_sybaris2
        {% else %}
          switch.luce_sybaris
        {% endif %}
    service: switch.turn_on
  mode: single

The automation works, but every time I get a warning in the log like this “Luce Sybaris ON: Already running”

Did I do something wrong?

In this case, no. It reports that because when the automation’s action turns on either switch, that causes the automation to trigger itself (because its trigger is listening to both switches). However, the automation is already running and because mode is single it cannot do two things at once so it reports it’s already running.

For this particular application, mode: single is perfectly fine. If you don’t want the log to be cluttered with “already running” messages, simply add this to the automation:

  max_exceeded: silent
1 Like

Thanks, in this way I no longer receive warnings.