⏱ Trigger - Run ON Timer

@tomasd

All your YAML looks good, just check your timer helper. Below is my one for your reference. Note the duration and the restart must be ticked so it will survive a HA restart.

Let us know how you go.

Blacky :smiley:

I have the timer set the same. This is a trace that happens when the timer stops and the climate should be turned off:

I’m not sure which parts of the trace are useful.
This is step details:

Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/0/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false
entities: []
conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/1/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false
entities: []
conditions/2
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/2/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false
entities: []
conditions/3
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/3/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false
entities: []
conditions/4
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/4/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: true
entities: []
conditions/4/conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/5
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/5/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: true
entities: []
conditions/5/conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/6
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/6/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: true
entities: []
conditions/6/conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/7
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/7/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: true
entities: []
conditions/7/conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/8
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/8/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: true
conditions/8/conditions/1
Executed: January 21, 2024 at 12:20:49
Result:
result: true
entities: []
conditions/8/conditions/2
Executed: January 21, 2024 at 12:20:49
Result:
result: false
entities:
  - climate.kotelna_bojler
conditions/9
Executed: January 21, 2024 at 12:20:49
Result:
result: false
conditions/9/conditions/0
Executed: January 21, 2024 at 12:20:49
Result:
result: false

For the sake of testing, I’ve set the run time for 10s.

It does not work just for the climate. When I change the boiler climate with a switch it works great.

Should I send you anything else?

I see, I will PM you.

Blacky :smiley:

Hello !
Many thanks Blacky for this really nice blueprint.
I wanted to develop one but yours is so advanced I gave up mine :wink:

I would like also to add a condition (SUN condition).
How I could achieve this in your opinion please ?

My use case:

  • 3 triggers (1 helper “button”, 1 switch, 1 motion sensor)
  • the entity to turn on is a light
  • I would like to switch on the light when a trigger is activated AND during night only

Another request:

  • could you add a notification system before and after the action ?
    For instance, a notification is sent via Telegram or other solution before the light is switched on and another notification after it is back to off.

  • last question: how do you display remaining time of a timer please ? I can display the duration of the timer in a card but not the remaining time.

Thank you again !

Hi again,

I’m still testing your blueprint. I’m facing an issue when I use a timer helper:
Everything goes well until the timer is over:

When I click on the trigger-button, the timer looks good:
image

At the end of the timer, the light doesn’t switch off and in the log:

homeassistant  | 2024-02-23 08:45:04.024 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Test timer bureau':
homeassistant  | In 'condition':
homeassistant  |   In 'or' (item 9 of 10):
homeassistant  |     In 'and' (item 3 of 3):
homeassistant  |       In 'template' condition: UndefinedError: 'dict object' has no attribute 'entity_id'

I don’t understand my issue… :thinking:

Thank you in advance !

It is probably because you are using a device and not an entity. But have a look at this blueprint :magic_wand: Manual light control with auto OFF it may be more inline with what you are trying to do.

Blacky :smiley:

Hi,

Many thanks !!! I changed to an entity and now it works perfectly !! :sparkler:

The blueprint you mentioned is not totally what I’m looking for, but I keep it :+1:

Thanks ! :pray:

1 Like

FAQ

Q: How do I create a timer helper?

A: Follow these steps click here

FAQ - How do I create a timer helper?

To create a Timer Helper, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Timer.
  4. Provide a Name and Icon of your choice. Leave the duration set to 00:00:00 and tick the Restore box.
  5. Click Create.

5

Your done :tada:

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

New update 1.7

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

3 Likes

My end durations were never triggering the ‘off’ state. I finally recognized I had changed “Use The Timer Helper Options” to ‘Use a timer helper’. I expected that since I hadn’t selected a Timer Helper in the next form item, that it would fall back to the default delay duration triggering the ‘off’ state but this is currently not the case. Basically, if you say you’ll use a timer helper but don’t specify one, your timer will never fire.

I suggest removing the 'Use a Timer Helper Options question altogether. You can infer from the ‘Timer Helper’ question. Use one if one is specified, otherwise don’t.

@hubdedub

Welcome to the comunity

If you select to use the Timer Helper then yeah you have to input your timer helper into the Timer Helper input. In the description of Timer Helper input is states that you need to select your timer helper if you opted to use a Timer Helper. I will update it so that if you select to use a Timer Helper and you don’t select one it will not work.

