Not with your newest code, I first checked it in the dev tools. But I will test it as a sensor now.
Sidenote:
About the UTC+2 thing. Found out that this was my own mistake. I set is um as “Zeit UTC+2” in customize using friendly name. And at the time I set this up it was summertime so it was right. I changed to “Zeit” now and this ends my confusion on that.
it will the very first time you start as it’s not yet been initialised
Try to flicker your mailbox and then wait 5 min and restart and see what value it shows
Ok, but instead of manually flicking the lid, I will set the state in the dev tools. Because if I go out to flicker the lid to test it all the time now, neighbours will possible and legitimately think I’m done.
Edit: @lolouk44 Ok so unfortunately the state of the sensors stays unknown
ok, maybe the time to wait after start is too long
try and replace 0.1 with 0.01 in {% if (states("sensor.uptime") | float > 0.1)%}
enter this in your templates {{ states("sensor.uptime") }} and as soon as the value is higher than 0.01 force the state change
ok. Just tested on a test environment and it appears HA doesn’t like {% if (states("sensor.uptime") | float > 0.01)%}{{states.binary_sensor.zigbee_postkasten_contact.last_changed}}{% else %}{{states("sensor.zigbee_postkasten_contact_last_changed")}}{%endif%} as even when I fix the code (there was indeed an error in the template), HA sets the state to unknown at boot, even though I managed to set the correct last change value …
back to drawing board.
routine_postkasten:
sequence:
- service: media_player.alexa_tts
data_template:
entity_id: '{{ states.sensor.last_alexa.state }}'
message: >
{% if as_timestamp(states("input_text.zigbee_postkasten_contact_last_changed")) | default(0) | timestamp_custom("%H", true) | int >= 8 %}
Post war heute um {{as_timestamp(states("input_text.zigbee_postkasten_contact_last_changed")) | timestamp_custom("%H", true) | int }} Uhr {{as_timestamp(states("input_text.zigbee_postkasten_contact_last_changed")) | timestamp_custom("%M", true) | int }} da
{% else %}
Post war heute noch nicht da
Ok, I did a frist test and I thing it works. Have to do some more tests to make it sure, but looks good. Thanks again!
Besides the time/date is saved in the input_text as UTC+0 right? Because there it doesn’t show the right time. But when I call alexa she tells be UTC+1. Again this is the “true” setting … i know.
But is there a way to see the sensor state in utc+1 too? Maybe I’ll add that sensor to my front UI too (but only if it show the “right” time).
timestamps are in UTC by default in HA.
If you want you can change the data saved in the input_text to be [h] Uhr [m] so you can see it and use it directly with Alexa.
Think I’ve given you enough weapons to blast this one off now
Have fun
I’ll use the binary sensor for a conditional lovelace card, so show the above sensor only if the binary is true.
Because else it would show the time from the last day.
I added that input_boolean to be able to close that window. And added to turn on the input_boolean when the automation above gets triggered. like this: