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.