I’m converting the time from one of my sensors from 24H to 12H format.
Here is my template:
{{ as_timestamp(strptime(states('sensor.ring_front_door_last_activity'), "%H:%M")) | timestamp_custom('%I:%M %p') }}
This is working (sort of)… If the sensor time is “13:45” the template result displays “01:49 PM”… it adds 4 minutes to the actual time.
So, I tested the following:
{{ as_timestamp(strptime("16:50", "%H:%M")) | timestamp_custom('%I:%M %p') }}
and got:
04:54 PM
Again… phantom 4 minutes
Then I tested:
{{ as_timestamp(now()) | timestamp_custom('%I:%M %p') }}
And got the correct result.
So, am I using strptime()
incorrectly? Or is there another issue here?