Dutch Public Transport sensor (ovapi.nl)

I will also suguest to update the documentation:

To find the TimingPointCode (TimingPointCode)

  1. First we need to get an overview of all the lines where we can search in, go to: refer to the JSON response of: v0.ovapi.nl/line/

You see here all the bus lines. Search you line with the right destination like (I was searching for a Bus from Beijum):

{"LineWheelchairAccessible":"ACCESSIBLE","TransportType":"BUS","DestinationName50":"Groningen Beijum via HS - Grote Markt","DataOwnerCode":"QBUZZ","DestinationCode":"836","LinePublicNumber":"4","LinePlanningNumber":"g554","LineName":"Beijum - Roden","LineDirection":2},"ARR_28147_2":{"LineWheelchairAccessible":"NOTACCESSIBLE","TransportType":"BUS","DestinationName50":"Triemen Langelaan","DataOwnerCode":"ARR","DestinationCode":"2726","LinePublicNumber":"7591","LinePlanningNumber":"28147","LineName":"Triemen - Buitenpost, Station","LineDirection":2},"QBUZZ_g554_1":{"LineWheelchairAccessible":"ACCESSIBLE","TransportType":"BUS","DestinationName50":"Roden","DataOwnerCode":"QBUZZ","DestinationCode":"478","LinePublicNumber":"4","LinePlanningNumber":"g554","LineName":"Beijum - Roden","LineDirection":1}

We are searching for the right line number. In the example above the line number is: QBUZZ_g554_1

  1. Now we can find the right TimingPointCode, first we will request all the bus stops for the line number, go to: refer to the JSON response of: v0.ovapi.nl/line/QBUZZ_g554_1

You will see here all the bus stops from that line like (I was searching to the streetname Edzemaheerd):

{"Longitude":6.5902967,"Latitude":53.25269,"TimingPointTown":"Groningen","TimingPointName":"Groningen, Edzemaheerd","TimingPointCode":"10155690","StopAreaCode":null,"TimingPointWheelChairAccessible":"ACCESSIBLE","TimingPointVisualAccessible":"ACCESSIBLE","IsTimingStop":false,"UserStopOrderNumber":5}

Here you will find the TimingPointCode, in the example above it is 10155690.

2 Likes

Created pull request with some bug fixes and support for TimingPointCode.

1 Like

Pippyn has created a update and I’ve approved the Pull request. You can pickup the new version in the repro.

Please let us know if you face any issues.

I can confirm that it is working, i will look if i can submit a pull request for updating the documentation. Maybe this plugin can be a new component for the default components in home assistant ??

Awesome!
I’m really interested in OV Data. Like a train sensor and OV Fiets data.
Since i’m a total noob in python I made a Node-Red Flow for OV Fiets data if someone is interested. It uses http://fiets.openov.nl/locaties.json

I also create something like this with the 9292 api, the URL is hard to find but it looks like this:

https://api.9292.nl/0.1/journeys?before=0&sequence=1&byFerry={0}&bySubway={1}&byBus={2}&byTram={3}&byTrain={4}&lang=nl-NL&from={5}&dateTime={6}&searchType={7}&interchangeTime={8}&after={9}&to={10}'.format(ferry,subway,bus,tram,train,stopFrom,dateTime,searchType,interchangeTime,resultCount,stopTo)

The by variables are ‘‘true’’ or ‘‘false’’, in string form.
stopFrom = name of the stop, can be found in the 9292 url when generated on the site
dateTime = time and date in this form yyyy-mm-ddThhmm
searchType = departure or arrival
interchangeTime = “standard”
resultCount = number of results, starts from 0
stopTo = name of the stop, can be found in the 9292 url when generated on the site

The reason I used 9292 is that the openov api doesn’t have my stop in the database while 9292 does. maybe someone will find this usefull.

1 Like

Glad to see it’s working!

Paul and I were talking about this yesterday. But we first need to finish the sensor. Like yesterday I added a new feature, namely a line filter. And I’m sure some people will find a bug we missed, that we need to fix first.

Very interested in this as I would like to replace my MagicMirror with Lovelace if I possibly can, this would get me one step closer.
Have you seen this MM module that does similar? Not sure if it can maybe be some inspiration.

1 Like

Hi,

Maybe there is a option to also use 9292ov but then we should rename the sensor and create options for the different dataproviders. This does require a redesign of the sensor to keep it clean and understandable.

You can add a issue in the GitHub repro for this request though, in that case the feature request won’t be forgotten :slight_smile:

1 Like

Nice, thanks for the info. I’ve reserved some time next weekend to update the docs and I’ll have a look at this repro for possible features or other interesting bits.

It is not realy a request, but more an extra possibility for people that experiance the same problem as I had.

i have the exact same issue could you share youre sensor?

You see here all the bus lines. Search you line with the right destination like (I was searching for a Bus from Beijum):

change that to: Search for LinePublicNumber":“311” where the line number is the actual bus or tram nr.

Much easier to search this way, cause lots of places has big bus stations like zuidplein.

@IIIdefconIII

TimingPointCode is supported

yes i read that but how to put it correctly in the sensor, i have this code where only the tram works
The route_code of the tram is the actual TimePointCode

###### SENSORS -----------------------------
sensor:
  - platform: ovapi
    name: Bus_140
    stop_code: 'null'
    route_code: '31006183'

  - platform: ovapi
    name: Tram_23
    stop_code: '87'
    route_code: '31000227'

  - platform: ovapi
    name: Bus_183
    stop_code: 'null'
    route_code: '31000227'

remove the line, don’t input null;

  - platform: ovapi
    name: Bus_140
    route_code: '31006183'

i tried that but that doesnt give me the sensor in the states. maybe i need to give it a few minutes to pick up the data.

Did you restart HA?

yes i restarted it multiple times xD

Sorry my bad, it should be;

  - platform: ovapi
    name: Bus_140
    timing_point_code: <<YOUR TIMING POINT CODE>>