You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Instructions on how to integrate Italian Railroads data (from ViaggiaTreno API) into Home Assistant."
5
+
date: 2017-11-07 14:35
6
+
sidebar: true
7
+
comments: false
8
+
sharing: true
9
+
footer: true
10
+
logo: train.png
11
+
ha_category: Transport
12
+
ha_iot_class: "Cloud Polling"
13
+
ha_release: 0.58
14
+
---
15
+
16
+
The `viaggiatreno` sensor will give you information about configured train ids and stations using the public [ViaggiaTreno](http://viaggiatreno.it) API.
17
+
18
+
To activate the sensor you need at least two parameters: the `train_id` and the `station_id`.
19
+
20
+
The first is available just looking at the [ViaggiaTreno](http://viaggiatreno.it/) timetable, the latter can be obtained using the dedicated API endpoint:
(e.g., `http://www.viaggiatreno.it/viaggiatrenonew/resteasy/viaggiatreno/autocompletaStazione/ROMA` will list all station names (with ids) that starts with *ROMA*).
23
+
24
+
<pclass='note'>
25
+
Note that the `station_id` is referred to the train's **departing station**. If a train number does not match with the station id, no data will be returned to the sensor.
26
+
</p>
27
+
28
+
Then add the data to your `configuration.yaml` file as shown in the example:
29
+
30
+
```yaml
31
+
# Example configuration.yaml entry
32
+
sensor:
33
+
- platform: viaggiatreno
34
+
train_id: 12279
35
+
station_id: S08409
36
+
```
37
+
38
+
{% configuration %}
39
+
train_id:
40
+
description: The ID of the train.
41
+
required: true
42
+
type: int
43
+
station_id:
44
+
description: The ID of the starting station.
45
+
required: true
46
+
type: int
47
+
train_name:
48
+
description: The name of the sensor. Defaults to 'Train <train id> from <station id>'.
49
+
required: false
50
+
type: string
51
+
{% endconfiguration %}
52
+
53
+
<p class='note'>
54
+
In a future implementation, the station name could be used to automatically search best-matching station id, without the need to specify it.
55
+
</p>
56
+
57
+
The public timetables are coming from [ViaggiaTreno](http://viaggiatreno.it).
58
+
59
+
<p class='note'>
60
+
Instructions (in Italian) for the API are available at:
0 commit comments