Volkszähler (vzlogger)¶
Volkszähler is free software for recording and displaying consumption data. The meter is read by vzlogger, a small program that runs on the same computer the WattWächter USB is plugged into. It passes the values on to the Volkszähler middleware, via MQTT or to a local web server. vzlogger can read SML and D0 meters.
Prerequisites¶
- WattWächter USB is set up and you know its path under
/dev/serial/by-id/ - vzlogger is installed, see Volkszähler wiki → vzlogger (German). It is already included in the ready-made Volkszähler image for the Raspberry Pi.
- For display: a Volkszähler middleware with one channel created per value. The Volkszähler interface shows the UUID of each channel.
The configuration is in /etc/vzlogger.conf. In the examples, replace <path> with the path of your head, e.g. /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_<serial>-if00-port0.
SML meters¶
Almost all modern meters send SML at 9600 baud on their own:
{
"verbosity": 0,
"log": "/var/log/vzlogger.log",
"meters": [
{
"enabled": true,
"allowskip": false,
"protocol": "sml",
"device": "<path>",
"baudrate": 9600,
"parity": "8n1",
"aggtime": -1,
"channels": [
{
"uuid": "<uuid-import>",
"middleware": "http://localhost/middleware.php",
"identifier": "1-0:1.8.0"
},
{
"uuid": "<uuid-export>",
"middleware": "http://localhost/middleware.php",
"identifier": "1-0:2.8.0"
},
{
"uuid": "<uuid-power>",
"middleware": "http://localhost/middleware.php",
"identifier": "1-0:16.7.0"
}
]
}
]
}
| Code | Meaning |
|---|---|
1-0:1.8.0 |
Total import (Wh) |
1-0:2.8.0 |
Total export (Wh) |
1-0:16.7.0 |
Current active power (W), negative when feeding in |
More codes (phase power, voltages …) are listed under Readings.
D0 meters that send on their own¶
Some meters send D0 text without a request, usually at 9600 baud, 7E1 (e.g. eBZ DD3, EasyMeter Q3D). The test in the setup then reports D0 telegram detected. For these, use "protocol": "d0" without pullseq:
{
"enabled": true,
"protocol": "d0",
"device": "<path>",
"baudrate": 9600,
"parity": "7e1",
"channels": [
{
"uuid": "<uuid-import>",
"middleware": "http://localhost/middleware.php",
"identifier": "1-0:1.8.0"
}
]
}
This block replaces the entry under "meters" in the SML example above.
D0 meters that need a request¶
Meters with the IEC 62056-21 protocol (marked with footnote ⁴ in the Supported meters table) only send when vzlogger asks them. The request goes out at 300 baud, 7E1; with "ackseq": "auto" vzlogger then switches to the highest baud rate the meter offers:
{
"verbosity": 0,
"log": "/var/log/vzlogger.log",
"meters": [
{
"enabled": true,
"protocol": "d0",
"device": "<path>",
"baudrate": 300,
"parity": "7e1",
"pullseq": "2F3F210D0A",
"ackseq": "auto",
"interval": 60,
"channels": [
{
"uuid": "<uuid-import>",
"middleware": "http://localhost/middleware.php",
"identifier": "1-0:1.8.0"
}
]
}
]
}
pullseq is the request /?! with a line ending, interval the time between two requests in seconds. During the request the yellow LED on the head lights up briefly, then the green one flashes while the meter answers.
Which codes does my meter send?
Set "verbosity": 15 and start vzlogger in the foreground (vzlogger -f). It then writes every code it receives to the log. Use exactly that notation for identifier, then set verbosity back to 0.
Without a middleware: local web server¶
For trying things out, or if the values are processed elsewhere, vzlogger does not need a middleware. Set "api": "null" on the channels and enable the built-in web server:
{
"local": {
"enabled": true,
"port": 8080,
"index": true
},
"meters": [
{
"enabled": true,
"protocol": "sml",
"device": "<path>",
"baudrate": 9600,
"parity": "8n1",
"channels": [
{ "api": "null", "uuid": "00000000-0000-0000-0000-000000000001", "identifier": "1-0:1.8.0" },
{ "api": "null", "uuid": "00000000-0000-0000-0000-000000000002", "identifier": "1-0:16.7.0" }
]
}
]
}
vzlogger then serves the current values as JSON at http://<computer>:8080/. The UUIDs here are chosen freely; they only need to differ.
MQTT
vzlogger can also send the values to an MQTT broker ("mqtt" section in the configuration). The ready-made packages include MQTT; the settings are described in the Volkszähler wiki (German).
Start vzlogger¶
sudo systemctl restart vzlogger
sudo systemctl status vzlogger
Once vzlogger is running, the values arrive in the Volkszähler interface within a few seconds.
Troubleshooting¶
| Problem | Solution |
|---|---|
Permission denied when opening the port |
The user vzlogger runs as must be in the dialout group |
Device or resource busy |
Another program (Home Assistant, a test script) has the port open. Only one program at a time. |
| No values, green LED flashing | identifier does not match the meter's notation; check with "verbosity": 15 |
| D0 meter does not answer, yellow LED flashing | The head is not centred; as a test, leave out "ackseq", then the connection stays at 300 baud |
Further reading: vzlogger configuration parameters (German)