BVG Public Transport Sensor for Berlin


I’ve created a custom component to display realtime departure times for stations within the BVG route network (including S-Bahn data). The component displays the time in minutes until the next departure, including delays. You can define a walking distance, so only departures that are “reachable” by you in a timely manner are displayed.


The component along with detailed instructions can be downloaded from here:

# Example configuration.yaml entry

  - platform: bvgsensor
    name: U2 Rosa-Luxemburg-Platz
    stop_id: "900000100016"
    direction: "Pankow"
    walking_distance: 5

There is no custom component for the Berlin public transport up till now and I had same spare, time so I decided to create one.

Update: released version 0.3.5

  • you can now specify multiple directions, e.g. if your route is served by multiple lines with different directions

  • the component is now time zone aware (using the time zone from your HA config)

  • optimized logging

  • various bugfixes

Greetings from under the sea


Very good idea. Will try on weekend. If you want a feature request: use vbb-hafas instead of “just” bvg since this one will get the data of sbahn and bvg in berlin.

thanks, apreciate your feedback!
As for the feature request, the sbahn is included in the data-feed, so you may use it right away :wink:
Will update the description acordingly.

I would like to add the sensor to my ha (version 0.88). But it does not recognize the sensor?
I placed in /home/homeassistant/.homeassistant/config/custom_components/, changed permissions to homeassistant.homeassistant
My configuration.yaml:

  • platform: bvgsensor
    name: Abfahrt Richtung Hackescher Markt
    stop_id: “900000162001”
    direction: “S Hackescher Markt”
    walking_distance: 14
    file_path: “/tmp/”

Any idea? Thanks for you help!

It looks like the path for the custom_component is wrong. You would need to add the sensor folder…
the whole path would look something like this: ...../YOUR_CONFIG_PATH/custom_components/sensor/

let me know if that worked for you.

I adjust the path for the sensor file.
It is an ubuntu-server installation with the virtual environment -->

So my config path should be --> /home/homeassistant/.homeassistant

Now I got only warnings in the log-file:

2019-02-24 14:02:43 WARNING (SyncWorker_3) [custom_components.sensor.bvgsensor] No valid connection found. Please check your configuration.

2019-02-24 14:02:04 WARNING (SyncWorker_1) [homeassistant.loader] Integrations need to be in their own folder. Change sensor/ to bvgsensor/ This will stop working soon.

Now I added your example-config with rosa-luxemburg - but still not working.

I’ve just checked your configuration and your configured stop_id (900000162001) is “S Karlshorst” and from what I saw in the data feed there is no connection with an final destination to “S Hackescher Markt” …
If you want the departure times for the S3, please specify the final destination which would be “S Spandau”.

You can also specify multiple destinations if there is more than one connection you could use…

Hope that helps to get it working :slight_smile:

The paths for custom components have changed with the Version 0.88.0, and can be ignored at the moment.

Update: while testing your config, I’ve found an issue regarding encoding. I will take a look and provide an updated version soon.

hi @der_heinrich, i have just updated the code on github (v0.3.0). Please try the updated version and let me know if the problem still exists. I’ve tested it with the configuration below.

  - platform: bvgsensor
    name: Hackescher Markt
    stop_id: "900000162001"
    direction: "Spandau"
    walking_distance: 17
    file_path: "/tmp/"

hi @Kraken,
it works now! thanks a lot!

1 Like

Updated to version 0.3.5:
you can now specify multiple directions, e.g. if your route is served by multiple lines with different directions

- platform: bvgsensor
    stop_id: your stop id
      - "destination 1"
      - "destination 2"

Great component! When are you planning to migrate the component to HA > 0.89 because I really like to integrate it within my current setup.

I hope to find some time today :slight_smile:

Fortunately it is pretty simple to get it up and running with 0.89 and beyond. Simply create a folder named bvgsensor within your custom_component folder and rename the file to


1 Like

I’am getting following error… is the Integration still working?

Platform error sensor.bvgsensor - Integration ‘bvgsensor’ not found.

I used the instructions from github but with no luck.

Had the same problem. easy to fix.
first restart the server without the sensor, but with the component, than after restart add the sensor => success

You mean copy the custom component to the folder restart and than add the sensor?
Or should I add something additional to the configuration.yaml to load the custom component?

Im running into a similar problem: I have the in the correct folder, “config\custom_components\bvgsensor\”. Rights are set correctly as well. After restarting I add

  - platform: fritzbox_netmonitor
  - platform: bvgsensor
    stop_id: "900000162001"
    direction: "Spandau"

as the minimal configuration in my configuration.yaml. And then I run into “Platform error sensor.bvgsensor - Integration ‘bvgsensor’ not found.

How can I tell the system that there is a new integration available? Do I need to add something under “discovery:” in my configuration.yaml?

Any pointers are very much appreciated!

I tried investigating the issue but sadly didn’t figure it out.
Some of the things I tried:

  • create a manifest.json and files as those seem to be needed by HA
  • put the code into to see if that changes anything
  • a few other small changes (like I noticed the add_entities was referencing Bvgsensor with a capital B and try small caps)

I didn’t make a github fork but here are the files I toyed around with… maybe someone else can see the light :smiley: