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

Fetch building/national consumption comparison (kWh/m²):

poetry run brunata comparison

Fetch forecast and year-over-year comparison:

poetry run brunata forecast

Fetch room-level consumption breakdown:

poetry run brunata rooms

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)
  • BrunataClient.get_consumption_comparison(period_index=...) – building/national average (kWh/m²) per cost type
  • BrunataClient.get_consumption_forecast(period_index=...) – forecast, previous year, difference per cost type
  • BrunataClient.get_room_consumption(period_index=...) – room-level breakdown per cost type

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.3.0.tar.gz (17.4 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.3.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brunata_nutzerportal_api-0.3.0.tar.gz
  • Upload date:
  • Size: 17.4 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.3.0.tar.gz
Algorithm Hash digest
SHA256 71fcb3f0604fa4826ea5b5b986850430120a1ca805fae5e67a3e990a61a920e8
MD5 2dc3a7976dcf79bebe478f150c32c907
BLAKE2b-256 7b403c6dd3124bd805ad9f108582e8870b53aa6a2b55b902ec9b835fe41f2f2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for brunata_nutzerportal_api-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brunata_nutzerportal_api-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc47115033611c93d12c6b2e2777a716a9e271d922d7425d561bf42cd502f1a
MD5 ea0b7ca28ba5522ba239deef5aeeb951
BLAKE2b-256 eaff751fd0b157dca5a1704ee17503088faaae330970da984c218975457157f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for brunata_nutzerportal_api-0.3.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