Hi there, I am trying to have TTS service telling me when a last motion was detected.
I followed this suggestion Trigger TTS on motion and tell me how long since last (previous) motion was detected.
So I added this to the configuration.yaml
input_datetime:
last_motion:
name: last_motion
has_date: true
has_time: true
Entity “last_motion” shows me the correct information like 26 minutes ago with the date and year.
But when I ask the TTS service in my automation:
message: Last motion detected {{ state_attr(‘input_datetime.last_motion’, ‘timestamp’) }} ago
or
message: Last motion detected {{ relative_time(state_attr(‘input_datetime.last_motion’, ‘timestamp’)) }} ago
It tells me: 1678868604.01628 which I believe is the unix timestap.
I’m stuck here, don’t know how to translate this to xx minutes or hours ago
Read through similar posts here but still can’t figure it out.