GitHunt
DA

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_local services
  • 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.yaml stack 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

  1. Clone this repository next to your HA configuration or preferred workspace.
  2. Copy templates/givenergy_local.yaml and adapt the helper entity IDs and device_id to match your system.
  3. Place the resulting configuration in your Predbat apps.yaml (see notes below).
  4. Ensure config/ exists and is writable; Predbat uses it for logs and state files.
  5. Start or restart Predbat so it picks up the plugin.
  6. 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 predbat

The 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_time with the inverter’s current clock.
  • Multiple inverters are supported; set num_inverters and 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 implementation
  • templates/givenergy_local.yaml – starter Home Assistant configuration
  • docker-compose.yaml – optional stack pointing at the published Predbat add-on
  • config/ – 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_token to apps.yaml and store the value in secrets.yaml, or export PREDBAT_GITHUB_TOKEN for the container. The bundled github_token_plugin.py automatically attaches the token so release checks no longer hit anonymous rate limits.
  • Timezone issues – Override the timezone argument in Predbat config if you are not in Europe/London.

License

This project is licensed under the terms of the MIT License. See LICENSE for details.

Languages

Python100.0%

Contributors

MIT License
Created October 5, 2025
Updated October 5, 2025
davidnoyes/predbat-givenergy-local-plugin | GitHunt