Skip to content

vzLogger add-on has no permission to access /dev/ttyUSB0 in haos_rpi3-64-8.5 #2

Description

@Nobby12

When I try to read my smartmeter with the vzLogger addon, then there seems to be a permission problem to access the ttyUSB0.
When I open the vzLogger log, I see this error:
open(/dev/ttyUSB0): Operation not permitted

I have an IR to USB reader (USB IR Lesekopf EHZ Lese-Schreib-Kopf Volkszähler Hichi Smartmeter) with CP2102_USB_to_UART_Bridge to read my smartmeter.
I'm using a fresh haos_rpi3-64-8.5 installation with my Raspberry 3:
https://github.com/home-assistant/operating-system/releases/download/8.5/haos_rpi3-64-8.5.img.xz

When I use the command line to communicate with the smartmeter, everything works fine. I get response from the smartmeter with these commands:
stty -F /dev/ttyUSB0 300 -parodd cs7 -cstopb parenb -ixoff -crtscts -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke
cat ./Anforderungssequenz_xxxxx.txt > /dev/ttyUSB0
cat /dev/ttyUSB0

In
https://github.com/markussiebert/homeassistant-addon-vzlogger/blob/main/vzlogger/Dockerfile
I found these lines:
# without running a user context, no exec is possible and without the dialout group no access to usb ir reader possible
# RUN useradd -G dialout vz && mkdir -p /home/vz && chown vz:vz /home/vz
RUN chmod a+x /etc/services.d/vzlogger/listdevices.sh && \
usermod -a -G dialout root

So I think, the docker container expects that /dev/ttyUSB0 must be accessable for the group dialout.

But when I check this in my terminal, then I see that /dev/ttyUSB0 is only accessable for the group audio:
ls -l /dev/ttyUSB0
crw-rw---- 1 root audio 188, 0 Mar 11 08:33 /dev/ttyUSB0

I tried to change the group for ttyUSB0, but that didn't work:
chgrp dialout /dev/ttyUSB0
chgrp: /dev/ttyUSB0: Read-only file system

Here is the complete log of the vzLogger add-on:
`[20:19:00] INFO: ==============================================================================
[20:19:00] INFO: Starting vzlogger
[Sep 01 20:19:00][main] vzlogger v0.8.0 based on heads/master-0-gccb6d8ee49 from Fri, 5 Nov 2021 03:13:34 +0100 started.
[Sep 01 20:19:00][main] log level is 15
[Sep 01 20:19:00][d0] open(/dev/ttyUSB0): Operation not permitted
[Sep 01 20:19:00][mtr0] Cannot open meter
[Sep 01 20:19:00][] Startup failed: Meter open failed.
[Sep 01 20:19:00][mtr0] Creating new meter with protocol d0.
[Sep 01 20:19:00][d0] pullseq len:11 found
[Sep 01 20:19:00][d0] using autoack
[Sep 01 20:19:00][mtr0] Meter configured, enabled.
[Sep 01 20:19:00] New meter initialized (protocol=d0)
[Sep 01 20:19:00] Have 1 meters.
[Sep 01 20:19:00][main] local=0
[Sep 01 20:19:00] Process not daemonized...
[Sep 01 20:19:00] Opened logfile /var/log/vzlogger.log
[Sep 01 20:19:00][push] No pushDataServer defined.
[Sep 01 20:19:00][] ===> Start meters
[20:19:01] INFO: ==============================================================================
/dev/ttyUSB0 - Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0037
[20:19:01] INFO: ==============================================================================
[20:19:01] INFO: {
"retry": 0,
"verbosity": 15,
"log": "/var/log/vzlogger.log",
"local": {
"enabled": false,
"port": 8081,
"index": true,
"timeout": 0,
"buffer": 0
},
"meters": [
{
"enabled": true,
"allowskip": false,
"interval": -1,
"aggtime": -1,
"aggfixedinterval": false,
"channels": [
],
"protocol": "d0",
"device": "/dev/ttyUSB0",
"dump_file": "",
"pullseq": "2F3F31xxxxxxxxxx210D0A",
"ackseq": "auto",
"baudrate": 300,
"baudrate_read": 9600,
"baudrate_change_delay": 500,
"parity": "7e1",
"read_timeout": 100
}
]

}`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions