Skip to main content

ha-plusportal

Your PlusPortal electricity meter in Home Assistant — what you draw and what you feed in, with a cent-accurate bill projection.

CI PyPI Python Home Assistant HACS License: MIT Built with AI

Install · What you get · Energy dashboard · CLI · Built with AI · Legal

What it does

Read your metered electricity out of a PlusPortal energy customer portal and get it into Home Assistant — what you draw from the grid, what you feed back into it, and a cent-accurate projection of the bill.

PlusPortal is a white-label customer portal operated by many German utilities, each under its own subdomain of the form https://<tenant>.plusportal.de. This project uses your own account and your own data, through the same API the official web interface uses, so it works for any tenant.

  • ⚡ Quarter-hourly meter data aggregated into Home Assistant long-term statistics
  • ☀️ Feed-in kept apart — its own entities and its own statistic series, never added into consumption and never priced at the energy tariff
  • 💶 Cost, standing charge and settlement forecast for your billing year
  • 🔁 Self-correcting — each refresh re-reads a rolling three-week window
  • 🧾 Billing-accurate — provisional readings are excluded, exactly as the supplier bills
  • 🐍 Standalone Python client + CLI, usable entirely without Home Assistant

The repository contains two independent layers:

Layer Path Depends on Home Assistant? Status
pyplusportal — async API client + CLI src/pyplusportal/ no implemented
plusportal — HACS custom integration custom_components/plusportal/ yes implemented

The client is deliberately usable and testable on its own, without Home Assistant.

Installing it in Home Assistant

The interface is available in English and German and follows whatever language Home Assistant is set to; there is nothing to choose. Field and entity names in this document are the English ones, so a German instance will show their German equivalents instead (Energy price → Arbeitspreis, Standing charge, accrued → Grundpreis kumuliert). Entity ids stay English in both, so templates and automations keep working if the language changes.

Through HACS

This repository is in the default HACS catalogue, so searching the store finds it — nothing has to be added by hand. The badge opens it directly in your own instance; the manual route is below it.

Open this repository in HACS on your own Home Assistant instance.

  1. HACS in the sidebar, then search for PlusPortal.

  2. Open the entry and choose Download.

  3. Restart Home Assistant.

  4. Settings → Devices & Services → Add Integration → PlusPortal, then enter:

    Field Where to find it
    Tenant number the six digits at the start of your portal address
    Username your portal login — often the customer number, not an e-mail
    Password your portal password

Without HACS

Copy custom_components/plusportal/ into your Home Assistant config/custom_components/ directory and restart. Nothing else differs; HACS only automates the copying and the update notification.

Tariff, and what appears

Setup asks for the tariff in a second, optional step. Leave it empty to track consumption only; you can fill it in later under Settings → Devices & Services → PlusPortal → Configure, and change it there whenever your contract does.

Option Meaning
Energy price (EUR/kWh) required for any cost figure
Standing charge (EUR/year) apportioned across the billing year
Monthly advance payment (EUR) needed for the settlement forecast
Billing year starts (MM-DD) defaults to 01-01
Feed-in price (EUR/kWh) what you are paid for feed-in; independent of the tariff
Update interval (hours) defaults to 6; the portal publishes once a day

Per metering point you get consumption for the last day, the current and previous month, when the portal last had a value, and what share of the data is final. With a tariff, also the accrued energy cost and standing charge, the forecast for the billing year and the expected settlement. A meter that also feeds into the grid gets the same three energy figures for its feed-in; one that does not gets no feed-in entities. With a feed-in price, such a meter also shows the price and what the last day, the current and the previous month earned. That money is never offset against the cost figures: compensation usually comes from the grid operator, separately from the bill the forecast and settlement describe.

The Energy dashboard

Consumption is written to long-term statistics rather than exposed as a total_increasing sensor, because portal values arrive backdated by a day or more — a state-based sensor would book all of it at the moment of import.

Under Settings → Dashboards → Energy → Grid consumption, pick the statistic named after your meter with plusportal underneath it (a chart icon, not a lightning bolt). For cost, choose the option that takes a statistic tracking the total cost, and select <meter> grid cost. It exists once an energy price is set.

Feed-in is a series of its own, named <meter> return to grid; add it under Return to grid in the same dialog. For its compensation, choose the option that takes a statistic tracking the total compensation, and select <meter> feed-in compensation. It exists once a feed-in price is set; the portal publishes no feed-in tariff of its own.

The price options, a static price or an entity with the current price, do not work here. Home Assistant computes money from a price only for a source that is itself an entity, and these are external statistics, so it would show no cost and no compensation at all.

Quarter-hourly readings are aggregated into hourly statistics. Provisional values are left out and substitute values are included, which is the rule the supplier bills by, and each refresh re-reads a rolling three-week window so corrections land.

Using the client on its own

