WebIOPi : control your Pi’s GPIO with a browser


311 posts   Page 7 of 13   1 ... 4, 5, 6, 7, 8, 9, 10 ... 13
by trouch » Sat Dec 15, 2012 3:23 pm
ronnydm wrote:i have installed also the webiopi service when the system boot
/etc/init.d

when i open the demo.html page with a browser
http://x.x.x.x:8000/demo.html, i have a 404 error

when i stop the service service webiopi stop
then start the python script python3 demo.py &
then it works

what is the difference with the service and the python demo.py script



You have to edit (or copy) /etc/init.d/webiopi and change :
DAEMON_ARGS="-m webiopi $WEBIOPI_PORT"
to
DAEMON_ARGS="/path/to/my/script.py $WEBIOPI_PORT"

remove "-m" and change "webiopi" by your script path.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by sarvinen » Wed Dec 19, 2012 6:25 pm
Hello!
I would like to edit my webiopi control page to look nicer. I founded this: http://code.google.com/p/webiopi/wiki/CUSTOMIZE

BUT, I have no idea what "Start the associated demo.py script in the demo folder" means. So what shold I do to get it work?
Posts: 20
Joined: Sun Oct 28, 2012 10:36 am
by trouch » Wed Dec 19, 2012 6:34 pm
sarvinen wrote:Hello!
I would like to edit my webiopi control page to look nicer. I founded this: http://code.google.com/p/webiopi/wiki/CUSTOMIZE

BUT, I have no idea what "Start the associated demo.py script in the demo folder" means. So what shold I do to get it work?


in the tarball you have a demo folder which include a html file and a python script.
the code given in the wiki page is taken from this html file and requires the demo.py script in order to work (for the macros)

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by trouch » Fri Dec 21, 2012 4:49 pm
WebIOPi 0.5.2 is now available on the Pi Store and includes few fixes from the 0.5.1 release.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by trouch » Fri Dec 21, 2012 5:51 pm

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by voyagerusa » Fri Dec 21, 2012 5:57 pm
Will this update with apt-get update?
Thanks for a great tool for builders like me.
Dave S
VOYAGER
Posts: 6
Joined: Sat Nov 17, 2012 4:23 pm
by trouch » Fri Dec 21, 2012 6:27 pm
voyagerusa wrote:Will this update with apt-get update?
Thanks for a great tool for builders like me.
Dave S
VOYAGER

apt-get update only update the package list, it does not upgrade packages themselves.
apt-get upgrade does upgrade packages.

but no, WebIOPi is not available on the raspbian repository.
it's only available from google code project page or from the PiStore.
you can update using the PiStore

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by rossbell » Wed Dec 26, 2012 11:37 pm
Hi All:
Have installed webiopi, but when I type in localhost:/8000/webiopi/, the login scren comes up I type in the login info but the screen shows nothing, maybe I am using the wrong port address. Any help is appreciated.
thanks Ross Bell
Posts: 1
Joined: Wed Dec 26, 2012 11:18 pm
by trouch » Thu Dec 27, 2012 10:00 am
rossbell wrote:Hi All:
Have installed webiopi, but when I type in localhost:/8000/webiopi/, the login scren comes up I type in the login info but the screen shows nothing, maybe I am using the wrong port address. Any help is appreciated.
thanks Ross Bell


If you have the login prompt, you are trying the good URL/port
Which browser ? Do you have any javascript log ?
How did you stard webiopi ?
Which webiopi version ?

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by ronnydm » Thu Dec 27, 2012 8:25 pm
hello,

i change the script webiopi in /etc/init.d
like you say
DAEMON_ARGS="/var/www/demo.py"

when i reboot the system, i open a browser to x.x.x.x:8000/demo.html
i have a blank screen
when i restart the service service webiopi force-reload
now it work

what do i wrong

regards