Thanks for your feedback.

Blacky :smiley:

New update 1.8

Maintenance :toolbox:

  • From time to time, Home Assistant updates their YAML standards and coding practices. To align with their roadmap, we’ve updated the code accordingly. We will continue to apply these updates across all our blueprints as they are revised.
  • If you opted to use a Timer Helper and you don’t input your timer, the automation will not run.

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:

New update 1.9

:new: New Feature

  • Trigger Five - Increment Duration - Every time the button helper is pressed, it increments the timer’s remaining time by a specified duration set in the Increment Duration (e.g., 15 minutes). The value is dynamically added to the timer’s remaining time, ensuring the timer’s duration continues to increase with each press of the button helper.

    This input is ideal for scenarios where you need to extend the timer’s duration repeatedly, such as when additional time is required for tasks, without resetting the timer completely.

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:

I’m new to blueprints, but just added this and it works as intended! :+1:
I have a feature suggestion though: I have a switch (not a button) connected to a light, and used this to set a 10-minute timer. But sometimes 10 minutes is a bit short, and since this is a switch and not a button I can’t use the increment trigger. But what if I turn the switch on, off then on again within say 2 seconds. That can be a good way to tell the timer to go for twice the duration or something. Is that something that the blueprint could support, or should I add a separate automation?

@jswetzen

Maybe what you can do is when you turn the switch ON it turns ON a toggle helper and then when you double turn the switch ON it turn ON a different toggle helper. Then use the appropriate toggle helper for trigger 1, 2, 3 or 4.

Blacky :grinning:

The tricky thing is to capture that it’s a double switch, but toggle helpers sounds like a good thing!

1 Like

Hi
I am trying to add a zigbee button as a trigger, but can’t get it to work. Here’s what I have tried:

alias: Oven Alert Timer
description: ""
use_blueprint:
  path: Blackshome/trigger-run-on-timer.yaml
  input:
    include_timer_helper: enable_timer_helper
    timer_helper: timer.6s
    entity_input:
      entity_id:
        - script.alarm_light
        - script.oven_alert
    trigger_one:
      - device_id: fd7e9c789297b79b935b1d0c8694d73e
        domain: zha
        type: remote_button_short_press
        subtype: button_1
        trigger: device
    trigger_one_time:
      hours: 0
      minutes: 10
      seconds: 0
    include_extra_triggers:
      - use_trigger_two
      - use_trigger_three
    trigger_two_time:
      hours: 0
      minutes: 20
      seconds: 0
    trigger_three_time:
      hours: 0
      minutes: 40
      seconds: 0
    trigger_two:
      - device_id: fd7e9c789297b79b935b1d0c8694d73e
        domain: zha
        type: remote_button_double_press
        subtype: button_1
        trigger: device
    trigger_three:
      - device_id: fd7e9c789297b79b935b1d0c8694d73e
        domain: zha
        type: remote_button_long_press
        subtype: button_1
        trigger: device

this gives me an error when I try to save it:
Message malformed: Entity {'device_id': 'fd7e9c789297b79b935b1d0c8694d73e', 'domain': 'zha', 'type': 'remote_button_short_press', 'subtype': 'button_1', 'trigger': 'device'} is neither a valid entity ID nor a valid UUID for dictionary value @ data['entity_id']
Is there a method to add this button as a trigger? The main advantage in using this, is that it has 3 different action methods, short press/double press/long press; it saves me for glueing 3 different buttons next to my oven :slight_smile:
otherwise, I like very much what you did here :wink:

@netphantm

Your using a device as the trigger and that wont work.

Can you create 3 button helpers and use them in the triggers. Then have your zigbee button short press pushes button helper 1, double press pushes button helper 2 and long press pushes button helper 3.

Blacky :grinning:

Really appreciate you creating this blueprint @Blacky :grinning:

I have an exhaust fan controlled by a shelly located behind the switch, the fan works fine when i use it via the wall switch or within home assistant.

Is it possible to use this blueprint to make the fan for 30min if whenever the fan is turned OFF via the switch or within home assistant?

I tried the blueprint but couldn’t get it to work :frowning:

The first problem i had - The fan was triggered by turning the switch off but then it never turned off & i was unable to turn it off at all.

The second issue i had - I made some changes to how i set the automation up and then i couldn’t get the trigger to work at all.

Sorry if these are basic questions, i’m fairly new to HA