Add support for Norwegian Public Transport (Ruter)


That is expected.
Unless you supply a value for numer_of_departures it defaults to the first departure.

try this instead:

  - platform: ruter
    stopid: 3010641
    destination: 'Nydalen T'
    numer_of_departures: 2


This works well for me now, I just notice that sometimes it changes the order of the departures. So I have a card displaying the next two busses. One line saying the next bus departs xx:xx and another line saying the next after that departs xx:xx. Sometimes the they are in the right order and sometimes not. Not a big deal, but could be a pita if you have many departures in your setup.


I have seen that as well, not sure why that is happening, this is fetching the data in the order that ruter publishes it, but will look into ordering the dataset after extraction


I get the following error when trying to add the component:

Unable to install package pyruter==0.1.0: Could not find a version that satisfies the          requirement pyruter==0.1.0 (from versions: 0.1.1, 1.0.1, 1.0.2, 1.1.0, 1.1.1)
No matching distribution found for pyruter==0.1.0
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have tried to installed it manually but the same error is showing.

Running Hass on Ubuntu 18.xx


Just looked at the new official component. Not clear to me how to best add several departures from the same stop. numer_of_departures seems to be replaced by offset ? Just guessing you create a sensor in configuration.yaml for each departure you need?


that is correct


Then my humble suggestion would be to add that as an example in the wiki. And thank you for making the component an official part of Home Assistant !


I am not able to get the Ruter sensor to work with destination.

Copying the destinasjon string from, “Til”-field, the sensor return no values. Without this I am getting a time-value, but then I get all the departures times for all the different buses departing from the bus-station.


Do you use the end station as destination? Sometimes the destination is not exactly the name of the end station(#20 where the destination is Skøyen but the end stop is called Skøyen Stasjon). This works fairly well for me, like this:

  - platform: ruter
    stopid: 3010641
    destination: 'Nydalen T'

But this is for the old version, have not used the official component one yet.


I use the official component, and the string that appears in the “Til”-field. This field does not accept other strings that the web side gives as an option. Still not getting this to work.


You need to use the final destination of the route you are tracking @Tomahawk not where you are getting off.


If you mean the docs, please feel free to open an PR for it :slight_smile:


Nope. Still not getting this to work.

Here is my sensor, wanting to get departure time for Bus 34 at Simensbråten. The bus line ends at Tåsen senter (end stop, -which is at Christophers vei).

This does not work:
destination: ‘Christophers vei’
destination: ‘Tåsen senter (Oslo)’
destination: ‘Tåsen senter’

  - platform: ruter
    name: Ruter Buss 34 Sim Jer
    stop_id: 3010760
    destination: '???'
    offset: 2


It seams that ruter are not consistent in their API responses try with Tåsen


It works with “Tåsen”. Apricate the help!
So this is somewhat a guessing game then.

My next game is on ; )

  - platform: ruter
    name: Ruter Buss 34 Jer Sim
    stop_id: 3010012
    destination: 'Simensbråten'
    offset: 2


If it’s still for line 34 the stop in the other end are named "Ekeberg hageby".


That works also. Thanks!

I am not impressed by Ruters API.

Just an idea, would the functionality described in this post, be something to enhance the Ruter sensor with, time interval input parameter for when the sensor is active?


I think that is a feature that if implemented should cover all of HA, and not implemented pr platform.

Since the API for ruter is bad… I added a query feature for pyruter now.
if you have if installed you can run pyruter destinations --stop 3010012 that will generate:

        "destination": "Helsfyr",
        "line": "37"
        "destination": "Nydalen T",
        "line": "37"
        "destination": "Ekeberg hageby",
        "line": "34"
        "destination": "Tåsen",
        "line": "34"
        "destination": "Mortensrud T",
        "line": "74"



Any possibilities to format the time to hours and minutes, and skip the seconds?¨


Currently no, not without a template sensor.
But after Lovelace becomes default, I will change this to use ISO8601 for the state (time)