From 727b1bb2a470bb5544a6e73227086e771fa41ff0 Mon Sep 17 00:00:00 2001 From: endor <1937941+endor-force@users.noreply.github.com> Date: Fri, 28 Jun 2019 21:25:52 +0200 Subject: [PATCH] Add documentation for trafikverket_train (#9333) * Added documentation for trafikverket_train * Removed data for image that was not relevant * Added information about data that is retreived * Removed redirect, added category sensors * Clarified sensor values * :pencil2: Tweak * Added information about missed weekday parameter * Cleaned up examples * Clarified examples for non required field * Don't use !secret in example Co-Authored-By: Klaas Schoute * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * Fix typo Co-Authored-By: Franck Nijhof * :pencil2: Fixed time to be optional --- .../_components/trafikverket_train.markdown | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 source/_components/trafikverket_train.markdown diff --git a/source/_components/trafikverket_train.markdown b/source/_components/trafikverket_train.markdown new file mode 100644 index 00000000000..7237bcb4b86 --- /dev/null +++ b/source/_components/trafikverket_train.markdown @@ -0,0 +1,125 @@ +--- +layout: page +title: "Trafikverket Train" +description: "Instructions how to integrate Trafikverket Train within Home Assistant." +date: 2019-04-27 16:32 +sidebar: true +comments: false +sharing: true +footer: true +logo: trafikverket.png +ha_category: + - Transport + - Sensor +ha_release: 0.96 +ha_iot_class: Cloud Polling +--- + +Retrieve train departure information from [Trafikverket](https://www.trafikverket.se/). + +Use cases: + +- Retrieve the next departure and information connected to it for a specific train line. +- Retrieve information for specific departure time on a specific train line. +- Set up an alert or perform actions if your train is delayed or canceled. + +Data that is retrieved: + +- Next departure for the specific train line. +- Canceled status. +- The number of minutes delayed. +- Planned time if no delays occur. +- Estimated time of arrival if delays occur. +- Actual time - when it did arrive. +- Other information / additional texts. +- Deviations. + +## {% linkable_title Configuration %} + +To enable this sensor, use the following format in your `configuration.yaml`. + +```yaml +sensor: + - platform: trafikverket_train + api_key: TRAFIKVERKET_API + trains: + - name: "Morning train to Malmö" + from: "Stockholm Central" + to: "Malmö C" + time: "9:25" + + - name: "Next train to Uppsala" + from: "Stockholm Central" + to: "Uppsala C" +``` + +{% configuration %} +api_key: + description: Your personal API key from Trafikverket. + required: true + type: string +trains: + description: Specify details on the departures to monitor. + required: true + type: map + keys: + name: + description: The name of the departure, will be the sensor name. + required: true + type: string + from: + description: The station from where the train departs. + required: true + type: string + to: + description: The destination station. + required: true + type: string + time: + description: Departure time to monitor, if not entered it will retrieve the next departure. + required: false + type: string + weekday: + description: Specify which days in the week to monitor the specific departure. + required: false + type: list + default: "[mon, tue, wed, thu, fri, sat, sun]" +{% endconfiguration %} + +## {% linkable_title Obtaining API key %} + +Please click [here](https://api.trafikinfo.trafikverket.se/) and register to obtain the API key. + +## {% linkable_title Train station names %} + +Click [here](https://www.trafikverket.se/trafikinformation/tag/?ArrDep=departure&) to see an example of train station names. + +## {% linkable_title Examples %} + +```yaml +sensor: +- platform: trafikverket + api_key: !secret trafikverket_api_key + trains: + - name: "Train to work" + from: Sölvesborg + to: Kristianstad C + time: "07:28" + weekday: [mon, tue, wed, thu, fri] + + - name: "Train from work early" + from: Kristianstad C + to: Sölvesborg + time: "16:38" + + - name: "Train from work late" + from: Kristianstad C + to: Sölvesborg + time: "17:02" + weekday: [sat, sun] + + - name: "Next train to Uppsala" + from: "Stockholm Central" + to: "Uppsala C" + +```