Trenitalia ViaggiaTreno

The Trenitalia ViaggiaTreno integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] will give you information about configured train ids and stations using the public ViaggiaTreno API.

To activate the integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more], you need at least two parameters: the train_id and the station_id.

The first is available just looking at the ViaggiaTreno timetable, the latter can be obtained using the dedicated API endpoint: http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/autocompletaStazione/<Station name> (e.g., http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/autocompletaStazione/ROMA will list all station names (with ids) that starts with ROMA).

Note

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.

Then add the data to your configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] file. 在更改了configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] 文件后,重启 Home Assistant 以应用更改。 该集成现在显示在集成页面的 设置 > 设备与服务 下。其实体在集成卡片上以及实体标签上列出。

# Example configuration.yaml entry
sensor:
  - platform: viaggiatreno
    train_id: 12279
    station_id: S08409

Configuration Variables

train_id integer Required

The ID of the train.

station_id integer Required

The ID of the starting station.

train_name string (Optional)

The name of the sensor. Defaults to ‘Train from ’.

Note

In a future implementation, the station name could be used to automatically search best-matching station id, without the need to specify it.

The public timetables are coming from ViaggiaTreno.

Note

Instructions (in Italian) for the API are available at: https://github.com/bluviolin/TrainMonitor/wiki/API-del-sistema-Viaggiatreno