Automation Based on Scene Activaton

Hello,

Been using Home Assistant for a bit now and have been able to answer all my questions with some Googleing up to this point.

Here is my problem:

I have an automation setup (“Lights When Home”) so that if either me or my wife are home and the lux value (light sensor) is at or below a certain level, the specified scene (“Inside Lights - HOME”) is activated.

That part works ok but the problem I’m having is that I have a “Goodnight” scene setup so that when we go to bed, we activate it from the dashboard to turn specific lights off, lock the doors, etc. However, with the aforementioned automation setup, the lights just end up turning back on because the conditions (we’re home and the light level is low) is still true.

I think that what I need is a way to tell Home Assistant to ignore an automation if a specific scene is called. Maybe, if the “Goodnight” scene is called it ignores the “Lights When Home” automation until sun up, or a specific time, or until a specific scene is called.

I’ve played around with a few iterations, including with Node-RED, and lots of searching but have not been able to come up with anything that seems to work.

Any advice is appreciated.

The problem is that scenes are always in the same state, you can’t tell when they’re running.

What you could do is have the scene set an input_select so that you know it started? Then you can check that in the conditions of the automation.

As Tinkerer suggests.

I personally have a input_boolean that turns on when the Lux level drops below a threshold. I call this night_time_lighting. I have another one called house_in_night_mode so when I say “Activate Goodnight House” to Google, a script is run which sorts out heating and turning off TV’s, changing light levels etc and then turning off lights in rooms that are not occupied. The script then sets this input boolean to on. This enables motion sensor automations to distinguish between whether lights need to come on full brightness on movement, or at a dim level for middle of the night movement.

In your automation for the Lux sensor, you would simply use input_boolean.house_in_night_mode off as a condition. I reset house_in_night_mode to off at sunrise with another automation.

1 Like