davidnoyes/predbat-givenergy-local-plugin
Predbat plugin that syncs givenergy-local with Home Assistant helpers and bundles templates plus compose tooling for quick setup.
GivEnergy Local Plugin
This repository packages a Predbat plugin that keeps givenergy-local in sync with Predbat's scheduling helpers. It is designed to be mounted into the official Predbat add-on container so Home Assistant helpers drive your inverter without manual service calls.
Features
- Mirrors Predbat helper state changes into the matching
givenergy_localservices - Seeds missing helpers with sensible defaults to avoid "unknown" states on startup
- Keeps an ISO8601 timestamp sensor updated to eliminate inverter clock skew
- Provides an example Home Assistant configuration (
templates/givenergy_local.yaml) - Ships an optional
docker-compose.yamlstack for local development or testing
Prerequisites
- Home Assistant with the givenergy-local integration configured
- Predbat v8.25.4 (as packaged in
nipar44/predbat_addon:slim-v8.25.4) - Python-based Predbat plugin system (bundled with the add-on image)
- Docker (optional) if you plan to use the provided compose file
Quick Start
- Clone this repository next to your HA configuration or preferred workspace.
- Copy
templates/givenergy_local.yamland adapt the helper entity IDs anddevice_idto match your system. - Place the resulting configuration in your Predbat
apps.yaml(see notes below). - Ensure
config/exists and is writable; Predbat uses it for logs and state files. - Start or restart Predbat so it picks up the plugin.
- Watch the container log (
docker logs -f predbat) to confirm the plugin enables charge/discharge windows.
Using Docker Compose
A minimal compose stack is included for local experimentation:
docker compose down
docker compose up -d
docker logs -f predbatThe compose file bind-mounts ./config into /config and the plugin file into /addon/givenergy_local_plugin.py inside the container.
Configuration
The plugin is enabled via the givenergy_local_plugin flag inside your Predbat module definition. The template shipped in templates/givenergy_local.yaml includes all required helper entities:
sensor.predbat_*helpers act as the bridge between Predbat and givenergy-local.- By default the plugin creates missing helpers, sets safe defaults, and updates
sensor.predbat_inverter_timewith the inverter’s current clock. - Multiple inverters are supported; set
num_invertersand repeat the helper lists per inverter index.
If you prefer to manage the Home Assistant → givenergy-local mapping yourself, remove the flag or set it to false.
Repository Layout
plugin/givenergy_local_plugin.py– Predbat plugin implementationtemplates/givenergy_local.yaml– starter Home Assistant configurationdocker-compose.yaml– optional stack pointing at the published Predbat add-onconfig/– ignored directory where Predbat stores runtime configuration (create your own files here)docs/dev_notes.md– additional background and operational tips
Development Notes
See docs/dev_notes.md for compatibility targets, outstanding tasks, and operational commands. Predbat reloads the plugin automatically when givenergy_local_plugin.py changes; inspect the container logs to catch syntax errors or warnings raised by the plugin.
Troubleshooting
- Helpers stuck as
unknown– Ensure Home Assistant created the helper entities listed in the template; the plugin seeds defaults but cannot create helper definitions for you. - GitHub rate limit warnings – Create a fine-grained personal access token on GitHub with read-only repo access, then either add
github_token: !secret predbat_github_tokentoapps.yamland store the value insecrets.yaml, or exportPREDBAT_GITHUB_TOKENfor the container. The bundledgithub_token_plugin.pyautomatically attaches the token so release checks no longer hit anonymous rate limits. - Timezone issues – Override the
timezoneargument in Predbat config if you are not inEurope/London.
License
This project is licensed under the terms of the MIT License. See LICENSE for details.