borisbu / OctoRelay

OctoPrint / Octopi plugin to control relays
GNU Affero General Public License v3.0
43 stars 24 forks source link

fix driver for automatic pin factory #281

Closed ch3p4ll3 closed 1 month ago

coveralls commented 1 month ago

Coverage Status

coverage: 100.0% (+0.2%) from 99.831% when pulling 36a4e18be6294f7abc8d3c2f370764497aef1235 on ch3p4ll3:master into fec1ea978be2b82f822d6b3a1703aba47994e049 on borisbu:develop.

ch3p4ll3 commented 1 month ago

Hi, this should fix the issues of yesterday. I tried it on my Pi5 with Raspbian and it works.

Btw, it seems that gpiozero creates a cache(?) file, at the beginning I got this error: py.warnings - WARNING - /home/pi/OctoPrint/venv/lib/python3.11/site-packages/gpiozero-2.0.1-py3.11.egg/gpiozero/devices.py:300: PinFactoryFallback: Falling back from lgpio: [Errno 2] No such file or directory: '.lgd-nfy-3'.

I discovered that this is a permissions problem in the folder where octoprint is started from (being started with systemd I think some folder in the root). To fix this I had to add WorkingDirectory=<your octoprint folder>, eg: WorkingDirectory=/home/pi/OctoPrint to the file /etc/systemd/system/octoprint.service in the section Service. Then I reloaded the systemd services: sudo systemctl daemon-reload and finally restarted octoprint: sudo systemctl restart octoprint

This evening I'll try it on my Pi3 B+ with OctoPi. Let me know if you encounter some errors