Python¶
Gas readings from version 1.2.0
aio-wattwaechter reads the m³ values of the WattWächter Gas from version 1.2.0. The examples under Quick start show electricity readings of a WattWächter Plus; how to read the meter reading and the flow rate is shown under Reading gas values.
The official Python library aio-wattwaechter provides async access to the WattWächter REST API. It covers all API endpoints and is suitable for custom scripts as well as a foundation for smart home integrations.
Installation¶
pip install --upgrade aio-wattwaechter
The current version is 1.3.0 (October 2026). It does not require firmware 1.3.0, but uses its new fields when the device reports them.
Quick start¶
import asyncio
from aio_wattwaechter import Wattwaechter
async def main():
# No token needed if authentication is disabled (factory default)
async with Wattwaechter("192.168.1.100") as client:
# Get current meter readings
data = await client.meter_data()
if data:
print(f"Power: {data.power} W")
print(f"Total consumption: {data.total_consumption} kWh")
# System diagnostics
info = await client.system_info()
print(f"WiFi RSSI: {info.get_value('wifi', 'RSSI')} dBm")
# 15-minute resolution history
history = await client.history_high_res("2024-03-08")
for entry in history.items:
print(f" {entry.date}: {entry.power_w} W")
asyncio.run(main())
Reading gas values¶
On the WattWächter Gas, meter_data() returns the meter reading in m³ and the flow rate in m³/h; is_volume_meter is True then. The 15-minute history is in m³ as well:
async with Wattwaechter("192.168.1.100") as client:
info = await client.system_info()
print(info.product_name, info.model_id) # e.g. "WattWächter Gas", "ww_gw_mf"
data = await client.meter_data()
if data and data.is_volume_meter:
print(f"Meter reading: {data.volume} m³ (OBIS {data.volume_obis})")
print(f"Flow rate: {data.flow} m³/h")
history = await client.history_high_res("2026-11-01")
print(history.unit) # "m³"
From version 1.3.0, data.gw.meter_since tells you since when the current meter reading applies (first entry or last meter exchange, firmware 1.3.0).
Authentication¶
By default, authentication is disabled — you can connect without a token:
client = Wattwaechter("192.168.1.100")
When authentication is enabled, two token levels are supported:
# Read-only (history, status, view settings)
client = Wattwaechter("192.168.1.100", token="your-read-token")
# Full access (change settings, OTA, reboot)
client = Wattwaechter("192.168.1.100", token="your-write-token")
Automatic Retry¶
The client automatically retries requests on 429 (rate limit) or 503 (device busy), respecting the Retry-After header:
# Default: 3 attempts
client = Wattwaechter("192.168.1.100")
# Custom configuration
client = Wattwaechter("192.168.1.100", max_retries=5)
# Disable retries
client = Wattwaechter("192.168.1.100", max_retries=1)
API Coverage¶
| Category | Methods |
|---|---|
| System | alive, system_info, led, selftest, wifi_scan, timezones, reboot |
| Meter Data | meter_data, history_high_res, history_low_res |
| Logs | logs_rawdump, logs_persistent, logs_ram |
| OTA | ota_check, ota_start |
| Settings | settings, update_settings |
| Auth | generate_tokens, confirm_tokens, setup_token |
| MQTT | mqtt_ca_status, mqtt_ca_upload, mqtt_ca_delete, mqtt_status |
| Modbus TCP | modbus_status |
| Cloud | cloud_pair, cloud_unpair |
Example: Modbus status¶
async with Wattwaechter("192.168.1.100") as client:
status = await client.modbus_status()
if not status.enabled:
print("Modbus TCP is disabled.")
return
print(f"Running on port {status.port}, {status.active_connections} active clients")
for r in status.registers:
if r.valid:
print(f" {r.name} (OBIS {r.obis}) = {r.value} {r.unit}")
Example: MQTT connection status¶
from aio_wattwaechter.models import MqttState
async with Wattwaechter("192.168.1.100") as client:
status = await client.mqtt_status()
if status.state == MqttState.CONNECTED:
print(f"MQTT connected to {status.host}:{status.port}")
elif status.last_error != 0:
print(f"Error {status.last_error}: {status.last_error_message}")
Reusing an Existing Session¶
An existing aiohttp.ClientSession can be passed in — useful for Home Assistant integrations:
client = Wattwaechter(
"192.168.1.100",
token="your-token",
session=existing_session,
)
Source Code & License¶
- PyPI: pypi.org/project/aio-wattwaechter
- GitHub: github.com/SmartCircuits-GmbH/WattWaechter-PyPI
- License: Apache License 2.0