Regularj
(Regularj)
1
Is it possible to change the output of “value_template”?
I have the google calendar-sensor integrated:
- platform: template
sensors:
privat:
friendly_name: 'Privat'
value_template: '{{ states.calendar.ABCXYZ.attributes.message}} am {{states.calendar.ABCXYZ.attributes.start_time}}'
and get the following output:
“Appointment-title” am “2017-04-23 19:00:00”
I’d like to change the date-format to:
“appointment-title” am “23.04.2017 19:00”
mason
(Mason)
2
did you ever find a soltuion? I’m struggeling with the same issue…
galoz11
(Galoz11)
3
maybe:
{{ states.calendar.ABCXYZ.attributes.start_time.strftime("%H:%M") }}
mason
(Mason)
4
this didn’t work: ‘str object’ has no attribute ‘strftime’
but this did and is the most flexible I guess in case of formating:
{{ as_timestamp(states.calendar.ABCXYZ.attributes.start_time) | timestamp_custom ("%d.%m.%y", True) }}
1 Like
galoz11
(Galoz11)
5
Regularj
(Regularj)
6
Hey,
I’m very sorry for not posting the solution:
The following line did solve my problem:
value_template: '{{ states.calendar.ABCXYZ.attributes.message}} am {{ as_timestamp(states.calendar.ABCXYZ.attributes.start_time) | timestamp_custom("%d.%m.%Y, um %H:%M",True) }} Uhr.'
Cheers
2 Likes