#!/usr/bin/env python

import MySQLdb
#import datetime
#import urllib2
#import os
import datetime
  
servername = "localhost"
username = "pi"
password = "password"
dbname = "pi_heating_db"

now = datetime.datetime.now()

cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname)


cursorselect = cnx.cursor()

# Check schedule time and date

query = ("SELECT * FROM schedules WHERE enabled ='1';")
cursorselect.execute(query)
  
results_schedules =cursorselect.fetchall()
cursorselect.close()
  
for result in results_schedules:
  SCHED_ID = result[0]
  SCHED_START = result[1]
  SCHED_END = result[2]
  
  SCHED_MON = result[3]
  SCHED_TUE = result[4]
  SCHED_WED = result[5]
  SCHED_THU = result[6]
  SCHED_FRI = result[7]
  SCHED_SAT = result[8]
  SCHED_SUN = result[9]

  print( SCHED_ID )
  print( now )
  print( SCHED_START )
  print( SCHED_END ) 

# Check sensor values

# Check modes

# Check timers



cnx.commit()
cnx.close()

@@ -212,16 +212,28 @@
 me.now()
+.timestamp()
 %0A%0Acnx = 
@@ -604,17 +604,17 @@
  result%5B
-1
+2
 %5D%0A  SCHE
@@ -624,25 +624,25 @@
 ND = result%5B
-2
+3
 %5D%0A  %0A  SCHED
@@ -651,25 +651,25 @@
 ON = result%5B
-3
+4
 %5D%0A  SCHED_TU
@@ -671,33 +671,33 @@
 ED_TUE = result%5B
-4
+5
 %5D%0A  SCHED_WED = 
@@ -695,33 +695,33 @@
 ED_WED = result%5B
-5
+6
 %5D%0A  SCHED_THU = 
@@ -719,33 +719,33 @@
 ED_THU = result%5B
-6
+7
 %5D%0A  SCHED_FRI = 
@@ -743,33 +743,33 @@
 ED_FRI = result%5B
-7
+8
 %5D%0A  SCHED_SAT = 
@@ -767,33 +767,33 @@
 ED_SAT = result%5B
-8
+9
 %5D%0A  SCHED_SUN = 
@@ -799,17 +799,18 @@
  result%5B
-9
+10
 %5D%0A%0A  pri

Update process-schedules.py