Turn on One Switch When Another Is Turned On

Disclaimer - New to HA and automations. I’ve written a few and so far have had success but this one is testing my patience.
I have a couple Tuya switches, one that controls my patio light and one that controls my shed light. Using the Smartlife app, it was dead simple to create a series of automations that would turn one switch of when the other was turned of and vise versa - basically replicate the function of a three way switch without the controlling wire.
But - Since I am never happy with “good enough”, I want to get Home Assistant to do the same thing.

I figured it would be this simple:

- id: '1615850779938'
  alias: Turn on Patio and Shed Outside Lights
  description: ''
  trigger:
  - platform: device
    type: turned_on
    device_id: 8369893ef4ace0bc3e68ab7f3478a047
    entity_id: switch.043641402cf432d0d59b
    domain: switch
  condition: []
  action:
  - type: turn_on
    device_id: 4bf172d3611c9d307c12b83432423813
    entity_id: switch.32100611c82b96439e73
    domain: switch
  mode: single

But nope… it doesn’t work. Any help is appreciated.

Please try this. I have used state type trigger and action.

- id: '1615850779938'
  alias: Turn on Patio and Shed Outside Lights
  description: ''
  trigger:
  - platform: state
    entity_id: switch.043641402cf432d0d59b
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.32100611c82b96439e73
  mode: single

That does not work either. If I run the actions, then the second light turns on. However, manually turning the first light switch to on still does not trigger the second switch. What is interesting though is that if I turn one switch on using the dashboard card, then the other one switches on.

The trigger won’t work if the switch is already on. Maybe that is your problem?
Try from: ‘off’ as well as to: ‘on’ in the trigger.

As for Tuya switches also note that the state refresh of a switch often updates very slow (can take up >20 minutes) especially if you manually flip a (tuya)-switch.

For further explanations about the issue take a look here and here. One way to get around the issue is to also use the local tuya intergation.

Big thanks to Tamsy! I finally got around to adding Local Tuya. I followed Mark Watt Tech youtube video which made the process super easy. I rewrote the automations for turning one light on/off when the other is turned off/on and it works super fast.