I'm trying to turn on 2 lights with 1 switch

Hi there, first time posting.

I’m new to Home Assistant. I have 4 TP-link wall switches and just recently I purchased about 10 Sonoffs. After several failed attempts I successfully flash the firmware with tasmota.

All my devices in Home assistant is showing up as a “switch” (which is fine)

What I’m trying to do is very simple, I want my sonoff living room lamp to turn on when I hit my tp-link wall switch for my other living room light.

I was able to create a Group with both living room switches, but I don’t know how to make the automation for my wall switch to turn them both on.

I searched… but came up empty-handed. (search results come back with much more complicated requests)

Any help would be appreciated.

Thanks!

Try something like this:

trigger:
- platform: state
  entity_id: switch.xxxxxxxx #tp link switch
  to: 'on'
  from: 'off'
action:
- service: switch.turn_on
  entity_id: 
  - switch.yyyy #sonoff device1
  - switch.zzzz #sonoff device2

Or were you looking for something else?

@taikapanu thank you, that sort of work.

the automation works if I use the home-assistant soft switch on my dashboard.

but if I use the tp-link switch on the wall… the automation doesn’t get triggered.

Do you have the tp link switch in HA?

You can view under states menu what kind of states are received and modify to: and from: accordingly.

Hey, thanks again, it looks like it is working, there’s just a long delay.

when I hit the wall switch, the soft switch doesn’t turn on for a good 6, 7 seconds. once it does thought, the other lamp turns on.

How can I script it for it to turn off?
I tried doubling the code… but it threw errors at me.

You need to give your automations a unique aliases like an example here. https://www.home-assistant.io/components/automation/

Or unique ID if you want to use the front end editor.

Flip the states in trigger (from, to) and use service switch.turn_off.

Is the tp link switch able to send mqtt messages and control the lamp directly? Assuming you use mqtt with the sonoff devices. HA would be much faster to spot this.
Just change the automation to check state of one of the sonoffs and change the other accordingly.