WebIOPi not working after reboot

913 views
Skip to first unread message

Kevin Bright

unread,
Jun 26, 2016, 10:08:02 AM6/26/16
to WebIOPi
I've had a RP running WebIOPi controlling some stuff in my backyard for a few years now... the power went out about two weeks ago and it corrupted by SD card, so I had to start all over again.  I have no idea how I got this up and running so easily last time because this time it's taken me FOREVER to get everything set up.  Anyway, I created the custom index.html and script.py files using the tutorial and got the "Light" button working.  I then added some additional buttons to control other stuff and had everything working this morning.  The last thing I wanted to do was to change the default state of the GPIO pins to OUT.  To test if they were already set to OUT by my prior code edits, I did a reboot to see what state they were in after.  

After the reboot, the WebIOPi webpage (192.168.1.10:8000) stopped working.  I can't get to any of the other pages either (i.e., 192.168.1.10:8000/app/gpio-list.  I've tried restarting the service, stopping the service and then manually restarting, nothing's working.  I'm really annoyed because I finally got everything working, and now it's all f-ed!  

Anyway, I'm not expert in this, so can someone give me some basic trouble shooting steps to see if I can get this resolved.  I have some coding experience creating Android apps, but I know next to nothing about python, html, css, etc.  

Thanks, 

Kevin

Kevin Bright

unread,
Jun 26, 2016, 10:10:00 AM6/26/16
to WebIOPi
I should add that the Raspberry Pi is working and I can SSH into without a problem... it's only the WebIOPI aspect that's not working.  

Toshi Bass

unread,
Jun 26, 2016, 1:54:07 PM6/26/16
to WebIOPi
Sorry to hear you lost everything on power cut, I hate it when that happens,  learnt my lesson the hard way as well, now I make backups manually and automatically as well.

So first thing I assume you modified the config file to load your script.py file so first thing to check is if the python file is being loaded and if there.s any problem there.

in your ssh window start webiopi with  sudo webiopi -d -c /etc/webiopi/config   check for a line that says ......

 2016-06-26 18:00:02 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config

and then check if any errors show up

if that appears to be working in the chrome browser  ctrl+shift+j to open the javascript console and look if any errors show up 

if you need more help post you script.py html file advise if you using jessie which pi version etc 

Kevin Bright

unread,
Jun 26, 2016, 5:00:11 PM6/26/16
to WebIOPi
Thanks...  the funny thing is I had just upgraded to the latest version that fixed a lot of the connectivity problems I was having before everything crashed... it was rocks-solid, lol.  

I typed the command you said to type and I did locate a line that said:

pi@raspberrypi:~ $ 2016-06-26 20:54:02 - WebIOPi - INFO - Loading configurati                   onfig 

Sot that seems to be working.  At the end of the output, I get this error message: 

GPIO.setFunction(OVERHEADLIGHTS, GPIO.OUT)
       ^
SyntaxError: invalid syntax

Not sure what syntax error it is referring to...  Should I add a semicolon? 

Kevin

Kevin Bright

unread,
Jun 26, 2016, 5:09:19 PM6/26/16
to WebIOPi
I figured out the syntax error... it was in script.py file, but it was the line before the line shown (I forgot a close paren).  I fixed that but it's still not working. I'll try debuggin in chrome later. 

Kevin

Kevin Bright

unread,
Jun 26, 2016, 8:31:37 PM6/26/16
to WebIOPi
What does this command do:

sudo webiopi -d -c /etc/webiopi/config

Because it's kind of weird but the only time webiopi works is when I run that command and then keep the console window open.  When I run that command and keep the console window open, everything works fine, but when I close the console window, it stops working.  

Kevin

On Sunday, June 26, 2016 at 1:54:07 PM UTC-4, Toshi Bass wrote:

Toshi Bass

unread,
Jun 26, 2016, 10:52:41 PM6/26/16
to WebIOPi
sudo webiopi -d -c /etc/webiopi/config starts webiopi in debug mode .. It sends debug info to the console to help you debug your code, when you start webiopi in the normal background mode the debug info is sent to a log file var/log/webiopi .... It's correct when you close the console window or press Ctrl+c.webiopi stops

The idea is you debug your code to get it working without error then run in background

Kevin Bright

unread,
Jun 27, 2016, 8:20:53 AM6/27/16
to WebIOPi
Thanks for your help on this... I understand that debug mode will stop when you close the console window, but the problem is when I then start webiopi manually via the start command, it does not work. I get a "refused connection" error, so it's like it only works in debug mode.

Any idea why?

Toshi Bass

unread,
Jun 27, 2016, 11:06:14 AM6/27/16
to WebIOPi
How are you starting webiopi in background mode ? 
Are you using Jessie ?
Which pi model are you using ?

Check the log file for errors

Kevin Bright

unread,
Jun 27, 2016, 9:52:26 PM6/27/16
to WebIOPi
To start webiopi I use: 
sudo /etc/init.d/webiopi start

I don't know what Jessie is. 

The webpage only works when I enter debug mode via: 

sudo webiopi -d -c /etc/webiopi/config 

