Skip to main content

Async client for BRUdirekt (Brunata) portal

Project description

brunata-nutzerportal-api

Python client for fetching consumption data from the Brunata Munich user portal (nutzerportal.brunata-muenchen.de). Intended as a basis for a Home Assistant integration.

Status

Early/experimental project. The Munich instance uses SAP OData (UI5 frontend).

  • Login: NP_REG_LOGON_SRV_01 (CredentialSet via $batch)
  • Data: NP_APPLAUNCHER_SRV, NP_DASHBOARD_SRV (e.g. monthly values)

Disclaimer

This is an unofficial, independent open-source project and is not affiliated with BRUNATA-METRONA or BRUdirekt.

Use of this client may be subject to the portal's terms of service and applicable law. You are responsible for complying with them.

Use only with your own account / proper authorization, do not share credentials, and avoid aggressive polling.

Trademarks and product names (e.g. BRUdirekt, BRUNATA-METRONA) belong to their respective owners.

Installation (Poetry)

poetry install

Configuration

Create a .env in the project root (it will not be committed due to .gitignore):

BRUNATA_USERNAME=you@example.com
BRUNATA_PASSWORD=your-password
BRUNATA_BASE_URL=https://nutzerportal.brunata-muenchen.de
BRUNATA_SAP_CLIENT=201

CLI

Test login:

poetry run brunata login

Dump account + available periods/cost types (warning: may contain personal data):

poetry run brunata dump-pages --output-dir .brunata-dump

Fetch consumption data:

poetry run brunata readings --kind heating
poetry run brunata readings --kind hot_water

Fetch consumption data for all cost types (e.g. HZ01, HZ02, ... / WW01, WW02, ...):

poetry run brunata readings-all --kind heating
poetry run brunata readings-all --kind hot_water

Fetch meter readings (cumulative index):

poetry run brunata meter

Fetch "current consumption" (as shown in the dashboard):

poetry run brunata current --kind heating
poetry run brunata current --kind hot_water

Library usage (Home Assistant)

The client is async and suitable for Home Assistant's DataUpdateCoordinator patterns:

from brunata_api import BrunataClient, ReadingKind

async def fetch():
    async with BrunataClient(
        base_url="https://nutzerportal.brunata-muenchen.de",
        username="...",
        password="...",
        sap_client="201",
    ) as client:
        await client.login()
        heating = await client.get_readings(ReadingKind.heating)
        hot_water = await client.get_readings(ReadingKind.hot_water)
        return heating, hot_water

Key methods:

  • BrunataClient.login()
  • BrunataClient.get_account()
  • BrunataClient.get_periods() – list of dashboard periods (start/end); use to see which year a value belongs to
  • BrunataClient.get_supported_cost_types()
  • BrunataClient.get_readings(...)
  • BrunataClient.get_monthly_consumption(cost_type=..., in_kwh=..., period_index=...)
  • BrunataClient.get_monthly_consumptions(kind, in_kwh=..., period_index=...)
  • BrunataClient.get_meter_readings(period_index=...) (all HZ.. and WW.., keyed by cost_type)
  • BrunataClient.get_current_consumption(kind, period_index=...) (YTD for the selected period)

Periods and yearly reset: The portal exposes data per dashboard period (usually one per calendar year). Cumulative values (meter reading, “current consumption”) are per period and typically reset when a new year starts. Default is period_index=0 (first period, often the current year). Use get_periods() to list periods and period_index to request a specific one (e.g. period_index=1 for the previous year). Integrations (e.g. Home Assistant) can use this to show “2024 total” vs “2025 YTD” or to handle the reset (e.g. new sensor per year or state_class per period).

Development

poetry run ruff check src tests
poetry run pytest

Packaging (optional)

poetry build
poetry publish --build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brunata_nutzerportal_api-0.2.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brunata_nutzerportal_api-0.2.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file brunata_nutzerportal_api-0.2.0.tar.gz.

File metadata

  • Download URL: brunata_nutzerportal_api-0.2.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brunata_nutzerportal_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 16cb82633af572455a3a24099cdd8a3d0e200042bd534a832d8cd179ac43128f
MD5 431310bfdf031e3ea358110f4b9c7b24
BLAKE2b-256 91778bb149d1ba6d7cc27c3879928e2c4d3075f678ec3f897924ae03458ad3d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for brunata_nutzerportal_api-0.2.0.tar.gz:

Publisher: publish.yml on fjfricke/brunata-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brunata_nutzerportal_api-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brunata_nutzerportal_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 472c26781a9e2b44cbcd60ee3da82d43ed75769e336d42729efc97ff555443f8
MD5 c5c3b07002b714daaec0b2020e8a65e4
BLAKE2b-256 2c284be5d8f1f5a97e509ba884b14f99e80df2e38f078fa965eb2d309b5f96c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for brunata_nutzerportal_api-0.2.0-py3-none-any.whl:

Publisher: publish.yml on fjfricke/brunata-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page