OpenDTU-OnBattery¶
OpenDTU-OnBattery controls your inverter by the power at the grid connection — for example for zero export with the Dynamic Power Limiter. It reads that power directly from the WattWächter Plus: over HTTP from the REST API, without an MQTT broker and without an extra meter in the distribution board.
OpenDTU or OpenDTU-OnBattery?
The original OpenDTU only reads the inverter and has no input for a power meter. This guide is for the fork OpenDTU-OnBattery.
In short¶
| URL | http://192.168.178.106/api/v1/history/latest (your WattWächter's IP address) |
| JSON path | 16.7.0/value |
| Unit | W |
| Sign | positive = import, negative = export — what OpenDTU-OnBattery expects, do not change the sign |
Prerequisites¶
- Your electricity meter provides the current power (
16.7.0). The dashboard shows whether it does under All Meter Values. If the value is missing, the meter usually has to be unlocked with its PIN first — see Preparation. - OpenDTU-OnBattery and the WattWächter are in the same network.
- The WattWächter has a fixed IP address (DHCP reservation in the router or a static IP in the settings). The FAQ explains how to find the current IP.
The endpoint¶
GET /api/v1/history/latest returns the values last received from the meter on every call:
curl -s http://192.168.178.106/api/v1/history/latest
{
"timestamp": 1791403049,
"datetime": "2026-10-07T21:57:29",
"telegram": "full",
"1.8.0": { "value": 12345.678, "unit": "kWh", "name": "Import" },
"2.8.0": { "value": 42.123, "unit": "kWh", "name": "Export" },
"16.7.0": { "value": -812.400, "unit": "W", "name": "Power" }
}
The current power is in the value field under 16.7.0. OpenDTU-OnBattery separates the levels of a JSON path with a slash — the dots are part of the name:
16.7.0/value
The value is in watts, positive when importing from the grid and negative when exporting.
Setting up OpenDTU-OnBattery¶
- In OpenDTU-OnBattery open Settings → Power Meter and switch on Enable Power Meter.
- Choose
HTTP(S) + JSONas the Power Meter Type. - Enter the values from the table.
- Check your entries under Test Configuration with Send HTTP(S) request(s) and process response(s) — OpenDTU-OnBattery then shows the power it read.
- Save. The power then appears in the live view.
| Field | Entry |
|---|---|
| Polling Interval | 2 seconds |
| Individual HTTP(S) requests per value | off |
| URL (value 1) | http://192.168.178.106/api/v1/history/latest |
| Authorization Type | None |
| HTTP Header - Key / Value | empty — except with API security |
| Timeout | 1000 milliseconds |
| JSON Path | 16.7.0/value |
| Unit | W |
| Change Sign | off |
Value 2 and value 3 stay disabled: 16.7.0 already is the sum of all phases.
Polling interval
The WattWächter answers at most 25 requests per 10 seconds across the whole device (see REST API → Rate Limit). 2 seconds leaves enough room for the web interface and other clients.
After that, set up the Dynamic Power Limiter in OpenDTU-OnBattery — it uses the power meter as its control value.
With API security¶
By default the REST API is reachable without a token. If you have switched on authentication under Settings → API security, give OpenDTU-OnBattery the READ token as an HTTP header:
| Field | Entry |
|---|---|
| Authorization Type | None |
| HTTP Header - Key | X-Api-Token |
| HTTP Header - Value | your READ token |
Alternative: MQTT¶
If you run an MQTT broker anyway, OpenDTU-OnBattery can also get the power from there: Power Meter Type MQTT, topic WattWaechter/wattwaechter-XXXXXXXXXXXX/16.7.0, and the JSON path stays empty. Set the publish interval on the WattWächter to a few seconds for this — by default it only publishes every 60 seconds, which is too slow for a control loop.
Troubleshooting¶
“Unable to access JSON key '16.7.0'”
The response contains no current power. Check under All Meter Values in the dashboard whether the meter provides 16.7.0 — often it only needs unlocking with the PIN. Also check the spelling of the path: 16.7.0/value, with a slash and without 1-0: in front.
HTTP 401
API security is switched on at the WattWächter. Enter the READ token as a header, see With API security.
HTTP 429
Too many requests in a short time. Increase the polling interval and check whether other systems also query the WattWächter every second.
No connection or timeout
- Has the WattWächter been given a new IP address? Set a DHCP reservation in the router.
- OpenDTU-OnBattery only resolves the name
wattwaechter-XXXXXXXXXXXX.localwhen mDNS is switched on in its network settings. With the IP address you do not depend on that.
The inverter regulates in the wrong direction
Change Sign has to be off: the WattWächter reports import as positive and export as negative, exactly as OpenDTU-OnBattery expects.