Not the simplest newbie question but solving would empower openHAB by a very useful feature…
My idea is to integrate public transport departure times into openHAB to display (and voice output) the next departure times of interesting vehicles.
I found the OneBusAway Binding but dit not try it because it’s not usable for me.
In my case (VBB) we need to use the HAFAS REST API.
http://fahrinfo.vbb.de/restproxy/departureBoard?wadl
The request would be like http://fahrinfo.vbb.de/restproxy/departureBoard?format=json&id=900100003&dur=10&maxJourneys=10&accessId=SECRET
And we need to parse a list of JSON like this:
{
“JourneyDetailRef”: {
“ref”: “1|23533|25|86|24112017”
},
“Product”: {
“name”: "Bus TXL ",
“num”: “51076”,
“line”: “TXL”,
“catOut”: “Bus”,
“catIn”: “B”,
“catCode”: “3”,
“catOutS”: “B”,
“catOutL”: “Bus”,
“operatorCode”: “BVG”,
“operator”: “Berliner Verkehrsbetriebe”,
“admin”: “BVB—”
},
“name”: "Bus TXL ",
“type”: “S”,
“stop”: “S+U Alexanderplatz Bhf/Memhardstr. (Berlin)”,
“stopid”: “A=1@O=S+U Alexanderplatz Bhf/Memhardstr. (Berlin)@X=13410962@Y=52523099@U=86@L=900100031@”,
“stopExtId”: “900100031”,
“prognosisType”: “PROGNOSED”,
“time”: “18:15:00”,
“date”: “2017-11-24”,
“rtTime”: “18:44:00”,
“rtDate”: “2017-11-24”,
“direction”: “Flughafen Tegel Airport”,
“trainNumber”: “51076”,
“trainCategory”: “B”
}
Configuration would contain:
- apiKey
- station id’s to query
- update interval
- optional additional query param’s (e.g. maxJourneys)
- optional line numbers to filter
- optional direction names to filter
Filtering should be possible by black or white list.
Result of the new service would be a list of data to display or voice output.
In this case the result would be like “18:44:00 TXL Flughafen Tegel Airport
”.
How to achieve this feature?
Is it possible to use an existing binding (e.g. HTTP Binding) or do we need to implement a special binding?
Who is interested in using such feature?
Who is interested in helping to get such feature to work?
Possible future extensions:
- Make querying, displaying and voice output dependent on constraints. E.g. in the morning on weekdays and if somebody is at home.
- Add events on delays and disruptions. E.g. to use for some (light or bell) indicator.
- Add offset from schedule time to result to respect walk duration to get to the stop.