-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[deutschebahn] Initial contribution: New binding for DeutscheBahn Fahrplan #11384
Conversation
Jenkins build has passed. Jar for testing is now available here: |
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
…hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
b97ca2a
to
77fa470
Compare
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
77fa470
to
9f15d5c
Compare
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
# DeutscheBahn Binding | ||
|
||
The DeutscheBahn Binding provides the latest timetable information for all trains that arrive or depart at a specific train station, including live information for delays and changes in timetable. | ||
The informations are requested from the timetable api of DeutscheBahn developer portal, so you'll need a (free) developer account to use this binding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The informations are requested from the timetable api of DeutscheBahn developer portal, so you'll need a (free) developer account to use this binding. | |
The information are requested from the timetable api of DeutscheBahn developer portal, so you'll need a (free) developer account to use this binding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
5. Choose your previously created application and hit "Abonnieren" | ||
6. In confirmation-dialog choose "Wechsel zu meine Abonnements" | ||
7. Create an access key for the production environment by hitting "Schlüssel Erstellen" | ||
8. Copy the "Zugangstoken". This is required to access the api from openhab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8. Copy the "Zugangstoken". This is required to access the api from openhab. | |
8. Copy the "Zugangstoken". This is required to access the api from openHAB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
### Determine the EVA-No of your station | ||
|
||
For the selection of the station within openhab you need the eva nr. of the station. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the selection of the station within openhab you need the eva nr. of the station. | |
For the selection of the station within openHAB you need the eva no. of the station. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
### Configure timetable bridge | ||
|
||
With access key for developer portal and eva nr. of your station you'r ready to configure a timetable (bridge) for this station. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With access key for developer portal and eva nr. of your station you'r ready to configure a timetable (bridge) for this station. | |
With access key for developer portal and eva no. of your station you're ready to configure a timetable (bridge) for this station. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
the next train that arrives / departs at the given station. Position 2 will be the second one, and so on. If you want to | ||
show the next 4 trains for a station, create 4 things with positions 1 to 4. | ||
|
||
**Attention:** The timetable api only provides data for the next 18 hours. If the timetable contains less trains entries than you've created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Attention:** The timetable api only provides data for the next 18 hours. If the timetable contains less trains entries than you've created | |
**Attention:** The timetable api only provides data for the next 18 hours. If the timetable contains less train entries than you've created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
and if you have selected only arrivals the arrival channel values will always be defined. | ||
Channels will have an 'NULL' channel value, when corresponding attribute is not set. | ||
|
||
Basically most informations are available as planned and changed value. This allows to easy display changed values (for example the delay or changed platform). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically most informations are available as planned and changed value. This allows to easy display changed values (for example the delay or changed platform). | |
Basically most information are available as planned and changed value. This allows to easy display changed values (for example the delay or changed platform). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| changed-status | String | Provides the changed status (planned, added, cancelled) of a train. | | ||
| cancellation-time | DateTime | Time when the cancellation of this stop was created. | | ||
| line | String | The line of the train. | | ||
| messages | String | Messages for this train. Contains all translated codes from the messages of the selected train stop. Multiple messages will be separated with an single dash. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| messages | String | Messages for this train. Contains all translated codes from the messages of the selected train stop. Multiple messages will be separated with an single dash. | | |
| messages | String | Messages for this train. Contains all translated codes from the messages of the selected train stop. Multiple messages will be separated with a single dash. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| cancellation-time | DateTime | Time when the cancellation of this stop was created. | | ||
| line | String | The line of the train. | | ||
| messages | String | Messages for this train. Contains all translated codes from the messages of the selected train stop. Multiple messages will be separated with an single dash. | | ||
| hidden | Switch | On if the event should not be shown on WBT because travellers are not supposed to enter or exit the train at this stop. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WBT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The descriptions are taken from the original api documentation, so even i don't know what WBT means. I think it might be "Wall Board Timetable" or something else. So due this has no relevance here, i removed it.
| line | String | The line of the train. | | ||
| messages | String | Messages for this train. Contains all translated codes from the messages of the selected train stop. Multiple messages will be separated with an single dash. | | ||
| hidden | Switch | On if the event should not be shown on WBT because travellers are not supposed to enter or exit the train at this stop. | | ||
| wings | String | A sequence of trip id separated by the pipe symbols. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| wings | String | A sequence of trip id separated by the pipe symbols. | | |
| wings | String | A sequence of trip id separated by pipe symbols. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
Using the widget for displaying the next four departures: | ||
|
||
![Departures Hannover HBF](doc/images/Abfahrten_HannoverHBF.png "openHAB page with four widgets displaying the next departures at Hannover HBF") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think images need to reside directly under doc/
to be rendered correctly on the OH webpage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
24747d4
to
7d8d6da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 3 compiler warnings left:
[WARNING] C:\Users\Fabian Wolter\Documents\GitHub\openhab-addons\bundles\org.openhab.binding.deutschebahn\src\main\java\org\openhab\binding\deutschebahn\internal\AbstractDtoAttributeSelector.java:[80,34] Null type mismatch (type annotations): required 'VALUE_TYPE' but this expression has type '@Nullable VALUE_TYPE', where 'VALUE_TYPE' is a free type variable
[WARNING] C:\Users\Fabian Wolter\Documents\GitHub\openhab-addons\bundles\org.openhab.binding.deutschebahn\src\main\java\org\openhab\binding\deutschebahn\internal\DeutscheBahnTrainHandler.java:[20,8] The import org.openhab.binding.deutschebahn.internal.timetable.dto.Event is never used
[WARNING] C:\Users\Fabian Wolter\Documents\GitHub\openhab-addons\bundles\org.openhab.binding.deutschebahn\src\main\java\org\openhab\binding\deutschebahn\internal\DeutscheBahnTrainHandler.java:[22,8] The import org.openhab.binding.deutschebahn.internal.timetable.dto.TripLabel is never used
I'm a little bit confued on that, due i've had some more unused imports, but they've been contained within the analysis report printed out at the very end of the build log and corrected all of them. No these compiler warnings aren't displayed either within eclipse nor in the report - hard to find... I'll fix them, but i would be great if all warnings would appear in build report... |
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
60597fd
to
59910db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now, you could add your binding's logo to the openHAB website. See https://next.openhab.org/docs/developer/bindings/#add-your-binding-s-logo-to-the-openhab-website |
…rplan (openhab#11384) * Created binding for DeutscheBahn Timetable API. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Disabled schema validation and used original schema. Added tests for hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added information about UNDEF and NULL channel values. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added sample widget and screenshot Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Filtering duplicate messages Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Fixed some typos. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Updated to jUnit5 Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied review remarks in Readme Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied some review remarks Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * 0000: Fixed compile warnings Signed-off-by: Sönke Küper <soenkekueper@gmx.de> Co-authored-by: Sönke Küper <soenkekueper@gmx.de> Signed-off-by: Nick Waterton <n.waterton@outlook.com>
…rplan (openhab#11384) * Created binding for DeutscheBahn Timetable API. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Disabled schema validation and used original schema. Added tests for hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added information about UNDEF and NULL channel values. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added sample widget and screenshot Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Filtering duplicate messages Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Fixed some typos. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Updated to jUnit5 Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied review remarks in Readme Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied some review remarks Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * 0000: Fixed compile warnings Signed-off-by: Sönke Küper <soenkekueper@gmx.de> Co-authored-by: Sönke Küper <soenkekueper@gmx.de> Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
…rplan (openhab#11384) * Created binding for DeutscheBahn Timetable API. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Disabled schema validation and used original schema. Added tests for hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added information about UNDEF and NULL channel values. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added sample widget and screenshot Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Filtering duplicate messages Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Fixed some typos. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Updated to jUnit5 Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied review remarks in Readme Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied some review remarks Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * 0000: Fixed compile warnings Signed-off-by: Sönke Küper <soenkekueper@gmx.de> Co-authored-by: Sönke Küper <soenkekueper@gmx.de>
…rplan (openhab#11384) * Created binding for DeutscheBahn Timetable API. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Disabled schema validation and used original schema. Added tests for hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added information about UNDEF and NULL channel values. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added sample widget and screenshot Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Filtering duplicate messages Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Fixed some typos. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Updated to jUnit5 Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied review remarks in Readme Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied some review remarks Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * 0000: Fixed compile warnings Signed-off-by: Sönke Küper <soenkekueper@gmx.de> Co-authored-by: Sönke Küper <soenkekueper@gmx.de>
…rplan (openhab#11384) * Created binding for DeutscheBahn Timetable API. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Disabled schema validation and used original schema. Added tests for hannover hbf which has non schema conforming responses. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added information about UNDEF and NULL channel values. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Added sample widget and screenshot Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Filtering duplicate messages Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Fixed some typos. Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Updated to jUnit5 Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied review remarks in Readme Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * Applied some review remarks Signed-off-by: Sönke Küper <soenkekueper@gmx.de> * 0000: Fixed compile warnings Signed-off-by: Sönke Küper <soenkekueper@gmx.de> Co-authored-by: Sönke Küper <soenkekueper@gmx.de>
This binding uses the Timetable API of DeutscheBahn to query the DB timetable for an given railway station in germany. So openhab can display the next trains that are arriving / departing at this station, including live informations about delays or changes.
Therefore the binding provides an bridge type, that connects to the API and provides data, and an train thing that represents an train within this timetable.
The result may look like this:
Forum topic can be found here:
https://community.openhab.org/t/binding-for-deutschebahn-timetable/127534
Closes #11376