I’m trying to format the time that is send in a telegram message to a group.
I’ve searched and tried a few changes but nothing worked.
Currently it ends with: “back by 2023-04-13 16:30:00”
But I want it to end with: “back by 16:30”
Basically, formatted with only HH:MM
The code:
service: telegram_bot.send_message
data:
message: >-
🔌 - Load shedding currently on {{
state_attr('calendar.loadshedding_local_events', 'message')}}. Power is
expected to go off in 10 minutes and should be back by {{
state_attr('calendar.loadshedding_local_events', 'end_time')}}.
target: -************
enabled: true
data:
message: >-
🔌 - Load shedding currently on {{
state_attr('calendar.loadshedding_local_events', 'message')}}. Power is
expected to go off in 10 minutes and should be back by {{
state_attr('calendar.loadshedding_local_events', 'end_time').strftime('%H:%M') }}.
Power should be back by {% set dt =
state_attr('calendar.loadshedding_local_events', 'end_time') | as_datetime |
as_local %}{{ dt.strftime("%H:%M") }}.