Git Product home page Git Product logo

piui's Introduction

piui

Add a UI to your standalone Raspberry Pi project using your Android or iOS phone

Demo

Watch Demo Video

Demo Video Screengrab

Install PiUi

pip install piui

Setup Instructions (to prepare your Raspberry Pi)

The easy way (using a pre-prepared SD card image)

Download the piui_plus_examples.zip file from github.com/dps/piui-sdcards. Unzip it and you'll find a 4Gb sd card image named piui_plus_examples.img. Write it to an SD card by following the usual Raspberry Pi instructions. At present, this image is based on Occidentalis 0.2.

Assuming you have the same wifi adapter I do, this will work out of the box. If not, read the Pi-Point docs to configure for your own hardware.

On first boot, you can sync the latest piui source with:

cd piui
git pull origin

and start the demo app with:

python piui_demo.py

The do-it-yourself way

Start with the latest release of Raspbian or (better as it's ready for hardware projects) Occidentalis.

Follow the Pi-Point documentation to turn your Pi into a wifi access point. Note that if you use the Adafruit wifi adapter, these instructions do not work in full as the nl80211 driver does not support that device (which uses a Realtek chipset). This blog post explains how to make it work - thanks Paul!

Add an entry to /etc/hosts mapping the DNS name piui to the address you configured for the Pi in the step above. Assuming it's 192.168.1.1, then you should add the following to /etc/hosts

192.168.1.1     piui

Install nginx - nginx is an HTTP server and reverse proxy, we use it to multiplex requests to your app and the piui-supervisor.

sudo apt-get install nginx

Configure nginx using the config file in the PiUi github repo - copy this to /etc/nginx/nginx.conf and restart nginx.

sudo /etc/init.d/nginx restart

Get the piui source code from github

cd /home/pi
git clone https://github.com/dps/piui.git

Arrange for the piui-supervisor to run on boot.

sudo cp /home/pi/piui/supervisor/piui-supervisor /etc/init.d
sudo update-rc.d piui-supervisor defaults

Done! Run the demo app:

cd piui
python piui_demo.py

Connect your phone to the wifi AP and navigate to 'http://piui/'.

Known limitations / work in progress

  • only works for one concurrently connected phone right now
  • upon reconnection, all historical updates to page elements are made in sequence - should collapse updates to the same element

Copyright and License (BSD 2-clause)

Copyright (c) 2013, David Singleton All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

piui's People

Contributors

dps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piui's Issues

Error when running piui_demo.py

I get the following error:
AttributeError: 'module' object has no attribute '_global_conf_alias'

This is on Raspbian.

Any ideas?

Thanks
Leo

PiUi demo script slowly dies

Hi, thanks for this awesome project.
I have been working with it and it has been doing everything I want but I have found that it will slowly degrade in performance then fail completely. I thought it might be my template so I tried the demo.py and found that if you go into and out of all of the menus then run the console demo things start to stop responding, back buttons stop working to the point that the script just appears to hang.
I can connect to CherryPy on port 9000 and it throws an error page saying not found, but it is being generated by CherryPy so it is still running, also I can leave the Supervisor running in-between starting the demo.py and it works as expected. If I kill and restart the demo script everything is back to normal.
I have tested with android, Chrome on pc and Ipad with the same results (restarting the script in between connections).
I also tried the manual steps to install on raspbian, then your pre made image with the same results.
Is there anything I can do to help diagnose the issue ?

Piui without access point integration

Hi. I used it without an access point, but the Android app cannot find it. Also, it would be nice just to be able to enter the webadress of my raspberrypi, already using ddns so i could use piui when i am not at home.
Could you also give a better documentation, of what you have done at all with piui and how it works.
For understanding and maybe even improving.
I am not so good at coding, but this might be a shot for me.

Thanks

change app url

I tried changing nginx.conf piui server to 192.168.4.1:8080, then copying the file to /etc/nginx and restarting nginx thru init.d. I also tried changing piui/init.pyPiUi class port to the same url and then rebuilding/reinstalling thru setup.py. This only works for files in the basepiui` directory, but still no luck for files that are in other directories. I also tried rebooting after all of this and still nothing. Any words of wisdom or ways to pass in url as an argument?

does it live?

I can't find any good, simple, extensible solutions such as this. David, any plans to update?

do it yourself

i followed the instructions and tried to run the demo.
the python crashes when trying to initialize the http server.
it seems that the nginx has bind the ip 0.0.0.0 with port 9999 and the python demo is trying to reuse it.

does this project still being updated?

piui_demo.py works just for a while.

Hello, I installed piui the do-it-yourself way. I configured the init.py file so it now uses directly port 80, buty I have to start the demo with sudo because normal users don't have permission to use port 80.
I did that to access piui just putting the Rasp IP on the browser.
The thing is, after I start the demo script, I am able to access the piui interface, but after pushing some buttons, it starts to get sticky, until it is completely unusable and I have to kill the executing code and run it again to be able to access.

I guess this is the normal whay piui do things:

When I start to run the script, it displays this on the terminal:
pi@raspberrypi:/home/piui $ sudo python piui_demo.py [17/Jul/2016:21:40:04] ENGINE Listening for SIGHUP. [17/Jul/2016:21:40:04] ENGINE Listening for SIGTERM. [17/Jul/2016:21:40:04] ENGINE Listening for SIGUSR1. [17/Jul/2016:21:40:04] ENGINE Bus STARTING [17/Jul/2016:21:40:04] ENGINE Started monitor thread 'Autoreloader'. [17/Jul/2016:21:40:04] ENGINE Started monitor thread '_TimeoutMonitor'. [17/Jul/2016:21:40:04] ENGINE Serving on http://0.0.0.0 [17/Jul/2016:21:40:04] ENGINE Bus STARTED

It stays that way until I access piui, when I open piui, it starts to output this:
192.168.1.100 - - [17/Jul/2016:21:40:50] "GET /static/app.html HTTP/1.1" 200 1924 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" 192.168.1.100 - - [17/Jul/2016:21:40:50] "GET /static/jquery-1.9.0.min.js HTTP/1.1" 304 - "http://192.168.1.40/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" 192.168.1.100 - - [17/Jul/2016:21:40:50] "GET /static/ratchet.css HTTP/1.1" 304 - "http://192.168.1.40/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" 192.168.1.100 - - [17/Jul/2016:21:40:50] "GET /static/ratchet.js HTTP/1.1" 304 - "http://192.168.1.40/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" 192.168.1.100 - - [17/Jul/2016:21:40:50] "GET /static/piui.js HTTP/1.1" 304 - "http://192.168.1.40/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" Page Reload 9/9

After that, if I navigate on the site, it eventually starts to get stuck.

  • Sometimes, it takes some seconds to respond.
  • The "Back" button stops working.
  • Pages are loaded partially or take too long to respond.

I guess it is the same ploblem other dude reported.
I am using Raspbian Jessie on a Raspberry Pi 2.

I noticed that sometimes, when it gets unstuck, it outputs something different on the terminal:
`[17/Jul/2016:21:44:12] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in call
self.body = self.oldhandler(_args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in call
return self.callable(_self.args, *_self.kwargs)
File "/home/piui/piui/init.py", line 89, in click
self._current_page_obj.handle_click(eid)
File "/home/piui/piui/init.py", line 310, in handle_click
button = self._clickables[eid]
KeyError: u'li_5303992264646282'

[17/Jul/2016:21:44:12] HTTP
Request Headers:
REFERER: http://192.168.1.40/
HOST: 192.168.1.40
CONNECTION: keep-alive
Remote-Addr: 192.168.1.100
ACCEPT: /
USER-AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
X-REQUESTED-WITH: XMLHttpRequest
ACCEPT-LANGUAGE: es-ES,es;q=0.8
ACCEPT-ENCODING: gzip, deflate, sdch
192.168.1.100 - - [17/Jul/2016:21:44:12] "GET /click?eid=li_5303992264646282 HTTP/1.1" 500 1492 "http://192.168.1.40/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
[17/Jul/2016:21:44:12] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in call
self.body = self.oldhandler(_args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in call
return self.callable(_self.args, *_self.kwargs)
File "/home/piui/piui/init.py", line 89, in click
self._current_page_obj.handle_click(eid)
File "/home/piui/piui/init.py", line 310, in handle_click
button = self._clickables[eid]
KeyError: u'li_6117838461521958'`

Toggles not working

Although all the other pages in piui_demo.py work, The Toggle page does not work. The page renders with all the switches, but click on any of them doesn't change anything.

image

Feature request: PiUi without nginx?

CherryPi seems to provide it's own webserver. Would it be possible to run PiUi without nginx and without turning the Pi into an access point and rather have it available in the local network?

Run piui_demo.py at boot time

I only have my RPi since yesterday and I'm very new to the python, so this may be a stupid question/issue.

I'm would like to start the piui_demo.py (or any other .py I want to create) at boot time. My guess was that the supervisour should start it as long as it's in the .conf file, but it isn't starting. I don't see a place to check logs.

When I start it from the command line it all works fine (and is looking very good also !).

JAVA - no such method error when running on API < 11

Installed the application on a phone with API version < 11.

Application will crash on calling getActionBar(), in MainActivity.java, line 74.

Solutions: set min API to 11, or use libraries ActionBarSherlock / ActionBarCompatibiliy.

[Feature Request] Sliders, start values

Hi there,

I'm going to start a project with piui and for some settings I need sliders. Could you add them in the near future?
Also, how do I set start values for text boxes, toggles and the (hopefully soon added) sliders?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.