Have you considered using presence detection (person) so when those people are home then it will enable the items you would like. If you are home then only some items are enabled and the other items are not. My sensor light blueprint will do this but not sure if that works for you.
@Blacky thanks for the blueprint. I’ve changed it a bit and added climate entity, because wanted to control floor heating with it. Here is the updated code: run-on-timer.yaml · GitHub
Hi, my entity is not working properly, due to some issue in the Time Configuration
Would appreciate if anyone could help me
- In condition I want to add – time 2 to 4 am and 2 to 4 pm – switch.toggle
- In the If statement I want to add - time after 4 am to 2 pm & 5pm to 1 am — if the entity state “ON” – ACTION “switch.off”
The below code is not working correctly
trigger:
- platform: state
entity_id:
- binary_sensor.input_2
id: "on"
- platform: state
entity_id:
- binary_sensor.input_2
id: "off"
condition:
- condition: time
after: "18:40:00"
enabled: true
- condition: or
conditions:
- condition: time
after: "06:40:00"
action:
- service: switch.toggle
entity_id: switch.e16s_output2
- if:
- condition: state
state: "on"
entity_id: switch.e16s_output2
- condition: time
after: "08:35:00"
- condition: or
conditions:
- condition: time
after: "20:54:00"
then:
- service: switch.turn_off
entity_id: switch.e16s_output2
mode: single
I am using this to control two e-bike battery chargers. The chargers are plugged into Sonoff S31 plugs running Tasmota and connected to HA using MQTT using the Tasmota add on. I added the switch names as the entities to the automation created with this blueprint. I set the off time to 2 hours. I created an entity list dashboard that has switches for the two entities that control the plugs and one for this automation. If this automation is turned on and I turn on one of the plugs it will turn off the automation in 2 hours. That lets me charge the batteries for a fixed amount of time when they are low. If I want to fully charge them I simply turn off the automation and turn on the chargers. It works perfectly! Thanks.
New Feature
Timer Helper - Added a timer helper option. By adding a timer helper it will survive a Home Assistant restart and resume its time. It also allows you to display the time in a dashboard.
Note - When creating your timer helper, make sure you tick the box to restore so it will survive a HA restart and don’t set any time in the timer helper duration, use the time settings in the automation.
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
Enjoy
Blacky
Hi, just trying to understand how this works, if I want multiple separate devices to turn off on a timer, do I need to create an automation from this blueprint for each?
Like, if I have a bunch of light around the house that I want to turn off automatically after x min of being turned on, is it not possible with a single automation?
I am on the next version 1.6 and I forgot to push it out. It has been tweaked a bit but If you would like each light to be able to turn OFF after X amount of time once it has been turned ON then yes. The new version will allow you to have multiple entities and you can just turn one ON or any of them ON but the time delay will be from the last one that was turned ON. 1.5 will turn them all ON and OFF together but 1.6 will give you an option to turn them ON and OFF together or turn them ON individually but they will all go OFF together. That may work for you
I will have to look at my version again to make sure it is ready to be released and then I will push it out. I try and get this done tomorrow.
Blacky
New Feature
Trigger Entity State - Added a trigger entity state option. You can now choose ON or OFF as the trigger state.
Trigger Entity Sync - Added a trigger entity sync option. This is now an option.
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
Enjoy
Blacky
I would like to be able to set the time for the timer using some control in the UI. Right now I have the timer hard coded to leave the device on for a fixed number of hours. I am using it to charge an e-bike battery and would like to be able to change the number of hours from a UI control instead of having to edit the instance of the blueprint.
I created an input_number in the UI and have a slider that spans the range of values that I’d like to use to set the number of hours that the timer is on. Is there a way to use this with this blueprint? I’m a bit of a HA newbie. I’ve done some reading and it seems I may need to use a helper and a variable plus a template, but I’m not quite sure how to do that. Can I do it without editing this blueprint and just make modifications to the automation that uses the blueprint? Any help would be much appreciated.
Not sure this blueprint is right for me, or if you can point to something else?
I am after a backup for lights that are manually turned on (dash or alexa or physical button), to have an auto time out.
So I use the sensor light for some rooms, but would like a backup for all rooms to monitor a light being turned on and left on.
Lamp on or Home Assistant starts.
15 min timer to turn off
But will reset if there is motion
and cancel if the light is manually turned off
Light turns off
I have created something myself but it isn’t great. Does this solve it for me or some other blueprint like this one?
Not sure if this is what your are after but just brain storming.
I would have a notification that would send a message to my phone if the light is ON for X amount of time and motion is OFF. Then I would have an action button in the message were I can decide if I would like to turn the light OFF.
Have a look at this State Notifications & Actions
- Use state and your light = on
- Start Trigger - Time Delay = X amount of time the light must be ON for.
- Global Conditions = motion must be OFF.
- Action buttons = set it up to turn your light/s OFF.
Set one up for each automation.
- One light used in a automation - easy set up.
- Two or more lights used in a automation - Use one light as the state trigger and in action turn OFF add all lights.
Maybe that will work for you.
If not
You will have to set up a template sensor for when the light is ON for X and motion is OFF = turn ON else = OFF. Then use that as a trigger in a automation to turn lights OFF. But you may have them going OFF when you would like them ON hence the notification method above, you get to decide and it is only if someone leaves the light ON and the automation gets tricked (sequence of events leads to the light/s being ON) and the light stays ON.
Totally up to you… hope this helps… let us know how you go.
Blacky
Thanks Blacky.
I must be asking for something out of the ordinary if it doesn’t already exist.
I have had it in node red for a while and find that an easier platform than Hass automations. But trying to tackle it here instead. Out of curiosity.
So far I have created a blueprint for this so I can cut down on setup for the various rooms. I won’t need it on the fully motion activated lights, your sensor light works perfectly there.
I won’t need it on lights that I intend to leave on for long periods. Eg lamps in some rooms or ambiance lighting. Outdoor lighting.
I do want it for main lights as now that so many are entirely automated by motion, the kids tend to just walk out and leave every light on.
Blueprint so far has an initial time period option, repeating time option. Light target to consider. Motion sensor and then an end/off scene.
I haven’t mastered how to be able to select both a light target to turn off OR an end scene to turn on yet. If I add both items to the command they both need to be populated. So for now I am just creating an end scene for each room/scenario.
Will keep at it for now. Unless you fancy a new challenge! Happy to share the code so far but wouldn’t have a clue how to maintain it properly. Be great to improve it so you could select different options for the command. Light to turn off or scene to activate. Feels like it’s basically quarter of your sensor light version. But the light or I suppose scene being activated as a list of triggers being the trigger to start it off.
I have PM you.
Blacky
Getting ready for a new update
Blacky
Would it be possible to add a time or sun variable. I not want to turn off lights running for an hour after dawn and before dusk.
Have a look at this blueprint. Turn Light, Switch or Scene On & Off with Trigger Conditions
It may do what you are after.
Blacky
Great blueprint. It would be really great if you could perform an additional action at the end, for example to be able to run a Notify service.
It’s not that important anymore. I have built my own small automation because I need to be a bit more flexible.
The reason for the question:
I have a timer running for my fountain in the garden. At the end of the timer, the fountain is switched off and I would like to be informed of this.
Sometimes it is essential to be informed about the end of a timer. That way you can learn from previous mistakes. For me, timers are always a kind of emergency solution when everything else has failed.
No problem… I have this blueprint for notification of state change. State Notifications & Actions. You can set it so when your fountain is switched off you get notified. You can also have it for ON and OFF notifications with action buttons. The action are anything you like. Example it can notify you when fountain is switched ON and you can have an action button in your notification to turn it OFF…
Blacky