Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
warrior25 committed Apr 6, 2024
1 parent 9f1dfc0 commit d8fe990
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,45 @@ Each station creates a sensor which contains data for departures from that stati

`realtime` - Indicates if the data is pulled from realtime vehicle monitoring or timetable data

## Frontend example
## Frontend examples

Simple frontend examples using [custom:html-template-card](https://github.com/PiotrMachowski/Home-Assistant-Lovelace-HTML-Jinja2-Template-card)

Simple frontend example using [custom:html-template-card](https://github.com/PiotrMachowski/Home-Assistant-Lovelace-HTML-Jinja2-Template-card)
![Example](https://github.com/warrior25/HA-Nysse/raw/main/docs/frontend_example.jpg)

```yaml
type: custom:html-template-card
title: Keskustori D
ignore_line_breaks: true
content: >
{% set departures = state_attr('sensor.keskustori_d_0015','departures')
%} {% for i in range(0, departures | count, 1) %}
<div style="display:grid; grid-template-columns: 2fr 1fr; font-size: 20px;
padding: 10px 0px 0px 0px"> <div>{{ departures[i].line }} - {{
departures[i].destination }}</div><div style="text-align: right">{% if
departures[i].realtime %}<ha-icon style="color:green; padding: 0px 10px 0px
0px" icon="mdi:signal-variant"></ha-icon>{% endif %} {% if
departures[i].time_to_station | int < 21 %} {{departures[i].time_to_station}}
min {% else %}{{departures[i].departure}}{% endif %}</div></div>
{% endfor %}
{% set departures = state_attr('sensor.keskustori_d_0015','departures')
%} {% for i in range(0, departures | count, 1) %}
<div style="display:grid; grid-template-columns: 2fr 1fr; font-size: 20px;
padding: 10px 0px 0px 0px"> <div>{{ departures[i].line }} - {{
departures[i].destination }}</div><div style="text-align: right">{% if
departures[i].realtime %}<ha-icon style="color:green; padding: 0px 10px 0px
0px" icon="mdi:signal-variant"></ha-icon>{% endif %} {% if
departures[i].time_to_station | int < 21 %} {{departures[i].time_to_station}}
min {% else %}{{departures[i].departure}}{% endif %}</div></div>
{% endfor %}
```
![Service Alerts](https://github.com/warrior25/HA-Nysse/raw/main/docs/service_alerts.jpg)
```yaml
type: custom:html-template-card
ignore_line_breaks: true
title: Service Alerts
content: >
{% set alerts = state_attr('sensor.nysse_service_alerts','alerts')
%} {% for i in range(0, alerts | count, 1) %}
<b>{{ alerts[i].start.strftime('%d.%m.%Y') }} - {{ alerts[i].end.strftime('%d.%m.%Y') }}</b><br>
{{ alerts[i].description }}<br><br>
{% endfor %}
```
## Advanced usage
Expand All @@ -63,5 +80,5 @@ content: >
## Known issues / limitations
- Nysse API sometimes functions incorrectly. Errors logged with `Nysse API error` can be resolved on their own over time.
- Line icons are resolved from a hardcoded list of tram lines. If new tram lines are built, the list needs to be updated in `const.py`.
- Nysse API sometimes functions incorrectly. Errors logged with `Nysse API error` can be resolved on their own over time.
- Line icons are resolved from a hardcoded list of tram lines. If new tram lines are built, the list needs to be updated in `const.py`.
Binary file added docs/service_alerts.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d8fe990

Please sign in to comment.