uv sync
cp .env.example .env      # fill in tenant, username, password
uv run pyplusportal meters

pyplusportal is a single CLI with five sub-commands:

Command Purpose
meters list metering points and their channels
overview show the portal's dashboard aggregates
readings fetch daily values, one block per OBIS channel
cost project this billing year's cost and settlement
probe record redacted responses as test fixtures

Tenant, username and password are picked up from .env (or the real environment), so once .env is set up the commands need no other flags:

uv run pyplusportal readings --from 2026-06-18 --to 2026-07-24 --meter 1000 --format csv

cost additionally needs your tariff, since the portal itself exposes no price data: PLUSPORTAL_ENERGY_PRICE_CT (required), plus PLUSPORTAL_BASE_PRICE_EUR, PLUSPORTAL_MONTHLY_ADVANCE_EUR and PLUSPORTAL_BILLING_YEAR_START (optional, see .env.example):

PLUSPORTAL_ENERGY_PRICE_CT=32.5 uv run pyplusportal cost

Run uv run pyplusportal help for the full option and environment-variable reference, or uv run pyplusportal help <command> for one command's own options.

Verifying against your own portal

The test suite runs offline against recorded fixtures. A second, opt-in suite talks to a real portal and reconciles what this client computes against what the portal itself reports — the quarter-hourly series, the daily series and the portal's month total must agree to the last digit:

uv run pytest -m live          # skips cleanly unless .env is filled in

It reads tenant, username and password from the environment only, so no account detail ever ends up in the repository.

Running the integration in a real Home Assistant

Neither test suite catches what only a running instance shows — a blocking call in the event loop, a timeout that is too short for the first backfill, an attribute Home Assistant cannot serialise. All three of those were real, and all three were found this way.

scripts/ha-dev.sh up        # starts Home Assistant on :8124 with this integration
scripts/ha-dev.sh state     # what the entities report
scripts/ha-dev.sh stats     # what reached the Energy dashboard
scripts/ha-dev.sh logs      # follow the integration
scripts/ha-dev.sh sync      # after a change: rebuild, reinstall, restart
scripts/ha-dev.sh reset     # throw the instance away

The integration is bind-mounted, so editing and restarting is the whole loop. The library is installed into the container from a locally built wheel, which is what lets this work before pyplusportal exists on PyPI — Home Assistant skips the pin in manifest.json once the requirement is already satisfied.

On first start, open http://localhost:8124, create a throwaway owner account and add the PlusPortal integration with the same values as your .env. Home Assistant's state lives in .dev/, which is gitignored: once configured it holds your portal password.

Built with AI

Most of the code, tests and documentation in this repository were written by an AI coding agent (Claude), under human direction and human review.

That is stated openly because it changes what you should check — so the project is built so that no claim rests on an agent's say-so:

Guard rail What it stops
Spec ids in docs/specs/, mechanically tied to tests behaviour changing without a written requirement
Test-first, with the failing run recorded tests that pass the moment they are written
ruff, mypy --strict, two suites, ≥ 90 % coverage anything merging red or untested
A live suite reconciling against a real portal plausible-looking numbers that are wrong
main accepts pull requests only, with review unreviewed code reaching users

The full loop, and what enforces each step, is in docs/AGENTIC-SDLC.md.

Unofficial and independent, as stated at the top. It uses your own credentials against your own account, over the same API the official web interface uses, and stores nothing outside your Home Assistant instance. No trademark, logo or branding of Thüga SmartService GmbH or any utility is used or distributed with this project. Use at your own risk.

License

MIT

Metadata

Release files for pyplusportal 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyplusportal 0.5.0
File Size Uploaded Provenance Actions
pyplusportal-0.5.0.tar.gz 588.6 kB With provenance Details for pyplusportal-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyplusportal 0.5.0
File Interpreter ABI Platform Actions
pyplusportal-0.5.0-py3-none-any.whl Python 3 none any Details for pyplusportal-0.5.0-py3-none-any.whl

Total release size: 624.1 kB

Release files / pyplusportal-0.5.0.tar.gz

Download URL pyplusportal-0.5.0.tar.gz
Size 588.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6dbea1f53a1d659b87e4977b8c7e20c61c9e8bd46a1e6f185fe7db46e16d07e1
BLAKE2b-256 checksum
How to use checksums
3db9d55cc3c4c43bb156ffc6db110fe0901570b03f6f9377881b7315f1826e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / pyplusportal-0.5.0-py3-none-any.whl

Download URL pyplusportal-0.5.0-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97319ddf9e111b5c144b4699b618c21b407927dcf31a2ede52e31a8883872cb2
BLAKE2b-256 checksum
How to use checksums
ce8320e19a4980497b9e0fd699c62f39abe989a22fcd51e063d45e9f9df54432
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for pyplusportal 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyplusportal-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page