Closed fourtrax01 closed 4 years ago
@fourtrax01 Hello! Are you using the legacy sensor or the input_datetime sensor?
Input_datetime.sensor
@fourtrax01 What value do you see for the input_datetime when looking at it in hass? And how does your automation look like? Make sure you are comparing the current time using the correct time format.
This is my value template from my automation, I don't know jinja so I just copied yours. "{{ states('sensor.date_time') == (state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %H:%M', True)) }}"
Date & Time 2020-03-26, 05:51
Can you paste these in the template editor to get the values:
date_time: {{ states('sensor.date_time') }}
input timestamp: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int }}
input formatted: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %H:%M', True) }}
input formatted 12h: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %I:%M %p', True) }}
And what is your time now? 6:10am or 6:10pm :)? and your alarm is set to 8:30am?
6:21 am alarm set for 8:30 am
Does it matter that the date is formatted differently as well? My alarm reports March 26, 2020 not 2020-03-26 add the date
And what if you set an alarm for one minute a head, open the hassalarm app and go in to "Test Connection" to force push a new value, then add these to the template editor:
date_time: {{ states('sensor.date_time') }}
input timestamp: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int }}
input formatted: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %H:%M', True) }}
input formatted 12h: {{ state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %I:%M %p', True) }}
24h/True: {{ states('sensor.date_time') == (state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %H:%M', True)) }}
12/True: {{ states('sensor.date_time') == (state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %I:%M', True)) }}
24/False {{ states('sensor.date_time') == (state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %H:%M', False)) }}
12/False {{ states('sensor.date_time') == (state_attr('input_datetime.next_alarm', 'timestamp') | int | timestamp_custom('%Y-%m-%d, %I:%M', False)) }}
Well you have to wait until 06:42 before your do the evaluation :)
My alarm went off but the automation didn't trigger
Is the value template for my automation wrong?
I want you to evaluate the expressions I posted above in the template editor during the same minute that your alarm is set to trigger, and see if any of the four expressions evaluates to True.
Then I will have to do it on my computer a little later I can't copy and paste fast enough from my phone to get it all done in a minute. I'll try it out when I actually get up. Thanks I'll let you know
Still the time is not aligned :). 06:51 vs 06:52
Still false
The problem now is because the alarm is set for tomorrow and not for today 😊. If you look at the date.
The very second the alarm goes off home assistant changes the next scheduled alarm date for the next day, why? Those were one time alarms not recurring ones.
Make sure you set an alarm which is not a repeated alarm.
It was not a repeated alarm
I turned off all other alarms set on my phone and turned battery optimization on for hassalarm app and finally got in to read true.
My automations won't trigger even though my next alarm is being updated and my date & time is correct, what I think may be the issue is that my alarm times reports as 8:30 AM and my date & time sensor is reporting on a 24 hour clock without Am/Pm so they never truly match and the automation never fires. Is there a way I can fix this?