Budapest Public Transportation stop information

I wrote a custom_component sensor and custom state card for the Budapest public transportation:

https://github.com/amaximus/bkk_stop

You can set new sensors for each station/stop you want information for and will show you the vehicles departing from those stations in the next configurable minutes:

4 Likes

This is really great! I’ve been looking for a solution like this on my home assistant. I’m having some problems figuring out how to use it with the new lovelace UI. Can you help me with it? What are the first couple of steps I need to do?

As far as I know Lovelace doesn’t really support sensor attributes.
Or at least I couldn’t find a way to rewrite it for Lovelace. Once I’ll have some time, I’ll jump on it again and dig deeper.

I think you are right. Great work though!
I just installed it as a custom component and I’m now “one click” away in my frontend lovelace card from reading the bus departures.

Added Lovelace custom card, so the component can be used with Lovelace UI as well.

From now on both the custom component and the custom Lovelace card can be installed through HACS.

2 Likes

Great work, thank you!
One question though: is there any way to add a stop group (or group multiple stops to one sensor) as seen on futar.bkk.hu, e.g. Nyugati Pályaudvar?

Currently it doesn’t support handling a list of stops in one sensor.

Hey there,

Does this add-on still works?
Because I can’t find it in the add-on store.

Hey,

the integration is available through HACS.

regards, Atticus

ohh, I thought those are the same thing.
Sorry.

I learned some since my last comment, but I think I am still missing something :slight_smile:
So:

I inserted this tom my config.yaml:

sensor:
  - platform: bkk_stop
    name: "bkk99B"
    stopId: "BKK_F008269"
    minsAfter: 25
    ignoreNow: False
  - platform: bkk_stop
    name: "bkk99M"
    stopId: "BKK_F008270"
    minsAfter: 25
    ignoreNow: False

Then I created ui-lovelace.yaml and put these line in it:

views:
  - title: Home
cards:
  - type: custom:bkk-stop-card
    entity: sensor.bkk99B
    hide_in_mins: false
  - type: custom:bkk-stop-card
    entity: sensor.bkk99M
    hide_at_time: true

Then I added these at config–>lovelace–>resuirces:
/hacsfiles/bkk-stop-card/bkk-stop-card.js?hacstag=200081161863 (js module)
/www/community/bkk-stop-card/bkk-stop-card.js (stylesheet)
But nothing has changed. I can’t find new sensors, and I can’t find new items on the UI

After adding the sensors and the resource, did you restart HASS? If so, you can always check at Developer tools → States to see if your sensor appear. That would be the first step to troubleshoot.

Yes I did restarted HACS, also HA after that, but no there is no new sensor in developer tools. :frowning:

Please note that your stopIds should be BKK_008269 and BKK_008270 respectively (without F letter).

Thank you!
That helped a little, now I can the new sensors under developer tools -->states.
But I still missed the card. The solution was: overview → edit dashboard → 3 dot again → raw edit →
And here I added the cards info.
So I dont need to create ui-lovelace.yaml, only add /www/community/bkk-stop-card/bkk-stop-card.js as jsmodul to the resurces.
I recommend to update the github page.

I’m glad it’s sorted out. I’m using Lovelace in yaml mode, so I do not know how it suppose to use it in non-yaml mode.

I updated my answere immediatly, cause it wass 100% correct. But forgot to send it. Please reread it.

Thanks, I will update the Readme in the next couple of days.

Hi @amaximus,

turn to you once again for some hints on how to solve my issue.
The Integration didn’t start a while ago, thatswhy I removed it and reinstalled it (with HA restarts in between), then I read the post and removed the letter “F” from the stops as indicated in your previous post. Nevertheless, the sensor does not want to show.
Here is my config in sensors:

platform: bkk_stop
name: "bkkxu"
stopId: "BKK_02295"
minsAfter: 25
wheelchair: true
bikes: true
ignoreNow: False

Log is showing the following:

Logger: homeassistant.components.sensor
Source: custom_components/bkk_stop/sensor.py:138
Integration: Sensor (documentation, issues)
First occurred: 7:48:37 PM (2 occurrences)
Last logged: 7:48:37 PM

bkk_stop: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 651, in async_device_update
    await task
  File "/config/custom_components/bkk_stop/sensor.py", line 138, in async_update
    if len(self._bkkdata["data"]["entry"]["stopTimes"]) == 0:
KeyError: 'data'

Can you help me get back on track?