Giter VIP home page Giter VIP logo

glance's Introduction

glance

Installation Instructions

  1. Download the latest Kivypie and install to SD card. Insert into RPI, connect to the network and powerup!

  2. Upgrade to latest versions of the packages

sudo apt-get update sudo apt-get dist-upgrade -y

Then test Kivy is working OK - run the simple example from https://kivy.org/#home

sudo nano test.py and paste in the following (between the ---).


from kivy.app import App from kivy.uix.button import Button

class TestApp(App): def build(self): return Button(text='Hello World')

TestApp().run()


Then run with

sudo python test.py

You should see a big “Hello World button”. Push it, it should change colour when pressed.

Hit ctrl + C to exit the app.

  1. Install Mosquito MQTT for the communications.

Use this…. sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list sudo apt-get install mosquitto sudo apt-get install mosquitto-clients -y also sudo pip install --upgrade pip sudo pip install paho-mqtt Test Mosquito Subscribe to a test topic in one SSH window mosquitto_sub -t test_topic Send a test message on the test topic in another SSH window. mosquitto_pub -t test_topic -m "Hello"

  1. Install SQLite3 for the database.

sudo apt-get install sqlite3

  1. Install and test Apache for the web server and PHP for the server side web page processing.

sudo apt-get install apache2 -y

sudo apt-get install libapache2-mod-php5 -y

sudo apt-get install php5-sqlite

Make sure you give permissions for the web folder. sudo chown www-data:www-data -R /var/www/html

Test the web server is working – from a browser on your network try

http:///index.html

You should see an Apache web page appear.

After test, delete the test file

sudo rm /var/www/html/index.html

reboot the Raspberry Pi

sudo reboot

  1. Copy the python source files and web source files to the /home/sysop/Glance and /var/www/html/GlanceWeb folders respectively. Also copy Clock, Music, Pictures and Inspiration sub-folders and contents and create the logs subfolder.

a) Install source modules and dependencies.

From /home/sysop/

git clone https://github.com/peterjhk1/Glance.git

b) Install web pages and database

cd /var/www/html/

sudo git clone https://github.com/peterjhk1/GlanceWeb.git

  1. Configure the Raspberry Pi sudo raspi-config

Set the pi hostname to ‘bedroomtouch’ Set the timezone as required Select ‘wait for network at boot’ Activate I2C (under interface options)

  1. Install ALL the required dependencies

a) For the Calendar module

https://developers.google.com/calendar/quickstart/python sudo pip install --upgrade google-api-python-client Install timezone and dateutil module

sudo pip install pytz sudo pip install python-dateutil

       To authorize the script for your calendar for the first time, follow the instructions for the secret json file and create and run

sudo python google_quickstart.py --noauth_local_webserver

b) For the BMP180 module https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi/using-the-adafruit-bmp-python-library c) For the Audio module For translating numbers to words cd .. sudo git clone https://github.com/pwdyson/inflect.py.git

d) For the Hk Weather sudo pip install feedparser

  1. Customize the database The database file is /var/www/html/GlanceWeb/clp.db cd /var/www/html/GlanceWeb/ Type sudo sqlite3 clp.db select * from settings select * from messages

'HUE user and HUB IP insert into settings (setting,value) VALUES ('hueuser', ''); insert into settings (setting,value) VALUES ('huehubip', '');

'TP Link HS100 socket IP addresses insert into settings (setting,value) VALUES ('hs100ip0', ''); insert into settings (setting,value) VALUES ('hs100ip1', ''); insert into settings (setting,value) VALUES ('hs100ip2', '');

'Air Quality token from WAQI insert into settings (setting,value) VALUES ('WAQItoken', '');

'Stock quote and currency exchange value from Aphavantage insert into settings (setting,value) VALUES ('alphavantageapikey', ''); insert into settings (setting,value) VALUES ('alphavantagestock1', 'MSFT'); insert into settings (setting,value) VALUES ('alphavantagefromcurrency1', 'USD'); insert into settings (setting,value) VALUES ('alphavantagetocurrency1', 'JPY');

'For RPIIO - insert into settings (setting,value) VALUES ('rpiioout1', '21'); insert into settings (setting,value) VALUES ('rpiioout2', '6'); insert into settings (setting,value) VALUES ('rpiioin1', '4'); insert into settings (setting,value) VALUES ('rpiioin2', '17');

insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOOUT','1+','LED 1 On','0','1'); insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOOUT','1-','LED 1 Off','0','1'); insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOOUT','2+','LED2 On','0','1'); insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOOUT','2-','LED2 Off','0','1'); insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOIN1','','Switch 1','1','0'); insert into messages (host, name, value, description, display,action) values ('Bedroom Touchscreen','RPIIOIN2','','Switch 2','1','0');

insert into settings (setting,value) VALUES ('nighttime', '23:00'); insert into settings (setting,value) VALUES ('morningtime', '6:00'); insert into settings (setting,value) VALUES ('afternoontime', '12:00'); insert into settings (setting,value) VALUES ('eveningtime', '19:00');

insert into messages (host, name, value, description, display,action) values ('','If Morning','if','If Morning','0','1'); insert into messages (host, name, value, description, display,action) values ('','If Afternoon','if','If Afternoon','0','1'); insert into messages (host, name, value, description, display,action) values ('','If Evening','if','If Evening','0','1'); insert into messages (host, name, value, description, display,action) values ('','If Night','if','If Night','0','1');

Note that a restart may be necessary after the database update.

  1. To make the system autorun at boot, sudo nano /etc/rc.local Add the lines (before exit 0) cd /home/sysop/Glance/ sudo python launcher.py &

glance's People

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.