This code is generated by an AI.
Data feed, historical CSV import, and dashboard cards for Grundwasserstand Messstelle Poing D 83 (NID Bayern: gkd.bayern.de).
Local setup for Poing. This bundle is preconfigured for the measuring station Poing D 83 in Bavaria. If you need data for another city or region, take this code and adapt it: change the NID resource URL in integration/grundwasser.yaml to your station’s table page, adjust unique_id/entity names, update the import script’s ENTITY_ID and CSV source/path if needed, and adapt the dashboard card entities. The NID HTML structure may differ per station—adjust the regex in the templates if your table layout is different.
| Path | Description |
|---|---|
integration/grundwasser.yaml |
REST sensors: level (m ü. NN), level (m u. Gelände), situation |
scripts/import-grundwasser-csv-to-recorder.py |
Import historical CSV into the recorder |
ui/apex-grundwasser-card.yaml |
ApexCharts card: year comparison (Jan–Dec, multiple years) |
ui/tile-grundwasser-situation.yaml |
Tile card: situation with color (green/amber/red) |
| docs/csv-import.md | Import instructions and troubleshooting |
ui/Home-Assistant-Grundwasser-Visual.png |
Screenshot of the dashboard (sample) |
The chart and situation tile together give a year-over-year view and current status:
- Home Assistant with REST and Recorder (SQLite)
- Python 3.8+ for the import script (when running outside HA)
Install these via HACS (Home Assistant Community Store):
| Add-on | Purpose |
|---|---|
| apexcharts-card | Year comparison chart (ApexCharts) |
| card-mod | Situation tile with state-based colors |
After installing, add the frontend resources in Settings → Dashboards → Resources (or as prompted by HACS), then reload the dashboard.
- Copy
integration/grundwasser.yamlinto your HAconfig/integrations/(or include it fromconfiguration.yaml). - Restart Home Assistant and add the integration (or reload REST).
- Entities:
sensor.grundwasser_poing_d83_m_u_nn,sensor.grundwasser_poing_d83_m_u_gelande,sensor.grundwasser_poing_d83_situation(your instance may show e.g.sensor.grundwasser_poing_d83_situation_3– use the ID from Developer Tools → States in the tile config).
- Get the CSV from NID Bayern (export/historical data) and save as
grundwasser_poing_historie.csv. Format:Datum;Grundwasserstand [m ü. NN];Prüfstatus(header in first 8 lines, data from line 9). - Copy the CSV and
scripts/import-grundwasser-csv-to-recorder.pyto your HA host (e.g. CSV inconfig/www/, script inconfig/). - Full import procedure (stop HA, backup DB, dry-run, run import, start HA) is in docs/csv-import.md. Use
--forceif the entity already has data and you want to backfill. - To keep long history, set
recorder.purge_keep_daysto a large value (e.g. 13514) before importing.
- Chart (year comparison): In Lovelace, add a card → Raw configuration → paste contents of
ui/apex-grundwasser-card.yaml. Requires apexcharts-card. - Situation tile: Add a card → Raw configuration → paste contents of
ui/tile-grundwasser-situation.yaml. Adjust theentity(and incard_modthestates('...')call) if your situation sensor has another ID (e.g.sensor.grundwasser_poing_d83_situation_3). Requires card-mod.
- Semicolon-separated; header/metadata in lines 1–8; data from line 9.
- Data rows:
YYYY-MM-DD;value;status(value with comma as decimal, e.g.511,22). - Rows with empty value are skipped (measurement gaps).
MIT. Data source: Bayerisches Landesamt für Umwelt (LfU), gkd.bayern.de.
