mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-08 18:06:54 +00:00
Added parameter time to search for a specific trip time. (#11235)
* Added parameter time to search for a specific trip time. * Apply suggestions from code review Co-Authored-By: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
374735f14d
commit
24e16f104a
@ -27,6 +27,10 @@ sensor:
|
|||||||
from: Gn
|
from: Gn
|
||||||
to: Mt
|
to: Mt
|
||||||
via: Zl
|
via: Zl
|
||||||
|
- name: 'AlmereBuiten-Duivendrecht-the-08h06m-train'
|
||||||
|
from: Almb
|
||||||
|
to: Dvd
|
||||||
|
time: '08:06:00'
|
||||||
```
|
```
|
||||||
|
|
||||||
{% configuration %}
|
{% configuration %}
|
||||||
@ -55,8 +59,27 @@ routes:
|
|||||||
description: A station the route needs to pass through.
|
description: A station the route needs to pass through.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
time:
|
||||||
|
description: Optional time to search for a specific train.
|
||||||
|
required: false
|
||||||
|
type: time
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
The data are coming from [Nederlandse Spoorwegen](https://www.ns.nl/).
|
### Station codes
|
||||||
|
|
||||||
Station codes must be used and can be looked up [here](https://nl.wikipedia.org/wiki/Lijst_van_spoorwegstations_in_Nederland).
|
Station codes must be used and can be looked up [here](https://nl.wikipedia.org/wiki/Lijst_van_spoorwegstations_in_Nederland).
|
||||||
|
|
||||||
|
### Searching a specific train vs. the next train
|
||||||
|
|
||||||
|
The default behavior (without configuration variable `time`) gives you the information about the *next* train that fits the criteria (`from`, `to`, `via`).
|
||||||
|
When using the configuration variable `time`, you can search for a specific train.
|
||||||
|
This is convenient when searching for the next train doesn't give you enough time to base an automation on.
|
||||||
|
E.g., when you normally take the 08h06m train and want to get information about this train, but there is another train
|
||||||
|
that's departing just minutes before your train, your time window to warn you on a delay might be too small.
|
||||||
|
|
||||||
|
Using `time` only updates the route sensor during a time window around the chosen time.
|
||||||
|
Outside this window, the route sensor's state is `unknown`.
|
||||||
|
The window is from half an hour before the chosen time until half an hour after the chosen time.
|
||||||
|
In this way, you can have multiple routes with specific trains before hitting the FUP threshold for using NS API.
|
||||||
|
|
||||||
|
The data are coming from [Nederlandse Spoorwegen](https://www.ns.nl/).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user