đŸȘ„ Manual Light Control With Auto OFF

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

GitHub Link Click Here

Like this blueprint? Consider hitting the :heart: button below :+1:

Version: 1.0 :fire:

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.

:rocket: CHANGELOG

:shield: MY OTHER BLUEPRINTS

:bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time
:high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers
:infinity: Sensor Light Add On - Media & Movie Lights - House Alarm Lights - Smoke Alarm Lights & Exhaust Fans + More
:shower: Bathroom Humidity Exhaust Fan
:low_battery: Low Battery Notifications & Actions
:vibration_mode: Appliance Notifications & Actions - Washing Machine - Clothes Dryer - Dish Washer - ETC
:loudspeaker: Notifications & Announcements
:calendar: Calendar Notifications & Actions
:round_pushpin: State Notifications & Actions
:robot: Android Notification Channel Manager
:toilet: Toilet Exhaust Fan with time delay
:hourglass_flowing_sand: Entity - Run ON Timer
:door: Closet, Pantry, and Cupboard Lighting
:timer_clock: Timer
:thermometer: Temperature Control Fan
:snowflake: Temperature Control Exhaust Fan - Inverted
:eight_spoked_asterisk: Toggle Switch - Turn ON & OFF Entities
:nazar_amulet: Press Button - Turn ON & OFF Entities
:on: Switch - Turn ON & OFF Entities

Like this blueprint? Consider hitting the :heart: button below :+1:

17 Likes

FAQ

Q: How do I create a group helper?

A: Please Click Here.

Q: How do I create a timer helper?

A: Please Click Here.

FAQ - Creating a group

  1. Go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Group”.

  1. Select Binary sensor group.

2

  1. 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.

  1. 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.

8

Then select “Group Options”

You will then see your entities. Edit as required.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

FAQ - How do I create a time helper?

  1. Go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Timer”.

  2. 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.

    2

  3. 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.

3

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

1 Like

Initial release 1.0

:wave: Say goodbye to lights left on! Step into automated lighting with an auto shut-off and a motion sensor reset. :magic_wand::bulb:

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 :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

4 Likes

I am the first one to like this new automation :stuck_out_tongue:

Nice one, hopefully more people will like it once they know about it and understand what it can do.

Blacky :smiley:

Now we are talking. Will give this blueprint a try with my current setup. :slight_smile: This seems to solve the exact use case I mentioned in the Sensor Light topic.

Thank you very much for this blueprint.

Thanks @Blacky exactly what I was asking for!
I have configured it and I it works as designed :slight_smile:
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.

Your welcome, hope you like it.

Black :smiley:

Nice one thanks for the feedback.

Have you seen my :honeybee: Bee In The Hive Sensor :honeybee:? 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. :+1: Just a question what if there are a lot of items in the area? It will turn ON and OFF everything :thinking:

Blacky

1 Like

Excellent, apologies been away so missed your other reply. This looks ideal, will load it in and have a play.

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.

For restart the trace shows:

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.


The light going unknown then On (when Z2M restarts)
image

Might it be better to have the trigger going from anything to ON rather than from Off to On as a trigger?

I have tested it again here and when the light is on and motion is detected it pauses then resets when motion is cleared.

I will check the restart later when no one is using our HA.

Blacky :smiley:

I have tested it here on a restart.

Manual light ON + timer ON + No motion and I got this.

So now it is waiting for the timer to go OFF and when it did I got this lights OFF.

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 :wink:

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.

Blacky :smiley:

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.

So it did get there in the end.

Blacky :smiley:

So it did get there in the end.

Blacky :smiley:
[/quote]

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.

Okay thanks for the info