ws28xx: run weewx as non-root user?

43 views
Skip to first unread message

michael.k...@gmx.at

unread,
Oct 30, 2023, 5:20:38 PM10/30/23
to weewx-user
Can I run weewx as non-root user using the ws28xx driver?

I am on raspianOS, is there a device I have to change access rights or is there a group to add the user to, or some other rule to let unprivileged users access the device?

vince

unread,
Oct 30, 2023, 5:29:36 PM10/30/23
to weewx-user
Yes.  Maybe. What device does it use ?

If you are on a pi using user 'pi' you are a member of group 'dialout' which can access the serial/usb port ala /dev/ttyUSB0 without making any changes.  That's how my VP2 using a serial2usb converter works.

michael.k...@gmx.at

unread,
Oct 31, 2023, 4:31:57 AM10/31/23
to weewx-user
If the user weewxd is running doesn't have sufficient permissions to access the device, you get this error Message:

ERROR weewx.engine: Import of driver failed: The device has no langid (permission issue, no string descriptors supported or device error) (<class 'ValueError'>)

To fix this, I've added an udev rule.

First, find out vendor and device id:

pi@rpi:~$ lsusb
Bus 002 Device 002: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 6666:5555 Prototype product Vendor ID Weather Direct Light Wireless Device
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Vendor Id is 6666, device Id is 5555

Then, create and edit a file with the udev rules:

pi@rpi:~$ sudo nano /etc/udev/rules.d/99-ws28xx.rules

The content of the file:

SUBSYSTEM=="usb", ATTR{idVendor}=="6666", ATTR{idProduct}=="5555", MODE="666"

Restart udev and unplug/replug the device (or restart the machine)

I don't know if there is a better way or if there is any other issue with doing it this way, but this gets things working on Raspberry Pi OS :)
Reply all
Reply to author
Forward
0 new messages