Is it possible to do an "undo" ? button press?

Hi Guys,

I have a button at the front of my door, it’s programmed to turn off all the lights in the house. I use this when I leave the house.

A reoccurring issue I’m seeing is that people are intrigued by this button, and they press it.
So the scenario is I invite guests over for dinner or something, and then this button is pressed and all the lights turn off.

what I want is an UNDO button, if it’s pressed by accident, then I’d like to be able to reverse the last command… a.k.a I want to turn on the same lights at the same presets.

is this possible?
is it possible for HA to know the previous state?

Well, yes, but it’s complicated so a better solution is to not invite people around to your home who are in the habit of randomly pressing buttons to see what they do.

In the event that all of your friends are incapable of keeping their hands to themselves, I would…

Set a script that saves the state of all your lights to input_numbers (even more complex if you have colour bulbs). Fire this script when the button is pressed. Then set an ‘undo’ button that sets the lights to the saved state.

Then I’d go to all of your friends houses and curiously investigate what the big red circuit-breaker does in their fuse box.

2 Likes

Cool, so it can be done.

as I was eating diner an alternative answer came to me…
I’ll make a single press do nothing, and I’ll make a double press shutdown all the lights, I don’t think people will be double pressing the button.

1 Like
1 Like

I have a xiaomi button which turns everything off when I’m leaving my home.

I have one automation which is triggered by a long press. This enables a second automation for ten seconds and a countdown is started. Then a single button press starts this second automation which turns everything off.
After ten seconds the automation is turned back off.

That’s really cool!