Turn off multiple switches with one mqtt command

Hi,

I have 4 MQTT switches, subscribed to the following topics.

Switch 1 - sonoff/switch/sonoffbasic1
Switch 2 - sonoff/switch/sonoffbasic2
Switch 3 - sonoff/switch/sonoffbasic3
Switch 4 - sonoff/switch/sonoffbasic4

Everything is working perfectly and I can toggle each switch by publishing ON or OFF to each topic.

Is there a way to switch ALL switches off with a single command?

I tried to Publish OFF to \switch assuming each one would “see” that, however, I think I am wrong. I also tried Publishing OFF to switch, without the \ but also no go.

I looked at wild cards but that seems to be for Subscribing not publishing, any advice would be greatly appreciated, i cant quite get my head round it.

Hi Brad, welcome to the forum!

You can create a group with these switches as members.
Go to ‘Settings’ → ‘Devices & Services’ → ‘Helpers’ tab → ‘CREATE HELPER’ button → select ‘Group’ and add the switches.
Afterwards you can use this group.

2 Likes

Thanks,

Works Perfectly!

1 Like

You’re welcome!