Turning automations off when manually turning light off, better solution?

So I’ve been trying to come up with a solution to stop auto lights when they are turned off manually (touch button on wall or via Alexa).

Most of the solutions seemed to get somewhat complicated playing with context, status.id, etc. I came up with a solution using two boolean helpers.

My 1st boolean helper is “autoOff” (automation turned the light off). My 2nd boolean helper is “AutomationRan” (an automation to turn off light ran).

First automation runs everyday at 8am. It turns “autoOff” to “on” (at some point the night before we would have manually turned light off, so “autoOff” would remain off unless something turns it back on)

I then have two automations to turn on lights. One is for the PIR by the door, and the other for the mmWave sensor on the ceiling. In order for these automations to run “autoOff” has to be “on”

I have one automation to turn off the lights. When there is no motion/presence, it first sets “automationran” to “on”. It then turns the light off, and finally sets “autoOff” to “on”.

I then have a final automation. This one runs EACH time the light state changes to “off”. It checks status of “automationran”. If automation ran is “on”, it just turns automationran to “off”. if “automationran” is “off”, it changes “autooff” to “off”.

Could some of you with much more knowledge and experience let me know what are the pros and cons of my solution? It seems so simple that someone else should have figured it out before me, but didn’t really see anyone else come up with this approach.

I use areas like lounge room, kitchen, hallways, bedrooms, etc…

Each one of these areas has an associated “Lighting Mode/Scene” input select. The input select has the options, “Manual”, “Automatic” and for some areas other modes like “Watch Movie”.

Touching a physical switch in an area sets the associated input select to “Manual”. It also sends me an actionable notification asking if I want to change it back to automatic.

Other things like playing or pausing a movie also change this input select.

In my automatic lights automations I have a condition. Only do the actions if the input select for the area has “Automatic” selected.

Pretty cool setup, but how do you switch from “manual” back to automation? Do you have to physically turn it back on to automation?

Personally I find the HA interface AMAZING! but both my wife and step daughter NEVER use the HA app. I mostly log in to HA to configure, update, etc, but rarely do I pull out cell phone to control something via the HA app.

At the moment 90% of my smart home use is done via Alexa. Currently making the transition to install mmWave sensors and set up automations to turn lights on and off without having to even use Alexa.

Or I press this:

335608a0a4c0af56fe41ad1f6e8dd4becb9f2db7

Or use the individual input selects.

95% of the time the input selects are in Automatic mode. It’s usually only after I’ve had guests that I have to change them back.

Again, I love your solution, but it requires to use the HA front end, either you have to press a button on your HA frontend, or you have turn it back on via the notification asking if you want to turn automations back on.

In my case, both my wife and daughter will NEVER turn the automation back on if it can’t be done via Alexa.

You mentioned 95% of the time automations are on. How do you handle bedroom motion lights?

By having a condition that prevents the lights turning on if someone is in bed.

What happens if you get up in the middle of the night to use the restroom?

From what I have read, if I wanted to be able to tell if someone is on the bed or not, I would use load cells with HX711 basically making your bed a digital scale.

Currently running a setup in my roof where my stationary gas tank is. The actual weight reading fluctuates up and down everyday usually within 5 kilos, assuming temperature has to do with it. However by looking at the history I can see the overall trend that is getting lighter as we use up the gas. The graph looks like a bunch of U’s side by side with the next one just a bit lower.

To see if someone is on bed or not you wouldn’t need precise measurements.

Using an FSR is a whole lot easier than setting up your bed as a weighbridge.

The house alarm is disarmed until I go back to bed. Announcements don’t play until after 6am. Lights are in “Night Vision” mode by then (1% brightness).