ronny
Posts: 4
Joined: Sat Dec 15, 2012 1:03 pm
Location: belgium , mechelen
by trouch » Thu Dec 27, 2012 8:48 pm
which WebIOPi ?
also in the init script, with DAEMON ? (python or python3) ?
There is one issue on webiopi 0.5.2 with python3, fixed in webiopi 0.5.3 (pistore), but now happens with python (2.x).
it's finally totally fixed on the svn, and will be also fixed in the next release which will be available on both google code and pistore.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by ronnydm » Thu Dec 27, 2012 8:56 pm
webiopi 0.5.2
i wait for the next release
Posts: 4
Joined: Sat Dec 15, 2012 1:03 pm
Location: belgium , mechelen
by trouch » Thu Dec 27, 2012 10:07 pm
oops a little misstake in my previous message.
webiopi 0.5.3 does not exist yet, there are :
- 0.5.1 on google code with python3 issue
- 0.5.2 on Pi Store with python2 issue

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by HeavensBlade » Sat Dec 29, 2012 9:17 am
Is it possible to remove the "Update available" on the Homepage?
My pi is just a server so i can't get into the store to install the new version.
Posts: 26
Joined: Fri Aug 03, 2012 10:45 am
by trouch » Sat Dec 29, 2012 7:19 pm
a new version will be released in few days, on both google code and pistore
you will be able to update your install
sorry for that

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by nico_68 » Wed Jan 02, 2013 2:31 pm
Hi,

How to reverse the state of an output :
idle => GPIO to ground (0V)
work => GPIO to 3,3V

This is to control a relay that sticks to the low state.

Thank's
Posts: 5
Joined: Wed Jan 02, 2013 2:27 pm
by electric_bit » Wed Jan 02, 2013 6:31 pm
want to try RESTAPI webiopi server,
but i always get this respond :
401 Unauthorized
with response header:
Server WebIOPi/Python/0.5.1 Python/3.2.3
Date Wed, 02 Jan 2013 13:13:35 GMT
WWW-Authenticate Basic realm="webiopi"


this is my sample code :
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>gpio experiment</title>
<script src="jquery-1.8.3.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
   var server = 'http://192.168.1.10:8000/*';
   var act = 'on';
   var url_rest = server;
   var method = 'GET';
   $("#btn_get").click(function(){
      var gpio_num = $("#gpio_num").val();   
      $.ajax({
            url: url_rest,
            type: method,
            success: function(res)
            {
               $("#box_msg").html(res);
            },
            error: function(xhr, textStatus, errorThrown){
               $("#box_msg").html("<span style='color:red'>"+textStatus+"</span>");
            }
      });
 

   });

});
</script>
</head>
<body>
<h3>LED Experiment</h3>
<table>
   <tr>
      <td><input type="button" name="btn_get" id="btn_get" value="Status GPIO"/></td>
   </tr>

   <tr>
      <td colspan="5">Log: <div id="box_msg" style="border:1px solid black; width:200px;height:50px;"></div></td>
   </tr>
<table>
</body>
</html>

I try to find the documentaion about RESTAPI Authentication, but still don't have any clue.
can you give me an example, about RESTAPI Authentication?
thanks
Posts: 3
Joined: Wed Jan 02, 2013 6:19 pm
by trouch » Wed Jan 02, 2013 11:06 pm
nico_68 wrote:Hi,

How to reverse the state of an output :
idle => GPIO to ground (0V)
work => GPIO to 3,3V

This is to control a relay that sticks to the low state.

Thank's


Sorry, I don't understand what you want to do...


electric_bit wrote:want to try RESTAPI webiopi server,
but i always get this respond :
401 Unauthorized
with response header:
Server WebIOPi/Python/0.5.1 Python/3.2.3
Date Wed, 02 Jan 2013 13:13:35 GMT
WWW-Authenticate Basic realm="webiopi"


I try to find the documentaion about RESTAPI Authentication, but still don't have any clue.
can you give me an example, about RESTAPI Authentication?
thanks


