Home Assistant component that retrieves current water levels for German water bodies from the PEGELONLINE web service.
PEGELONLINE provides a REST API that is free to use.
There are two ways to set up this integration:
If you already have HACS enabled in your Home Assistant, go to HACS -> Integrations
, and in the menu in the upper right choose "Custom repositories".
In the dialog, add the custom repository URL:
https://github.com/mattsches/homeassistant-pegelonline
and install the "PEGELONLINE" integration. You can keep the integration updated using HACS.
Copy the folder custom_components/pegelonline
to <ha_config_dir>/custom_components/
. When you are done you should
have <ha_config_dir>/custom_components/pegelonline/__init__.py
, <ha_config_dir>/custom_components/pegelonline/sensor.py
and so on.
If you use this method then you'll need to keep an eye on this repository to check for updates.
In Home Assistant:
- Enter configuration menu
- Select "Integrations"
- Click the "+" button on the bottom right
- Select the "PEGELONLINE" integration
- Choose the stream gauge you wish to monitor (it's a long list; stations are grouped by rivers)
- Save
- Add component to the HACS ecosystem.
- Figure out how to add basic unit tests.
Inspiration to write my first component came from foosel/homeassistant-coronavirus-hessen which served as a first blueprint for my code. Speaking of blueprints, oncleben31/cookiecutter-homeassistant-custom-component-instance contains a lot of helpful information (although I didn't use it as a basis). Last but not least, the official Home Assistant Developers documentation is the first and best source for developers, especially on setting up the development environment.