⏲ Timer

Yeah good question.

The good thing with a timer is that it survives a restart and the time just continues on if you set it up correctly. Also if you restart HA and at the time you ask it to turn OFF, it is the exact time HA restarts then it will stay ON. How many time would this happen? probably a very rare occasion but is nice to know that if you start somting it you give it your best shot to make sure you turn it OFF. I do like it when you can just set the ON and OFF time with not having to do any maths, but unlike a local timer with a battery back-up this can help.

Blacky :smiley:

Thank you for the explanation. Good to know that timers survive a reboot (with some left over fringe cases).

In this particular blueprint, the start time appears statis, so the end time is also statis.
A start time at 7:15 with a duration of 15 minutes would be the same as start time 7:15 and end time 7:30.

I did think if a use case where I would want to adjust or extend the timer in certain events. This is not possible with a static end time, so your choice to use a timer seems to be more future/feature proof.

Yep, that is correct.

Blacky :smiley:

Hi , is it possible to edit timer directly from lovelace?

@supperka

Currently no but I will put it on the list of suggestions.

Blacky :smiley:

1 Like

This statement / benefit should be part of the 1st post.

Hi Blacky,
I am looking for random light on/off while on vacation.
Searched the community but nothing found .
A blueprint with the ability to set a time frame when the random action
must run with a days of the week selection and calendar option.

Is this what you might create for the HA community?

1 Like

This search will find a couple of them…
site:community.home-assistant.io lights away blueprint

1 Like

@Fred54

I have started this but never finished it and it just got forgotten. I will put it on my list so I don’t forget again.

Blacky :smiley:

I wanted to create a timer to " turn on a switch for 1 hour and then turn it off for half an hour. and then repeat" I did try this blueprint but it only runs once at 00:00 hours and doesn’t repeat for the next 24 hours. yaml code for the automation it created.
1 min on and 30sec off was used to test the automation only.

alias: "Timer for zigbee relay "
description: ""
use_blueprint:
  path: Blackshome/timer.yaml
  input:
    trigger_one_duration:
      hours: 0
      minutes: 0
      seconds: 30
    timer_helper: timer.1_hour_timer
    entity_input:
      entity_id: light.relay_1_light
    trigger_two_duration:
      hours: 0
      minutes: 1
      seconds: 0
    include_extra_triggers:
      - use_trigger_two

@yousaf465

In this blueprint you can turn ON and OFF 4 times a day.

Blacky :smiley:

you mean I have to use 4 timers to turn and off 4 times?

No, you have one timer, that timer can be use to turn ON and OFF your entities 4 times a day + it can move to the next day as long as it starts (see timer 4).

Example;

Timer 1 - Start Time = 6 am (ON at 6 am)
Timer 1 - Duration = 2 hrs (OFF at 8 am)

Timer 2 - Start Time = 9 am (ON at 9 am)
Timer 2 - Duration = 2 hrs (OFF at 11 am)

Timer 3 - Start Time = 5 pm (ON at 5 pm)
Timer 3 - Duration = 3 hrs (OFF at 8 pm)

Timer 4 - Start Time = 9 pm (ON at 9 pm)
Timer 4 - Duration = 6 hrs (OFF at 3 am)

Blacky :smiley:

New Update 1.2

:new: New Feature - Collapsible Sections

  • Collapsible Sections - Added collapsible sections to the blueprint. This enhancement improves the blueprint user interface by making it cleaner and more organized, allowing sections to be collapsed.

    :warning: This feature was introduced in Home Assistant 2024.6, so you must have this version or later for the blueprint to work.

:toolbox: Maintenance

  • Set blueprint to my new layout.
  • Update input descriptions for better understanding.

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:

1 Like

Hey Blacky,

I’m using this blueprint for a 16h on 8h off light setup. If home assistant is updated or restarted during the on duration it seems it looses track of the elapsed time and duration remaining. Is it feasible to fix this or might be unfixable?

@rs_007

Are you talking about the time it takes to restart HA is lost in the timer? If so that is a HA thing. So when HA restart it pauses the timer and then when it starts again it restarts the timer but you must tick restore. I hardly notice as my restart is about 1 second. I know my NUC running HA is a overkill but it fast.

Blacky :smiley:

Perhaps it might be on upgrades my home assistant core auto updates on Sunday (docker image) I’ve noticed once so far that the timer is going longer then the set duration

I could be… the reason we use a timer here is because if you have a long time like 4 hours and then you restart HA just before it ends it wont start from the start of 4 hours, it just completes the remain time… yes you have to add the restart time but that is normally not that much and it is the only way it can be done.

Blacky :smiley:

Aloha Blacky, I’m relatively new to HA and like your blueprint. I’m using this to turn on a ceiling fan at 8:30pm to run for a few hours, nightly. How can I add another condition (presence sensor) so that the timer doesn’t run when I’m away?

@Phily808

Aloha Phil, welcome to the community

This blueprint is just a basic timer.

I am developing a blueprint for ceiling fans though, :thermometer: Temperature Control Fan. It currently works of temperature but time, device tracker, maybe presence would be some condition I would consider adding to it. Looks like you live in Hawaii and it would be a good place to get some feedback from you and your thoughts on my other blueprint.

I am thinking rise in temp + time condition + HA knows your home = fan ON. Maybe have a look at the other blueprint and if you like post something in that thread.

Blacky :smiley: