One button controlling multiple targets?

Hi, I’m quite new to homeassistant, having been doing a lot of what I want to do with simple Python scripts.

I want to move everything over to Homeassistant however there is one thing I can’t work out what to do.

I want to have one MQTT button with the ability to control multiple MQTT lights in a room. For example:

push - lamp A turns on
push - lamp B turns on
push - lamp A and B both turn off

EDIT: I’m not talking about multi-press where i’m double- or triple-tapping. These presses could be many seconds apart.

So, a bit more advanced than a simple group toggle.

Anyone got any ideas?

A nested if statement?

If A is off, turn on A
Else If B is off, turn on B
Else Turn Off A and B

Although I think I get what you are looking for. Umm I would think a multi-button controller would just be easier… and help keep your sanity of not maintaining code… a single mini-mote and a button for each action and if you want you could use a button for an entire scene or go crazy and have a bunch of buttons to do all kinds of weird stuff depending on the state of the stars and moon and if the taxi is at the corner of broadway and lamp a is off… :slight_smile:

Ah, that’s would do it. I hadn’t quite twigged that I could build logic into an automation like that. Thanks!

1 Like

I hear you, that’s the more elegant solution but I’m dealing with the hardware I have at the moment. Plus I am using HomeKit and Alexa as primary controls - having buttons is just to keep my wife happy!

Set your pushbutton up as a switch in HA.

Create a counter and an automation that increments the counter by one when the pushbutton is pressed.

Another automation resets the counter to 0 when the counter reaches 3.

Now create your light automations that trigger with different values of the counter ( 1,2,3 )

1 Like

Ahhh the ever important and looming WAF… yes… I understand. I got her a button too… The Fibaro big red button… it screams through the speakers for her. :smile:

If it was for my wife I know a little mini-mote with 3 to 4 buttons would be easier to remember for her than 1 press this light another press this light and so on and on… course I’d have too much fun changing it around and she’d be hitting the big red button all day long!!