#Import the library
import MySQLdb
#import time as wait
import RPi.GPIO as GPIO
import subprocess
import dbconnection
import time
from subprocess import call

GPIO.setwarnings(False)

dbhost = dbconnection.dbhost()
dbuser = dbconnection.dbuser()
dbpasswd = dbconnection.dbpasswd()
dbname = dbconnection.dbname()
db = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpasswd, db=dbname)
global start
debug = 0
start = 1


def run_sched():
    global setup
    global start
    try:
        if (setup == 0):
            donothing = ""
    except:
        global sunrise
        global morning
        global daytime
Example #2
0
#Import the library
import sys
import MySQLdb
import time as wait
import RPi.GPIO as GPIO
import dbconnection

GPIO.setwarnings(False)

dbhost = dbconnection.dbhost()
dbuser = dbconnection.dbuser()
dbpasswd = dbconnection.dbpasswd()
dbname = dbconnection.dbname()
db = MySQLdb.connect (host = dbhost, user= dbuser, passwd=dbpasswd,db = dbname)
curs = db.cursor()


curs.execute ('SELECT * FROM codes WHERE code = "relaypolarity"')
results = curs.fetchall()
for row in results:
        polarity=row[2]
	polarity=int(polarity)

print "polarity:" ,polarity
if polarity == 1:
 truestate=1
 falsestate=0
 print "Relay in Active HIGH Mode"
else:
 truestate=0
 falsestate=1