Sensor Template - Date (Swiss Public Transport)

Hello :slight_smile:

I use the Swiss Public Transport component and this work fin
But now i will change the view of the stats

now its:

–> year-month-day and the time (english formate)
i will change it to “our” time (only time and minute)

old: next_on_departure: 2019-02-26T12:14:00+0100
new: next_on_departure: 12:14

how i can change it with a template sensor?

i have the sensor:

zug_nextabfahrt:
      icon_template: mdi:train
      value_template: '{{ as_timestamp(states.sensor.next_departure.attributes.next_on_departure)| timestamp_custom("%d/%m/%y", True) }}'

Thanks for your help!

1 Like

i found it:

with this works:

- platform: template
  sensors:

    zug_nextabfahrt:
      value_template: '{{ as_timestamp(states.sensor.next_departure.attributes.next_on_departure)| timestamp_custom("%H:%M", True) }}'

image

2 Likes