borisbu / OctoRelay

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

🚀 5.0.0 #280

Closed RobinTail closed 1 month ago

RobinTail commented 2 months ago

Closes #255 Closes #212

coveralls commented 2 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling 05da3a3adfe2b7d271abf863777c5a1d45574704 on develop into ee7e2f0e7109b6dfa92d7ce4c0af39eacd732c3d on master.

RobinTail commented 1 month ago

🚀 5.0.0a4 is published, @ch3p4ll3 . Please install/upgrade to it from the Pre-release channel and let me know how it works with Raspberry Pi 5.

https://github.com/borisbu/OctoRelay/releases/download/5.0.0a4/release.zip
RobinTail commented 1 month ago

I'm getting the following error in logs when running on Raspberry Pi 4 (OctoPi* 1.0.0, build 2023.06.27.080047 — latest):

    import _lgpio
ImportError: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/oprint/lib/python3.9/site-packages/_lgpio.cpython-39-arm-linux-gnueabihf.so)

Looks like I can not upgrade it with the currently installed OS. The latest version available is 2.31

ch3p4ll3 commented 1 month ago

How did you installed octoprint and the plugin? I tried the lib also on my pi3b+ creating a new venv and works without any problem.

Edit: Oh, it's octopi

RobinTail commented 1 month ago

Octopi 1.0 is Debian "bullseye" RpiOS 2022-09-22, @ch3p4ll3 https://github.com/guysoft/OctoPi/releases/tag/1.0.0

The most frustrating to me is that lgpio installed on it without any issues, but failed to operate in runtime. Meaning that there is no compatibility check at all.

ch3p4ll3 commented 1 month ago

Could you try manually install the library?

ch3p4ll3 commented 1 month ago

I'll also try also in my 3B+ with octopi

RobinTail commented 1 month ago

Could you try manually install the library?

I installed it, @ch3p4ll3 , but it I think it should also somehow be connected to python (instead of regular pip install lgpio)

install -m 0644 lgpio.h                  /usr/local/include
install -m 0644 rgpio.h                  /usr/local/include
install -m 0755 liblgpio.so.1 /usr/local/lib
install -m 0755 librgpio.so.1 /usr/local/lib
install -m 0755 rgpiod                   /usr/local/bin
install -m 0755 rgs                      /usr/local/bin
install -m 0644 rgpiod.1                 /usr/local/man/man1
install -m 0644 rgs.1                    /usr/local/man/man1
install -m 0644 lgpio.3                  /usr/local/man/man3
install -m 0644 rgpio.3                  /usr/local/man/man3
ldconfig
/usr/bin/python3
/usr/bin/python3
ch3p4ll3 commented 1 month ago

I think I found the problem. the package libc6-dev in the repo is too old. Current version is: 2.38, while octopi has 2.31 and lgpio needs at least 2.33. I found out that bullseye last version is 2.31

So, I don't think there are many chances to get this work on Octopi if they don't update to bookworm :(

RobinTail commented 1 month ago

Exactly, @ch3p4ll3 , my findings were similar. Related issue: https://github.com/guysoft/OctoPi/issues/823

Looks like they can not enable camera streaming on it yet.

RobinTail commented 1 month ago

Anyway, does it work on Raspberry 5 with another OS, @ch3p4ll3 ? Do you see the buttons? Do they operate relays?

ch3p4ll3 commented 1 month ago

yeah, I already tested it when I was developing in my fork. Btw I have an idea. We can use different PinFactories based on the system.

For example:

Or try with lgpio and in case fallback to rpi.GPIO

RobinTail commented 1 month ago

That's a great idea, @ch3p4ll3 . Yes, Bullseye has ldd version 2.31. If you could make it select the proper factory somehow, that would make it compatible with current OctoPi. But my knowledge and expertise is limited in this field: I'm not sure how to detect which factory to use. I hope you'll find a way

RobinTail commented 1 month ago

Btw, I read that gpiozero can decide on the factory itself, somehow, if you don't define it explicitly. Maybe we can install both and it will choose the right one? Sounds a bit optimistic probably.

ch3p4ll3 commented 1 month ago

Btw, I read that gpiozero can decide on the factory itself, somehow, if you don't define it explicitly. Maybe we can install both and it will choose the right one? Sounds a bit optimistic probably.

Yeah we can try, Idk if it will also work with Pi5, I think it'll depend on the "loading" order of the pins factories

ch3p4ll3 commented 1 month ago

Ok, just tested. the first pinFactory that gpiozero tries is lgpio, so I think this will work. Tomorrow I'll make some commits and test in my Pi5

RobinTail commented 1 month ago

I found the list of default factories used in the specific order when none is specified: https://github.com/gpiozero/gpiozero/blob/f3a338e56c28dd2d904016b3a8594f82c47da291/gpiozero/devices.py#L273-L286

RobinTail commented 1 month ago

🚀 5.0.0a5 published, @ch3p4ll3 Please check that is still works on Raspberry 5. I will check on my 4 with Octopi.

ch3p4ll3 commented 1 month ago

Yep, still working on my Pi5

RobinTail commented 1 month ago

✅ Regression test on Raspberry Pi 4 with OctoPi 1.0.0 (Bullseye) passed! Thank you @ch3p4ll3

RobinTail commented 1 month ago

Yep, still working on my Pi5

Perfect! I think it's a great achievement. I highly appreciate your effort and I'm glad with our collaboration.

I'm going to perform some chores and make a couple more tests before the final release. Thank you so much, @ch3p4ll3

RobinTail commented 1 month ago

🚀 5.0.0rc1 ✅ QA passed

RobinTail commented 1 month ago

🚀 5.0.0rc2 ✅ Regression test passed

@ch3p4ll3 , please confirm one last time that the version 5.0.0rc2 still works on Raspberry Pi 5

ch3p4ll3 commented 1 month ago

image I think something broke. The request return 400, CSRF validation failed

RobinTail commented 1 month ago

Try to refresh the page hardly (Cmd+Shift+R) or re-login, @ch3p4ll3 CSRF means that the session key of the UI does not match the running API (probably after the update)

ch3p4ll3 commented 1 month ago

uh nice, yep still working

RobinTail commented 1 month ago

Marketplace listing update: https://github.com/OctoPrint/plugins.octoprint.org/pull/1311