I guess you are not serving the HTML file through WebIOPi webserver ?
You may try http://user:password@host:port/* (by default user=webiopi and password=raspberry)
Or simply serve the HTML file with webiopi :
- add your file in /usr/share/webiopi/htdocs
or
- launch webiopi from a shell or python script in your own folder

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by electric_bit » Thu Jan 03, 2013 10:43 am
sorry double post :roll:
Last edited by electric_bit on Thu Jan 03, 2013 10:45 am, edited 1 time in total.
Posts: 3
Joined: Wed Jan 02, 2013 6:19 pm
by electric_bit » Thu Jan 03, 2013 10:44 am
I guess you are not serving the HTML file through WebIOPi webserver ?

Yes that's true. I create an application with php, and that application want to access RESTAPI WebIOPi.

So I can't access the RESTAPI WebIOPi with other web application?

if is that true, i think the further improvement for your RESTAPI WebIOPi Webserver,
should be accessed outside the WebIOPi Webserver.

thanks for your answer :D
Posts: 3
Joined: Wed Jan 02, 2013 6:19 pm
by nico_68 » Thu Jan 03, 2013 10:53 am
trouch wrote:
nico_68 wrote:Hi,

How to reverse the state of an output :
idle => GPIO to ground (0V)
work => GPIO to 3,3V

This is to control a relay that sticks to the low state.

Thank's


Sorry, I don't understand what you want to do...


Hi,

I add the webiopi scrits in init.d directory for automatically start.

However, I don't know how to initialized the GPIO output in high level (3,3V). Actually, the oupture are initialize in low level (0V).

Have you got a example script ? I am a debutant.

Thank's
Posts: 5
Joined: Wed Jan 02, 2013 2:27 pm
by trouch » Thu Jan 03, 2013 10:59 am
nico_68 wrote:Hi,

I add the webiopi scrits in init.d directory for automatically start.

However, I don't know how to initialized the GPIO output in high level (3,3V). Actually, the oupture are initialize in low level (0V).

Have you got a example script ? I am a debutant.

Thank's


you can find an example server script on http://code.google.com/p/webiopi/wiki/PYTHON
Code: Select all
# First import webiopi
import webiopi
import time

# I use the integrated GPIO lib, but you can use RPi.GPIO
GPIO = webiopi.GPIO

# Instantiate the server on the port 8000, it starts immediately in its own thread
server = webiopi.Server(port=8000, login="webiopi", password="raspberry")

# Init GPIOs
GPIO.setFunction(7, GPIO.OUT)
GPIO.output(7, GPIO.LOW)

# run default loop until CTRL-C is pressed
webiopi.runLoop()

# Stop the server
server.stop()

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by xoanweb » Thu Jan 03, 2013 2:55 pm
How can I customize the web ? I follow a lot of tutorial, but I don`t do it right. Please, help.

Can someone make a video doing it, please ?


Thanking you in advance.
Posts: 1
Joined: Thu Jan 03, 2013 2:53 pm
by trouch » Thu Jan 03, 2013 3:19 pm
xoanweb wrote:How can I customize the web ? I follow a lot of tutorial, but I don`t do it right. Please, help.

Can someone make a video doing it, please ?


Thanking you in advance.


If you really don't understand how it works, take a look in the demo folder.
You'll find a demo.py and a demo.html
just execute the python script :
Code: Select all
sudo python demo.py
then open your browser to http://raspIP:8000/webiopi/demo.html
if it work, remove all unwanted controls and code, then copy what you need to reproduce it.

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
Posts: 308
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
by Piminiuser » Thu Jan 03, 2013 6:22 pm
Hi,

I am also bussy with the demo.py and demo.html.

the demo.py have a led toggle on/off 5 seconds.
I only want 1 on/off switch of port 17.

So i opened the demo.py and delited

"try:
while True:
GPIO.output(7, not GPIO.input(7))
time.sleep(5)
"

But then i get an error on
except KeyboardInterrupt:
pass

What is wrong here? I dont want the 5 seconds toggle, i only want 1 big button to switch gpio 17 on/off.
www.raspberrypihelp.net - A list of tutorials and more!
Posts: 62
Joined: Wed May 30, 2012 1:15 pm