3way switch state after restarting HA

Hello there,

I set up 3 way switch (2 switches managing 1 light) with sonoff’s flashed with tasmota. I followed this: https://www.youtube.com/watch?v=GEJCk-Dr3BQ&lc=UgwYiLbZdH2kQWul7JR4AaABAg

So I have one “slave” sonoff (switch.sonoff9_basic) which will only toggle the “master” sonoff (switch.sonoff10_basic) and the “master” sonoff will actually trigger the light.

See automation:

- id: 'trigger_3way_swtich_garden_slave_on'
  alias: "Lumière jardin on"
  trigger:
    - platform: state
      entity_id: switch.sonoff9_basic
      from: 'off'
      to: 'on'
  action:
    service: switch.toggle
    data:
      entity_id: switch.sonoff10_basic

- id: 'trigger_3way_swtich_garden_slave_off'
  alias: "Lumière jardin off"
  trigger:
    - platform: state
      entity_id: switch.sonoff9_basic
      from: 'on'
      to: 'off'
  action:
    service: switch.toggle
    data:
      entity_id: switch.sonoff10_basic

Switching if working fine.

But I’m running into trouble when I want to restart HA. I have the following automation to retain states of tasmota devices:

- alias: "Power state on HA start-up"
  trigger:
    platform: homeassistant
    event: start
  action:
    - service: mqtt.publish
      data:
        topic: "sonoffs/cmnd/state"
        payload: ""

What I would like:

  • if switch.sonoff10_basic is ON I want the light to be ON
  • if switch.sonoff10_basic is OFF I want the light to be OFF
    like it will be in a classic electric system after

But now, if switch.sonoff9_basic is ON then trigger_3way_swtich_garden_slave_on and the light toggles.

So, basically, I want to ignore the state of switch.sonoff9_basic first time after starting HA.

Does somebody have an idea ?

Thanks !

Thomas

perhaps this helps:
Automation or script for managing MQTT Sonoff RF Bridge binary sensor state during hass restart - Configuration - Home Assistant Community (home-assistant.io)