RMV - When do I need to go?
Introduction
See the time remaining until you have to leave to catch the next ride. I often have to catch a train or bus and I want to know when I have to leave to catch it.
Prerequisites
- Home Assistant instance
- (optional) standalone sensors.yaml
Configuration
Needed Information
Name | Description | Where to find |
---|---|---|
Station ID | The ID of the station you want to get the next departure from. | RMV (Infrastrukturdaten) - Search Document for your station and take the ID |
Time Offset | The time offset in minutes you need to get to the station. | GoogleMaps/RMVGo or just from experience |
Direction | The direction you want to go. | RMV (Infrastrukturdaten) - Search Document for your destination station and take the NAME |
Station Name | The name of the station you want to get the next departure from. Choose what you want. Recommend name of station |
Sensor
YAML | |
---|---|
Restart
After adding the sensor to your configuration, restart Home Assistant. You should now have a sensor for all the departures from the station and a sensor for the next departures from the station you can reach.
Helper
To get the sensor for the time you need to leave, you have to create a template sensor. This sensor will calculate the time you have to leave to catch the next ride. Go to Settings -> Devices & Services -> Helpers -> Add Helper -> Template -> Create template for a sensor
Give it a name and use the following template:
{{ (int(states('sensor.[Station Name without all]'))) - 7 }}
Set the unit to minutes and save it.
Lovelace
I use the following Lovelace card to display the time I have to leave to catch the next ride.
YAML | |
---|---|
Time Table Card
There is also a custom card in HACS to display the next departures from a station. It is called RMV Card
and can be found in HACS (Frontend).
After installing it you can use the following code to display the next departures from a station: