I changed it a bit. Instead of from and to tou should use station_from and station_to. You might also need to add station_live and aet it to some station. Still working on it.
Alright little update: I have both a Liveboard sensor and a Travel Time sensor working for NMBS using the iRail API. Will try to PR them to HA core this week:
Why does it always shows “In 4 minutes…” and not the actual expected departure time as shown in sensor attributes which is more usefull?
Can you also cut the Vehicle ID to show only the train nr ie. IC3034 instead of the complete BE.NMNS name.
This looks like what I wanted to use in home assistant.
Thank you for all the work you put into this.
That suggestion for Vehicle ID is indeed good. I’ll add it now.
If you mean the purple previous state bar, that’s just old state and you can ignore that.
No worries, been wanting this for a long time myself and seems it was easier to do than I thought.
Hi Thibault, Velo would be a nice addition. My python knowledge is limited as well, but still got me to create the basic pypi libraries for iRail. Maybe we could combine our efforts?
(@cereal2nd could tune in as well? He was working on adding the sensors as an integration so users could modify this using the UI instead of yaml.)
Yes Velo would be nice, already using your libraries for my De Lijn & NMBS sensors. I’ve based a pyvelo project on Github off of yours, could add you as a contributor if you want.
PR is opened here: https://github.com/home-assistant/home-assistant/pull/18610
Do mind this is the first version, will add more functionality once this is merged.
For everyone still following this thread: PR was ongoing to Home Assistant core but I’m having mixed feelings every time I try to contribute to this project. I’m probably not going through with adding this component to HA core, but will instead release it as a custom component. Will report back if I managed to put it up.
Ok, hope you can make it as a custom component. I had a feeling the PR wasn’t going as planned.
Merged after a final push! Will be in 0.85
I was looking for the component on your github, it’s not there anymore and still not merged ?
Any alternative ?
I’ve actually finished creating a De Lijn sensor + Lovelace card for showing real time passings of a stop of De Lijn.
I haven’t pushed it yet to the home-assistant repository as I thought it could use some testing. It’s my first creation in Python, so never a bad idea to have some people check if it works properly.
You can find the custom sensor code and details to install it here: https://github.com/bollewolle/delijn-sensor
You can find the custom Lovelace card code and details to install it here: https://github.com/bollewolle/delijn-card
Small note: the custom card has some possibilities to adapt to your needs. What I personally think it pretty nice is that it actually takes over the actual colours of the line as you see them on the site, the busses/trams/…, the signs on the info boards, etc …
I’ve actually also build a specific package and published it to PyPi in order to fit the design best practices of Home Assistant. You can find that code over here: https://github.com/bollewolle/pydelijn
Hope it all works. For me so far it’s been running about a week without any major issues. The main thing you’ll need for it to work is to create a developer account at data.delijn.be and get a subscription key from your account. It’s the only way to actually use the api’s it seems (they’re still in beta actually).
Let me know your feedback.
Has been published as part of HA core in 0.85.0
This seems supernice! I’ll check it out later this week.
The optional name is not working - I have set 2 sensors for Home and Work and it shows as sensor.nmbs for home and sensor.nmbs_2 for work. Tried with and without quotes - no difference
- platform: nmbs name: "Work" - platform: nmbs name: Home
Yeah I forgot that along the way I guess, planning to release that as a patch fix today or this weekend.
For anyone interested tracking progress on this component (and all my other components): I have a Notion board where you can find all the info.
Seems to work perfectly fine here:
sensor: - platform: nmbs name: 'Trein Werk' station_from: "Brugge" station_to: "Gent Dampoort" - platform: nmbs station_from: "Gent Dampoort" station_to: "Brugge"