Time trigger not firing

I’m at a loss here. I am trying to have the automation below execute. I have tested the notify function, I’ve tested the sliders, I’ve tested the value template, there has to be something painfully obvious that I am NOT seeing. I did try single quote around the template, double quote, no quote. (interestingly no quote just stops HAss from starting, no errors in logs just NOTHING) For formatting: http://hastebin.com/johukeriku.sm

  • alias: ‘Check Every 5 minutes for updated time.’
    platform: time
    minutes: ‘/5’
    seconds: 5
    condition: template
    value_template: “{{ now.time().strftime(”%-H") == states.input_slider.alarmhour.state and now.time().strftime("%-M") == states.input_slider.alarmminutes.state }}"
    service: notify.notify
    message: “timer”
    title: “Test Fire 5 minutes & 5 Seconds”

Have you checked your logs to see if the automation is firing and your just not getting the notification?

If that’s the case then did you name your notify platform? If not try changing to this.

service: notify.NOTIFIER_NAME

Thank you, unfortunately it didn’t change anything. I hadn’t named the notify platform, but naming it and commenting out the condition and rename the rule to something more grep friendly, I see it pop up in the log at restart.
16-06-09 14:36:41 homeassistant.components.automation: Initialized rule 5_minute
However, with the condition in place it never initializes the rule.

Logs are set to default: debug in an attempt to figure out the problem. Since the automation consists of the sensor and value_template I dont see much point in limiting logging.

Nothing in the lots at the trigger time. Commenting out the conditions on the trigger gives me the initialized rule line in the logs as well as notifications every 5 minutes. Either the test is wrong (which I’ve verified is correct) or the condition template doesn’t like my syntax or something…

I have the same issue with a similare automation. When I test this template with developper tools, if it is 14:30 by example :
{{ now.time().strftime("%-H") == 14 and now.time().strftime("%-M") == 30 }}

I have only False result, never True.

Tried a new value_template, no luck. Tried to go with ‘{{ states(“sensor.time”) == states(“sensor.alarm_time”) }}’ so compare time to the set time. I get a false now, I tried to throw it in an automation, since it only matches for 1 second technically. I still dont get anything.

The problem with now.time() is that its not actually 8:52. its. 08:52:36.662273 I had the same problem when I tried to states.sensor.time I got the name and all of the information. So when I use {{ states(“sensor.time”) }} I get a result of like 08:15 I don’t get the whole time. Not sure if its just showing me that or if its using that as its comparison.

I think you’re formatting wrong time.
On an automation of mine I have now.time().strftime("%H:%M") and it works perfectly, so maybe yours should be now.time().strftime("%H"), not now.time().strftime("%-H") (note the hyphen).

EDIT: If you want something that triggers at determined time, why not use the template for triggering, instead of being a condition? I have one for my wake up automation:

- alias: 'Wake up'
    platform: template
    value_template: '{{ now.time().strftime("%H:%M") == states.input_select.bedroom_alarm.state }}'
    - condition: time
        - mon
        - tue
        - wed
        - thu
        - fri
    - condition: state
      entity_id: input_boolean.bralarm
      state: 'on'
    service: scene.turn_on
    entity_id: scene.wakeupbedroom

What does you input for bedroom alarm state look like?

This is the sliders to set the time. The problem is that the hour slider is single digit and doesn’t force double digit. i.e. 09:30 vs 9:30. Does anyone know how to correct that?
name: Hour
icon: mdi:timer
initial: 9
min: 0
max: 23
step: 1
name: Minutes
icon: mdi:timer
initial: 0
min: 0
max: 55
step: 5

I have an input_select with 3 times ( 06:00 07:00 08:00 ) for my wake up alarm.

Take a look at this post from @masterkenobi and the following, maybe give you some ideas

Thats where I started, unfortunately I think the problem is the input slider, before noon all of the digits are returned as single digit. i.e. 9:30 vs 09:30. I was trying to use a template to add a leading digit or change it to a time value (assuming it adds the leading zero) but I cannot get that to work.

tried using: https://gist.github.com/douglasmiranda/5408278

Well I changed from the input slider (since I cant pad the hour with a zero) and went to an input_selector, listed out the options in 1/2 hour increments and tested. SUCCESS! Note: I have to quote the options that were double digit hours, otherwise i got some interesting math.

Great news ! Could you post your automation ?

Thank !

name: “Turn on time:”
- ‘12:00’
- ‘12:30’
- ‘01:00’
- ‘01:30’
- ‘02:00’
- ‘02:30’
- ‘03:00’
- ‘03:30’
- ‘04:00’
- ‘04:30’
- ‘05:00’
- ‘05:30’
- ‘06:00’
- ‘06:30’
- ‘07:00’
- ‘07:30’
- ‘08:00’
- ‘08:30’
- ‘09:00’
- ‘09:30’
- ‘10:00’
- ‘10:30’
- ‘10:35’
- ‘10:40’
- ‘11:00’
- ‘11:30’
- ‘13:00’
- ‘13:30’
- ‘14:00’
- ‘14:30’
- ‘15:00’
- ‘16:30’
- ‘16:00’
initial: 06:30
icon: mdi:clock

is my input. note the hours are not completed here. I was just testing.

heres the automation:

  • alias: ‘Wake up’
    platform: template
    value_template: ‘{{ now.time().strftime("%H:%M") == states(“input_select.time”) }}’
    • condition: time
      • mon
      • tue
      • wed
      • thu
      • fri
        service: notify.pushbullet
        message: “works”
        title: “forum automation”

hope that helps!

Heres the hastebin for formatting.

Thank a lot ! It’s work for me too !

{{ (now().strftime("%H") | int) == 14 and (now().strftime("%M") | int) == 30 }}