WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
torwan
Posts: 9
Joined: Mon Apr 26, 2021 7:57 pm

WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by torwan »

Hi,

- DietPi_RPi-ARMv6-Buster.7z downloaded April 21st, 2021
- Raspberry Pi Zero W v1.1

Try to boot from above image, then install WebIOPi using embedded optimized software installation system. It will not work. I mean, it will start a web service which is accesible but it does not work. For instance, it displayes the pinout pincture but you can do nothing. Not possible to define a pin as in/out or control it. Just does not work.

DietPi team, why to include something what does not work?

I am not expecting an answer, I switched to Raspberry Pi OS Lite. This is just to let you know about the bug.
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Many thanks for your report. It would have been awesome to have some error logs to get an idea whether it is a general issue with WebIOPi or just a missing Python module or syntax (as of too old Python code). I'll add what I have in case others find this thread.

WebIOPi has been last updated by its developer(s) over 6 years ago: https://sourceforge.net/projects/webiopi/files/

Since I'm quite inexperienced with GPIO in general, I never did a functional test but only maintained the install option coding-wise. It basically installs the RPi Python GPIO packages and runs the included setup script.

So indeed it would be great to have some people test it, especially if it works with current Python versions and firmware in general. It's possible that it simply does not work on RPi Zero, since that board was announced half a year after the last WebIOPi release, which was about enabling RPi2 support.

I was thinking about removing it because it seems to required Python 2, which is not shipped anymore with next Debian release: https://github.com/MichaIng/DietPi/issues/3656

What I did find is two forks, which seem to enable RPi3 / RPi4 + Python 3 support:
- https://github.com/thortex/rpi3-webiopi
- https://github.com/Freenove/WebIOPi

But I didn't want to change something until either me or someone else is able to test those functionally, also on the older RPi models.

As you switched to Raspberry Pi OS Lite, you did not try to or succeeded to get WebIOPi running there, did you?
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

I have an RPi1 to test around. It seems clicking on buttons doesn't have any effect
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Does the browser console show any error? Or the service log?

Code: Select all

journalctl -u webiopi
cat /var/log/webiopi
To be true I'm not sure what effect it should have (visually). Never used it, as said. From what I understood, I ships an API, but one needs to write own scripts to actually use that API.

... reading, okay indeed pressing the buttons next to the pins in the diagram should toggle them, but not sure if that is visually visible in the UI, e.g. has any effect when not attaching something to the pins: https://www.raspberry-pi-geek.com/Archi ... th-WebIOPi
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Browser console shows net::ERR_EMPTY_RESPONSE but I think that is as it runs in a container where it has no access to the GPIO. Will check some more things before installing it on the main system.
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Further testing. I managed to get control over the GPIO states from within the container. There is a huge number of different tools to get/set those: gpio-utils, raspi-gpio, gpiod, pigpio-tools, pigpio ... all show the correct state of my pins and I'm able to toggle them as well. However, the Python library should work without any of those CLI tools.

Since from console I can check and control all pins without issues, but the WebIOPi interface fails to even get the states, I suspect a Python version incompatibility. I'll retest on Stretch with a lower Python version. Btw as it runs as root, permissions are not the issue. Another thing we might want to change away from the installer, if we ever (want to) get this working.

The debug flag btw does not reveal anything interesting. It shows the client requests which get a 200 response code, while the issue with empty responses are not visible.

EDIT: Same issue on Stretch. Now testing the other forks.

EDIT2: As additional test I installed WiringPi, as most guides around WebIOPi use the gpio command (which is WiringPi). It works fine, but doesn't solve the issue with WebIOPi, which still fails to show any GPIO states.

EDIT3: Okay, and it IS related to the container. The newest fork provides a better error message (or maybe Python 3 is it, which is able to run it):
No access to /dev/mem. Try running as root!

I bind-mounted it into the container, but I think it has limited write access to that generic tunable.


EDIT4: Granted CAP_SYS_RAWIO to the container, BINGO, WebIOPi works flawlessly now on my RPi2 with Python 3.7. Will check again the original version.

EDIT5: Old version still fails, to there it is not an permission issue. Installed the newer fork with Python 3 on to of it and it works fine. PR up: https://github.com/MichaIng/DietPi/pull/4310
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

thx @MichaIng doing to effort to migrate this old software title to a newer fork/version
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2917
Joined: Sat Nov 18, 2017 6:21 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by MichaIng »

Thanks :).

Now that I know better what it is and how it works, and couldn't find any alternative, I found it quite useful to quickly switch input/output pins via browser, e.g. using the Node-RED web interface on the other tab.
torwan
Posts: 9
Joined: Mon Apr 26, 2021 7:57 pm

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by torwan »

MichaIng wrote: Tue Apr 27, 2021 6:59 pm Thanks :).

Now that I know better what it is and how it works, and couldn't find any alternative, I found it quite useful to quickly switch input/output pins via browser, e.g. using the Node-RED web interface on the other tab.
You know, this was my initial plan, I soldered a header pin on my Pi Zero and just wanted to test some pins with use of Node-Red. It did not work at all, I could not install RPi-GPIO lib as described in another thread. I had no time to troubleshoot so I tried quickly to use WebIOPi but it also did not work...

As I was in a hurry, I quickly switched to Raspberry Pi OS Lite and did my tests within 5 minutes from taking the decision.

I was later checking this whole WebIOPi story and indeed it seems to be quite old. Maybe DietPi should consider removing it or leave some note about incompatibility with Pi Zero. Maybe on Pi 2/ 3 / 4 it will work, who knows, have no time to play too much at the moment.

BTW when you install Node-red with use of:

Code: Select all

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
It asks you if to install automatically GPIO lib which makes sense on RasPi. It could be considered also in DietPi-Software (Optimized).
User avatar
Joulinar
Posts: 4504
Joined: Sat Nov 16, 2019 12:49 am

Re: WebIOPi doe snot work @ DietPi @ Raspberry Pi Zero W

Post by Joulinar »

with next release, DietPi will switch to a different fork of WebIOPi that's working way better

https://github.com/MichaIng/DietPi/pull/4310
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply