Home Assistant integration for the Netze BW portal with automatic smart meter discovery and energy consumption/feed-in sensors.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Home Assistant integration for the Netze BW portal — automatic smart meter discovery, real-time sensors, and up to 30 days of energy history for the Energy Dashboard.
Project website (German): cygnusb.github.io/ha-netze-bw
Upgrading to 0.6.0 from an earlier version? Entity and statistic IDs changed: every meter is now keyed by installation and direction, which fixes bidirectional meters previously only reporting feed-in (#3). After the update, remove the orphaned old entities/devices and re-select the new statistics in the Energy Dashboard. History is re-imported automatically from the portal for the configured backfill window.
Each discovered meter gets the following sensors:
| Sensor | Description | Unit | State class |
|---|---|---|---|
| Daily energy | Last reported daily consumption or feed-in from the portal API | kWh | — |
| Daily consumption | Latest daily value from the backfilled history | kWh | Measurement |
| Hourly consumption | Latest hourly value from the backfilled history | kWh | Measurement |
| 15-minute consumption | Latest 15-minute value from the backfilled history (if enabled) | kWh | Measurement |
| Total reading | Current cumulative meter reading | kWh | Total increasing |
| 7 day sum | Sum of the last 7 days | kWh | — |
| 30 day sum | Sum of the last 30 days | kWh | — |
| Last measurement date | Timestamp of the last measurement point | — | — |
| Sensor | Description |
|---|---|
| Serial number | Meter serial number |
| Metering code | MeLo-ID (formatted in groups of 4) |
| SMGW ID | Smart meter gateway ID |
| Value types | Available measurement value types |
| Statistic IDs | Recorder statistic IDs for this meter (state: hourly; attributes: daily/hourly/15min) — copy these into dashboard cards |
| History status | ok / gaps / error / disabled |
| Last daily history point | Timestamp of the newest daily statistic pushed to HA |
| Last hourly history point | Timestamp of the newest hourly statistic pushed to HA |
| Last 15-minute history point | Timestamp of the newest 15-minute statistic pushed to HA |
| Last history backfill | Timestamp of the last successful history fetch |
| Open history gaps | Number of date gaps still missing from the expected window |
| Last data fetch | Timestamp of the last coordinator update |
| Next data fetch | Scheduled time of the next coordinator update |
Daily and hourly history data is exported as Long-Term Statistics under the IDs:
netze_bw_portal:<meter_id>_daily
netze_bw_portal:<meter_id>_hourly
Add these as an Electricity grid or Solar panels source in Settings → Energy to see up to 30 days of consumption or feed-in history.
On first setup, the integration fetches all 30 days of daily history (one API call) and all 30 days of hourly history (one call per day with a short delay). Subsequent polls only re-fetch the last 2 days (recheck window, because data arrives with a delay) plus any gaps.
A ready-to-use Plotly Graph Card example is included in examples/plotly_netze_bw.yaml. It shows the grid balance per hour:
sun.sun integrationReplace the two placeholders in the entity: lines under entities: with statistic IDs (netze_bw_portal:..._hourly), not sensor.* entity IDs. The easiest way (v0.6.2+): open the meter's device page and copy the value of the diagnostic sensor "Statistic IDs" / „Statistik-IDs" — its state is the hourly statistic ID, and the daily/15-minute variants are in its attributes. Alternatively, find them in Developer Tools → Statistics by filtering for netze_bw_portal. (They are built from the internal installation ID plus the direction, so you cannot derive them from the entity names.)
Home Assistant stores the imported history as hourly statistics only, including the 15-minute series, so the card cannot show 15-minute bars.
custom_components/netze_bw_portal folder into your Home Assistant config/custom_components/ directoryConfigured during initial setup (and adjustable later via Configure):
| Option | Default | Description |
|---|---|---|
| Enabled meters | all | Select which meters to track |
| Enable daily history backfill | on | Push daily statistics to the Energy Dashboard |
| Enable hourly history backfill | on | Push hourly statistics to the Energy Dashboard |
| Enable 15-minute history backfill | off | Push 15-minute statistics to the Energy Dashboard |
| History backfill days | 30 | How many days of history to maintain (1–30) |
All options can be changed at any time by clicking Configure on the integration card.
logger:
logs:
custom_components.netze_bw_portal: debug
This project is licensed under the MIT License. See LICENSE for details.