i am sending a notification to my phone to let me know when my garage door opens. I got that, but how do I add the timestamp above when it opened?
service: notify.mobile_app_sm_n986u
data:
message: Garage Door Opened at {{states.cover.garage_door.last_changed}}
so the above sort of works, it gives me the following:
Garage Door Opened at 2022-10-04 21:05:24.11260
First off that is UTC I think, I am in CST.
Would love to just get a simple 10-4 4:24pm
Figured it out
service: notify.mobile_app_sm_n986u
data:
message: >-
Garage Door Opened at {{as_timestamp (states.cover.garage_door.last_changed)
| timestamp_custom("%-I:%M %p (%m-%d-%y)")}}
1 Like
You can format the value of last_changed directly using its strftime method.
service: notify.mobile_app_sm_n986u
data:
message: >-
Garage Door Opened at {{ states.cover.garage_door.last_changed.strftime("%-I:%M %p (%m-%d-%y)") }}
1 Like
