From ee8d29faf9547502a1400babb38d7b9fecb0da20 Mon Sep 17 00:00:00 2001 From: Gerben ten Hove Date: Wed, 20 Nov 2019 15:04:10 +0100 Subject: [PATCH 1/2] Added parameter time to search for a specific trip time. --- .../nederlandse_spoorwegen.markdown | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/source/_integrations/nederlandse_spoorwegen.markdown b/source/_integrations/nederlandse_spoorwegen.markdown index 7534e3d697a0..2c76a128e8a5 100644 --- a/source/_integrations/nederlandse_spoorwegen.markdown +++ b/source/_integrations/nederlandse_spoorwegen.markdown @@ -28,6 +28,10 @@ sensor: from: Gn to: Mt via: Zl + - name: 'AlmereBuiten-Duivendrecht-the-08h06m-train' + from: Almb + to: Dvd + time: '08:06:00' ``` {% configuration %} @@ -60,8 +64,27 @@ routes: description: Optional other station you wish to visit in between. required: false type: string + time: + description: Optional time to search for a specific train. + required: false + type: time {% 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). + +### Searching a specific train vs. searching the next train + +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 till 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/). From 9cce8e92a0a7326c4b4f399588b3bad4d3151d42 Mon Sep 17 00:00:00 2001 From: Gerben ten Hove Date: Wed, 20 Nov 2019 20:30:21 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-Authored-By: Franck Nijhof --- .../_integrations/nederlandse_spoorwegen.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/_integrations/nederlandse_spoorwegen.markdown b/source/_integrations/nederlandse_spoorwegen.markdown index 2c76a128e8a5..4d2cc58c8d32 100644 --- a/source/_integrations/nederlandse_spoorwegen.markdown +++ b/source/_integrations/nederlandse_spoorwegen.markdown @@ -74,17 +74,17 @@ routes: 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. searching the next train +### Searching a specific train vs. the next train -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. +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 +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 till 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. +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/).