Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions firebase/Installation_steps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--------------------------Firebase--------------------------------

Steps to be followed:

1) Install Firebase in Raspberry Pi
i) sudo pip install requests==1.1.0
ii) sudo pip install python-firebase //if pip fails try pip3 or use easy_install

2) Install DHT Python Library
i) git clone https://github.com/adafruit/Adafruit_Python_DHT.git
ii) cd Adafruit_Python_DHT
iii) sudo apt-get install build-essential python-dev python-openssl
iv) sudo python setup.py install

if any problem with those installation please run the following commands first

i)sudo apt-get update
ii)sudo apt-get upgrade

if any problem with python-pirebase

1) sudo apt-get remove python-pip
2) sudo easy_install pip
43 changes: 43 additions & 0 deletions firebase/light_firebase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import RPi.GPIO as GPIO
from time import sleep
import datetime
from firebase import firebase


import urllib2, urllib, httplib
import json
import os
from functools import partial

GPIO.setmode(GPIO.BCM)
GPIO.cleanup()
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)

firebase = firebase.FirebaseApplication('https://YOUR-FIREBASE-URL.firebaseio.com', None)
#firebase.put("/Control", "/device1", "on")

def updatePiInfo():
result = firebase.get('/Control', '/device1')
print result

if ( result == "on" ):
print "Lights on"
GPIO.output(18,GPIO.HIGH)
else :
if ( result == "off" ):
print "Lights off"
GPIO.output(18,GPIO.LOW)


#firebase.post("/Control/device1", "off")
firebase.put("/Control", "/device1", "off")

while True:
updatePiInfo()
#firebase.put("/Control", "/device1", "off")

#Retrieve sleep time from firebase and continue the loop
#sleepTime = firebase.get("/Settings/info_update_time_interval", None)
#sleepTime = int(sleepTime)
sleep(1)
1 change: 1 addition & 0 deletions icsp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Will be working on the communication protocol