Once that starts, the webpage works, all of my buttons show up and they all work perfectly.  Once I stop debugging mode either by closing the console window or Ctl C, everything stops working, even if I manually restart again using the start command from above.  

I don't see any errors.  Here's the output from debugging mode.  I stopped it because if I didn't, I would just keep repeating over and over and over:  

pi@raspberrypi:~ $ sudo webiopi -d -c /etc/webiopi/config
2016-06-28 01:46:07 - WebIOPi - INFO - Starting WebIOPi/0.7.1/Python3.4
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET /GPIO/count
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET /GPIO/%(channel)d/value
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST /GPIO/%(channel)d/value/%(value)d
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST GET /GPIO/%(channel)d/function
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET /GPIO/%(channel)d/pulse
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST POST /GPIO/%(channel)d/sequence/%(args)s
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET /GPIO/*/integer
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST /GPIO/*/integer/%(value)d
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST /GPIO/%(channel)d/pulse/
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST /GPIO/%(channel)d/pulseAngle/%(value)f
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST /GPIO/%(channel)d/pulseRatio/%(value)f
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST POST /GPIO/%(channel)d/function/%(value)s
2016-06-28 01:46:07 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET /GPIO/*
2016-06-28 01:46:07 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2016-06-28 01:46:07 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config
2016-06-28 01:46:07 - WebIOPi - INFO - Loading myproject from /home/pi/myproject/python/script.py
2016-06-28 01:46:07 - WebIOPi - INFO - Passwd file /etc/webiopi/passwd is empty
2016-06-28 01:46:07 - WebIOPi - WARNING - Access unprotected
2016-06-28 01:46:07 - WebIOPi - INFO - HTTP Server binded on http://192.168.1.10:8000/
2016-06-28 01:46:07 - WebIOPi - INFO - CoAP Server binded on coap://192.168.1.10:5683/
2016-06-28 01:46:07 - WebIOPi - INFO - CoAP Server binded on coap://224.0.1.123:5683/ (MULTICAST)
2016-06-28 01:46:10 - HTTP - DEBUG - "GET / HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /webiopi.js HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /webiopi.css HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /jquery.js HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /map HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /version HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:11 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:12 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:12 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:12 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:12 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:13 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:13 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:13 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:13 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:13 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:14 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:14 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:14 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
2016-06-28 01:46:14 - HTTP - DEBUG - "GET /* HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.6 <Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36>)
^C2016-06-28 01:46:14 - WebIOPi - INFO - Stopping...
2016-06-28 01:46:14 - WebIOPi - DEBUG - Closing device GPIO - GPIO
2016-06-28 01:46:14 - WebIOPi - INFO - CoAP Server stopped
2016-06-28 01:46:14 - WebIOPi - INFO - HTTP Server stopped



 

Kevin Bright

unread,
Jun 27, 2016, 10:01:48 PM6/27/16
to WebIOPi
Ok....  the saga continues.  I decided to try to stop the service after exiting debugging mode before starting it and that seems to have worked.  Everything is working now, so I guess I just needed to exit debug mode AND THEN STOP THE SERVICE before starting it.  I was just exiting debugging mode and then starting the service, which wasn't working. 

Kevin

Toshi Bass

unread,
Jun 28, 2016, 5:02:17 AM6/28/16
to WebIOPi
If you installed or updated recently which I think you did, I am guessing your os is jessie as your using python 3.4 
enter   cat /etc/os-release  to be sure.

Jessie does not use  init; therefore, the script  /etc/init.d/webiopi  does not work correctly, you need to follow this link  ...

Then you need to use :

sudo webiopi -d -c /etc/webiopi/config   // to debug
sudo systemctl start webiopi                // to start in background
sudo systemctl stop webiopi                // stop 
sudo systemctl enable webiopi             // to start at boot
sudo systemctl disable webiopi            // to cancel start at boot 
tail -f -n 50 /var/log/webiopi                  // view running log info

Kevin Bright

unread,
Jun 28, 2016, 8:24:55 AM6/28/16
to WebIOPi
Thanks again for all of your help...  everything is working now.  It looks like I just needed to stop the service after exiting debugging mode before restarting it.  Once I did that, everything started working correctly.  

Peter Merchant

unread,
Oct 28, 2016, 4:26:51 PM10/28/16
to WebIOPi
Thanks also to the responders here. Exactly the problem that I was having, and finding a heading for it took some time. Now I have looked into the logfile I am sure that I can fix the problem.

Cheers all,

trilaci...@gmail.com

unread,
Feb 20, 2017, 2:16:21 AM2/20/17
to WebIOPi
So you got it working in the autostart mode? (using the command: sudo update-rc.d webiopi defaults)

Peter Merchant

unread,
Feb 20, 2017, 3:14:43 AM2/20/17
to web...@googlegroups.com
yes. No problem, aside from having to logon to the web page every time. 

Peter M. 

Interestingly I have discovered that since November 2016 ssh has been disabled at startup of a new OS installation. That's held me back for awhile.


Peter Merchant C.Eng (Ret'd) 




--
You received this message because you are subscribed to a topic in the Google Groups "WebIOPi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/webiopi/qXc8hABjT94/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webiopi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages