Say goodbye to lights left on! Step into automated lighting with an auto shut-off and a motion sensor reset.
Like this blueprint? Consider hitting the button below
Version: 1.1
The Automation Process:
Trigger Entity State:
When the entity is turned ON manually, it will automatically turn OFF after the pre-set time delay.
Trigger Entity Synchronize Option:
When using multiple entities, if one entity changes state (manually turned ON or OFF), all entities will automatically synchronize their state.
Motion Sensor Option:
When the light is turned ON manually and motion is detected by the sensor, the timer will be paused.
Once motion is cleared, the timer will reset back to the start.
If you are not using a timer, it will restart the timed delay once motion is cleared.
Timer Helper Option:
Option to use a timer helper.
Display remaining time on your UI dashboard.
Easily manage timers by pausing, cancelling, or completing them from the user interface.
HA Restart Behaviour:
With a timer helper:
It will resume after a Home Assistant restart, maintaining the timerās state.
Without a timer helper:
After a Home Assistant restart, the automation will attempt to reset, restarting the time delay from the beginning.
CHANGELOG
Version: 1.1 - 23 March-25 - Fixed a bug when the timere was paused and trigger turn OFF manually. Update to Home Assistant YAML standards and coding practices.
Then enter a name, in this example we put āSensor Light - Front Door - Groupā. Then select your āMembersā or entities (all of them that will be in the blueprint automation). Keep āHide Membersā and āAll Entitiesā toggles OFF as shown below.
Then go back into the automation and in the āMotion Sensor - Binary Sensors" selection search for the name (Group) you just created in this case āSensor Light - Front Door - Groupā and select it. If you would like to add more or remove some entities from the group you will have to go back into the helper and edit it (see below)
EDIT HELPER
If you need to edit the Helper. Go back to Settings / Devices & Services / click on the āHelpersā tab / click the helper you would like to edit, in this case āSensor Light - Front Door - Groupā. Click on the cogged wheel.
Enter in the name you would like to call your time helper. Select an icon if you like. Leave the duration set on 00:00:00 as the automation will apply your setting to this. Click ārestore?ā, this will restore / keep the time helper going if you restart Home Assistant.
Your done. Now just add the time helper into your automation.
TIP: If you add your time helper into a dashboard and you click on it you will be able to pause, cancel or finish it.
Say goodbye to lights left on! Step into automated lighting with an auto shut-off and a motion sensor reset.
New blueprint hope you like it.
I designed this blueprint to complement my sensor light blueprint or function independently as a versatile automation.
If youāre using my sensor light blueprint to control the main lights in a room, you may still want manual control over additional lighting fixtures like lamps or mood lighting. This blueprint offers that flexibility. When you manually turn on these additional lights, they can operate using the same motion sensor that controls the sensor light blueprint. As you leave the room and the main lights turn off, these additional lights will also switch off, adding even more options and flexibility to your setup.
This blueprint is also ideal for spaces like bedrooms, barns, sheds, etc., where manual control is preferred but you often forget to turn off the lights. Simply use this blueprint to control the lighting in those areas. When you manually turn the lights on, the motion sensor will automatically turn them off if left ON. Say goodbye to lights being left on by forgetful kids!
Anyway hope you like it.
If you like this blueprint? Consider hitting the button in the top post
If you like my blueprints, and would like to show your support or just say thank you? Click Here
Now we are talking. Will give this blueprint a try with my current setup. This seems to solve the exact use case I mentioned in the Sensor Light topic.
Thanks @Blacky exactly what I was asking for!
I have configured it and I it works as designed
I have a few suggestions:
Allow a door contact to also pause the time (Wasp in a box scenario) Especially if you donāt move light can be turned off, when just having a motion sensor, not a presence sensor.
Allow to trigger by area. So If I turn any light on in the room, the automation is triggered also turns of everything in that room. When I add or remove a light, I donāt need to touch the automation again as the area is updated in the background.
Have you seen my Bee In The Hive Sensor ? It will do what you are asking. To find out more about it and how to do it click here. You would use this sensor in a group with your motion sensor and add it into Motion Sensor - Binary Sensors input.
I have a look at that and add it to my list. Thanks for the suggestion. Just a question what if there are a lot of items in the area? It will turn ON and OFF everything
My first attempt of using a timer in an automation so might be me.
The timer I created pauses when there is motion and then on clear continues to run down.
SO a 5 min timer is ticking down but if I move at say 1 min, it then waits for clear then resumes? Rather than resetting back to 5 mins?
So its better to not use a helper if you want a full 5 min āclearā state for the action?
Assuming that is the intent, I changed to the straight timer and set at 2 mins for testing.
Now on a reboot, in my testing it didnāt work. I think because there needs to be a delay between HASS restart and the decision being made if a light is on so to restart the timer? In my case lights are connected over Zigbee2MQTT and it takes some seconds before the state is known on a restart. Not sure the right number but guess it depends on each setup, maybe needs a long delay of say 1 or 2 mins, or a user defined option to set based on user environment?
Test - Light is on. Restart HASS and leave room. Wait to see if light turns off after reboot + the delay time.
I did think that once Z2M loaded the light being recognised in the ON state might trigger the new instance of the automation anyway, so saves having any delays or need for that, and start the timer but it didnāt?
So this is trace of light on with reboot. then the room being empty without motion to trigger the automation.
My light state stays ON when HA restarts, so if it is Zigbee2MQTT then we need a work around.
One thing that comes to mind is template sensor. Below is a example of the code used in a binary template sensor. When you restart and your light is unavailable or unknown and the timer is active or paused it will be ON
Go to Settings > Devices & Services > Helpers Tab at the top > Create Helper > Template > Binary Sensor and in āState Templateā paste the code below replacing the two inputs with your entity IDās
{% if is_state('light.your_light', ['unavailable', 'unknown']) and
is_state('timer.your_timer', ['active', 'paused']) %}
on
{% else %}
off
{% endif %}
Once done add it to Trigger - Lights & Switches adding in another light or switch then edit in yaml and replace the entity ID with your template sensor.
Oh my days, the helper timer is working now. Wonder if I need to restart HASS after setting the timer up. Weird. It was honestly pausing then carrying on from where it was earlier!
On a restart it did just continue too. The timer was at about 15 secs when the light state went from unknown to On. So this time it did indeed turn the light off.
Test 2 - with the Helper timer, I let it run to around 45 seconds then did the restart of Hass. I kept a screen on with the dash showing offline, though the countdown continued. By about 3 seconds the light went to unknown, timer continued to 0. nothing (as light not displayed as On). Light eventually changed to On after another 20 seconds or so but the timer was now Idle. No movement and assume light will stay on forever.
Not tested without the helper timer and just the default in the bluerprint yet.
I am convinced its linked to the delay with Z2M for light state. Seems to need at least 60 seconds from a restart to then trigger the automation. Maybe that is a solution? Restart = wait 60 seconds before taking action?
Tried the template you suggested, changing the items for light and timer. Canāt add, is the entity list restricted to only light or switch currently for a trigger?
Although to combat the delay from Z2M, wouldnāt a state change from anything to On work as would just trigger a new run of the automation assuming the light had been activated/switched on ? Where currently seems to ignore an Unknown to On as a trigger?
I have just tried that by commenting out the line in the blueprint for from off to on as a trigger - line 149
Rebooted at 45 secs with the light on, by the time it got to 0 timer went Idle and light was on but showing āunavailableā. Bit later when the light was detected to On again the timer started and once complete it did turn off.
That feels like a reasonable solution that works for most folk?
Thanks for all your testing and information. I will have a look at it.
Just add in a switch or a light (donāt worry you will replace this), then edit in YAML (3 dots to right). Then replace your light or switch entity id you just added in with your template sensor entity id and click save.
Yes but only with the āoffā to āonā trigger changed to an āonā trigger. Otherwise it wouldnāt trigger until there was more motion, which could be the following day/week.