From f0883741f179018aa9271556d367c6b91eb99e5b Mon Sep 17 00:00:00 2001 From: Dan-in-CA Date: Sat, 31 Aug 2013 12:20:37 -0700 Subject: [PATCH] Aug. 30 2013 update. See README.md --- README.md | 7 +++++++ ospi.py | 12 +++++++----- ospi.sh | 4 ++-- static/scripts/java/svc1.8.3/home.js | 8 +++++++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 14018c1..39f32e0 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,13 @@ UPDATES =========== *********** +August 30 2013 +-------------- +Additions, bug fixes:
+1. Modified the program to use only the time zone setting from the Options page and not the tz setting from the py. +2. Made the CPU temperature readout on the home page clickable to toggle between C and F. +3. Added a copy of Denny Fox's init.d auto startup script + August 25 2013 -------------- Additions, bug fixes:
diff --git a/ospi.py b/ospi.py index 0a50edd..de1545b 100644 --- a/ospi.py +++ b/ospi.py @@ -1,5 +1,5 @@ #!/usr/bin/python -"""Updated 25/August/2013.""" +"""Updated 30/August/2013.""" import re, os, json, time, base64, thread # standard Python modules import web # the Web.py module. See webpy.org (Enables the OpenSprinkler web interface) import gv # 'global vars' An empty module, used for storing vars (as attributes), that need to be 'global' across threads. @@ -88,7 +88,8 @@ def log_run(datetime): else: pgr = str(gv.lrun[1]) datastr = (pgr +', '+str(zones[gv.lrun[0]])+', '+str(gv.lrun[2]/60)+'m'+str(gv.lrun[2]%60)+ - 's, '+time.strftime("%H:%M:%S, %a. %d %b %Y", time.localtime(datetime))+'\n') + 's, '+time.strftime("%H:%M:%S, %a. %d %b %Y", time.gmtime(datetime+((gv.sd['tz']/4)-12)*3600))+'\n') + #lt = time.gmtime(now+((gv.sd['tz']/4)-12)*3600) f = open('./static/log/water_log.csv', 'r') log = f.readlines() f.close() @@ -105,7 +106,7 @@ def prog_match(now, prog): """Test a program for current date and time match.""" if not prog[0]: return 0 # Skip if program is not enabled devday = int(now/86400) # Check day match - lt = time.localtime(now) + lt = time.gmtime(now+((gv.sd['tz']/4)-12)*3600) if (prog[1]>=128) and (prog[2]>1): #Inverval program if (devday %prog[2]) != (prog[1] - 128): return 0 else: # Weekday program @@ -166,7 +167,7 @@ def main_loop(): # Runs in a seperate thread match = 0 now = time.time() if gv.sd['en'] and not gv.sd['mm'] and (not gv.sd['bsy'] or not gv.sd['seq']) and not gv.sd['rd']: - lt = time.localtime(now) + lt = time.gmtime(now+((gv.sd['tz']/4)-12)*3600) if (lt[3]*60)+lt[4] != last_min: # only check programs once a minute last_min = (lt[3]*60)+lt[4] for i, p in enumerate(gv.pd): # get both index and prog item @@ -555,6 +556,7 @@ class change_options: if vstr.find("Sequential:") == -1: ### Temp fix for upgrade bug os.remove("./data/options.txt") vstr = data('options') + ops = vstr.index('[')+1 ope = vstr.index(']') optstr = vstr[ops:ope] @@ -963,7 +965,7 @@ class toggle_temp: gv.sd['tu'] = "F" else: gv.sd['tu'] = "C" - jsave(gv.sd, 'sd') + jsave(gv.sd, 'sd') raise web.seeother('/') diff --git a/ospi.sh b/ospi.sh index 44574d0..7d52a80 100644 --- a/ospi.sh +++ b/ospi.sh @@ -31,11 +31,11 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Open Sprinkler Raspberry Pi" HOST=$(hostname -I | sed 's/ *$//g') -PORT=:80 # Edit if different on your system +PORT=:8080 # Edit if different on your Raspberry Pi NAME=ospi.py DAEMON=/usr/bin/python DAEMON_ARGS="ospi.py $HOST$PORT" -HOMEDIR=/home/pi/OSPi/ # Edit if different on your system +HOMEDIR=/home/pi/OSPi/ # Edit if different on your Raspberry Pi PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME diff --git a/static/scripts/java/svc1.8.3/home.js b/static/scripts/java/svc1.8.3/home.js index 205a09f..bd285e0 100644 --- a/static/scripts/java/svc1.8.3/home.js +++ b/static/scripts/java/svc1.8.3/home.js @@ -14,6 +14,11 @@ function datestr(t) {var _t=tz-48; return (new Date(t)).toUTCString()+((_t>=0)?" // raspi CPU temp unit function toggle(form) {form.elements[0].value=tempunit;form.submit();} w("
"); +function bluebg(heat){ +heat.style.backgroundColor='lightblue';} +function nobg(heat){ +heat.style.backgroundColor='transparent';} + // print menu links w(""); w(""); @@ -26,7 +31,8 @@ if(ver>=100) w("Firmware version: "+(ver/100>>0)+"."+((ver/10>>0)%10)+"." else w("Firmware version: "+(ver/10>>0)+"."+(ver%10)+"
"); w("Device time: "+datestr(devt*1000)+"
"); if (typeof cputemp === 'undefined') cputemp=""; -w("CPU Temp: "+cputemp+"°"+tempunit+"
"); + +w("CPU Temp: "+cputemp+"°"+tempunit+"
"); w(""); // print status and other information w("
Operation: "+(en?("on").fontcolor("green"):("OFF").fontcolor("red")));