Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% set travel_sensor = "sensor.busser_fra_marsk_billesvej" %}
- {% set ts_format = "kl. %R" %}
- {% set max_listings = 5 %}
- {% set headers = ["", "Rute", "Afgang", "Planlagt afgang"] %}
- {% set icon = "mdi:bus" %}
- <table width="100%">
- <tr>
- {%- for header in headers %}
- <th>{{ header }}</th>
- {%- endfor %}
- </tr>
- <tr>
- <td><ha-icon icon="{{ icon }}"></ha-icon></td>
- <td>{{ state_attr(travel_sensor, "route") }}</td>
- <td><span>om {{ states(travel_sensor) }} minut{{ "ter" if states(travel_sensor) | int > 1 }}</span></td>
- <td><span>{{ strptime(state_attr(travel_sensor, "due_at"), "%d.%m.%y %H:%M").timestamp() | timestamp_custom(ts_format) }}{% if state_attr(travel_sensor, "real_time_at") is not none %}({{ strptime(state_attr(travel_sensor, "real_time_at"), "%d.%m.%y %H:%M").timestamp() | timestamp_custom("%R")}}){% endif %}</span></td>
- </tr>
- {%- for departure in state_attr(travel_sensor, "next_departures") %}
- {%- if loop.index < max_listings %}
- <tr>
- <td><ha-icon icon="{{ icon }}"></ha-icon></td>
- <td>{{ departure.route }}</td>
- <td><span>om {{ departure.due_in }} minut{{ "ter" if departure.due_in | int > 1 }}</span></td>
- <td><span>{{ strptime(departure.due_at, "%d.%m.%y %H:%M").timestamp() | timestamp_custom(ts_format) }}</span></td>
- </tr>
- {%- endif %}
- {%- endfor %}
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement