2014-06-05 00:59:13 +04:00
|
|
|
directory_server - centralized endpoint behind restofthings.com
|
|
|
|
frontend - some html code to make use of all of the CORS
|
2014-07-21 04:47:15 +04:00
|
|
|
frontend - app that makes calls to directory_server on behalf of current ip
|
2014-06-05 00:59:13 +04:00
|
|
|
slave - code that runs on pi
|
|
|
|
|
2014-07-21 04:47:15 +04:00
|
|
|
|
|
|
|
install Webiopi
|
2014-07-21 04:48:34 +04:00
|
|
|
|
|
|
|
Remove auth
|
|
|
|
|
|
|
|
`sudo rm /etc/webiopi/passwd`
|
2014-06-13 03:14:50 +04:00
|
|
|
|
2014-08-06 03:31:21 +04:00
|
|
|
|
|
|
|
Install pi-gpio
|
|
|
|
|
|
|
|
`sudo apt-get install nodejs npm`
|
|
|
|
|
|
|
|
`git clone git://github.com/quick2wire/quick2wire-gpio-admin.git`
|
|
|
|
|
|
|
|
`cd quick2wire-gpio-admin`
|
|
|
|
|
|
|
|
`make`
|
|
|
|
|
|
|
|
`sudo make install`
|
|
|
|
|
|
|
|
`sudo adduser $USER gpio`
|
|
|
|
|
|
|
|
|
2014-07-21 04:47:15 +04:00
|
|
|
Install and configure nginx:
|
2014-07-21 04:48:03 +04:00
|
|
|
|
|
|
|
`sudo apt-get update`
|
|
|
|
|
|
|
|
`sudo apt-get install nginx`
|
|
|
|
|
2014-07-22 03:30:04 +04:00
|
|
|
`copy default file from pi-config-files to /etc/nginx/sites-*`
|
2014-07-21 04:47:15 +04:00
|
|
|
|
2014-07-22 00:33:05 +04:00
|
|
|
`service nginx start`
|
|
|
|
|
2014-07-21 04:47:15 +04:00
|
|
|
|
2014-07-21 06:22:47 +04:00
|
|
|
Nginx if used as a CORS proxy in this case(nginx will by default run on port `80`).
|
|
|
|
|
2014-08-07 23:53:25 +04:00
|
|
|
Note: if you failed to configure nginx properly and won't start try this:
|
|
|
|
`sudo nginx -t` should test all files and return errors and warnings locations
|
2014-07-21 06:22:47 +04:00
|
|
|
raspicam working example
|
2014-08-06 22:49:23 +04:00
|
|
|
http://blog.miguelgrinberg.com/post/how-to-build-and-run-mjpg-streamer-on-the-raspberry-pi
|
|
|
|
`$ sudo apt-get install libjpeg8-dev`
|
|
|
|
`$ sudo apt-get install imagemagick`
|
|
|
|
`$ tar xvzf mjpg-streamer-r63.tar.gz`
|
|
|
|
`$ cd mjpg-streamer-r63`
|
|
|
|
`$ make`
|
2014-07-21 06:22:47 +04:00
|
|
|
|
|
|
|
At this point we'll try to use as an example the raspicam and mjpg streamer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For starting the camera:
|
|
|
|
|
|
|
|
`$ mkdir /tmp/stream`
|
|
|
|
|
|
|
|
`$ raspistill --nopreview -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &`
|
|
|
|
|
|
|
|
You need to install mjpg streamer:
|
|
|
|
|
|
|
|
http://blog.miguelgrinberg.com/post/stream-video-from-the-raspberry-pi-camera-to-web-browsers-even-on-ios-and-android
|
|
|
|
|
|
|
|
Than run:
|
|
|
|
|
|
|
|
`LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www -p 9999"`
|
2014-06-13 03:14:50 +04:00
|
|
|
|
|
|
|
### Flow
|
|
|
|
* obtain device & plug it into network/power
|
|
|
|
* go to user.restofthings.com to find device listed
|
|
|
|
* Click link to go to dev ui(eg webiopi pinout page)
|
|
|
|
* Assign tags to device
|
|
|
|
* Have home automation software look up device by those tags
|
|
|
|
** Alternative: have some software deployed on one of the devices and do ^
|
|
|
|
* Enjoy
|