A Python wrapper for the official Wiener Netze Smart Meter API (WN_SMART_METER_API)
Project description
Wiener Netze Smart Meter API
Table of Contents
Introduction
This project provides a Python wrapper for the official Wiener Netze Smart Meter API (WN_SMART_METER_API), which is published by Wiener Stadtwerke through their developer portal. Unlike other approaches (notably fleinze’s vienna-smartmeter API Python wrapper and DarwinsBuddy’s HomeAssistant Integration) that rely on web-login recreation and can fail due to captchas, rate limiting, or other website changes, this wrapper uses the official endpoint.
By following the instructions below, you can acquire the necessary API credentials (client ID, client secret, and API key) from Wiener Stadtwerke’s developer portal and start fetching your power usage data .
First Steps
- Create an account at the Developer Portal of the Wiener Stadtwerke
- Create an application here for the WN_SMART_METER_API
- When the application is approved you will get an e-mail from API Developer Portal. The API-key is then found in the details of the newly created application.
- Write an e-mail to the Smart Meter Portal Support to connect the application with the Smart Meter Portal user. It usually takes 1-2 weeks to get a response.
- Afterwards the client-ID and client-secret can be found in the settings of the Smart Meter-Businessportal.
Installation
pip install wiener-netze-smart-meter-api
Updating
pip install -U wiener-netze-smart-meter-api
Usage
from wiener_netze_smart_meter_api import WNAPIClient
from datetime import datetime
client = WNAPIClient(client_id="client-id", client_secret="client-secret", api_key="API-key")
# Fetch all smart meters
smart_meters = client.get_anlagendaten()
print("All Smart Meters:", smart_meters)
# Fetch specific smart meter details
smart_meter_number = "AT0010000000000000001000000000000"
specific_meter = client.get_anlagendaten(smart_meter_number)
print("Specific Smart Meter:", specific_meter)
# Fetch quarter-hourly measured values for all meters for the last 3 years (default time period)
quarter_hour_values = client.get_quarter_hour_values()
print("Quarter-Hourly Values:", quarter_hour_values)
# Fetch daily measured values for a specific meter for the last 3 years (default time period)
daily_values = client.get_daily_values(smart_meter_number)
print("Daily Values for Specific Meter:", daily_values)
# Fetch daily measured values for a specific meter for the last 3 years (default time period) with pagination in 30 days chunks (default chunk size)
daily_values_paginated = client.get_daily_values(smart_meter_number, paginate=True)
print("Daily Values for Specific Meter with Pagination:", daily_values_paginated)
# Fetch meter readings for a specific meter for a specific time period
meter_readings = client.get_meter_readings(smart_meter_number, "2025-01-01", "2025-01-02")
print("Meter Readings:", meter_readings)
# Fetch meter readings for a specific meter for a specific time period with pagination in 7 days chunks
meter_readings_paginated = client.get_meter_readings(smart_meter_number, "2025-01-01", "2025-01-31", paginate=True, chunk_days=7)
print("Meter Readings Paginated:", meter_readings_paginated)
# Optional settings for the client regarding request retries, delay and timeout.
client = WNAPIClient(
client_id="client_id",
client_secret="",
api_key="api_key",
max_retries=3,
retry_delay=5,
timeout=10,
)
License
wiener-netze-smart-meter-api is distributed under the terms of the MIT license.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wiener_netze_smart_meter_api-0.1.2.tar.gz.
File metadata
- Download URL: wiener_netze_smart_meter_api-0.1.2.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42b5a48a530a1868cd37fc0031596d97a49e0ab2847c2041fd9da08efdf87184
|
|
| MD5 |
3ec9007b43402ceee932fc0bd08d4d80
|
|
| BLAKE2b-256 |
110c4561f29c1fadfd642e103768dfbdfbd619438fc5e7bdaf49cd1a9dba52ba
|
Provenance
The following attestation bundles were made for wiener_netze_smart_meter_api-0.1.2.tar.gz:
Publisher:
python-publish.yml on tschoerk/Wiener-Netze-Smart-Meter-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiener_netze_smart_meter_api-0.1.2.tar.gz -
Subject digest:
42b5a48a530a1868cd37fc0031596d97a49e0ab2847c2041fd9da08efdf87184 - Sigstore transparency entry: 172109132
- Sigstore integration time:
-
Permalink:
tschoerk/Wiener-Netze-Smart-Meter-API@2e0ac4e88eb64d075e42e88ad7ccde20cb0b3d12 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/tschoerk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2e0ac4e88eb64d075e42e88ad7ccde20cb0b3d12 -
Trigger Event:
release
-
Statement type:
File details
Details for the file wiener_netze_smart_meter_api-0.1.2-py3-none-any.whl.
File metadata
- Download URL: wiener_netze_smart_meter_api-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcb57956aede3799991e145ac52d60cbf1cad97d19791083e4c915014db5069a
|
|
| MD5 |
96a24b86c56f67ed54e86477ca174736
|
|
| BLAKE2b-256 |
fc600f133b10d2867d7f604b7ee9a2016dfd9a17988db7568c4f13e977f462c8
|
Provenance
The following attestation bundles were made for wiener_netze_smart_meter_api-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on tschoerk/Wiener-Netze-Smart-Meter-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiener_netze_smart_meter_api-0.1.2-py3-none-any.whl -
Subject digest:
dcb57956aede3799991e145ac52d60cbf1cad97d19791083e4c915014db5069a - Sigstore transparency entry: 172109135
- Sigstore integration time:
-
Permalink:
tschoerk/Wiener-Netze-Smart-Meter-API@2e0ac4e88eb64d075e42e88ad7ccde20cb0b3d12 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/tschoerk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2e0ac4e88eb64d075e42e88ad7ccde20cb0b3d12 -
Trigger Event:
release
-
Statement type: