Skip to content

Commit

Permalink
logging more stuff to the proper log and removed sys exit so the cron…
Browse files Browse the repository at this point in the history
… can run the commnad functions
  • Loading branch information
eric committed Apr 10, 2016
1 parent 1ebdbb9 commit 9618c13
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions wsp_control/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PROBE_OUT = ('28-000004bdb407', -0.188, 'Out') # HK2
PROBE_AIR = ('28-000004f230a3', 0, 'Air') # UK1

API = 'http://wottonpool.co.uk/panel/input'
API = 'https://wottonpool.co.uk/panel/input'
TEMP_ENDPOINT = os.path.join(API, 'temperature/')
FLOW_ENDPOINT = os.path.join(API, 'flow/')
PUMP_ENDPOINT = os.path.join(API, 'pump/')
Expand All @@ -33,4 +33,3 @@ class PIN:
AUTH = ('raspi', os.environ['WSP_AUTH_PW'])
except:
print 'Don\'t forget the Basic Auth PW'
sys.exit()
2 changes: 1 addition & 1 deletion wsp_control/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
self.t1 = datetime.now()
GPIO.add_event_detect(PIN.FLOW, GPIO.RISING,
callback=self.tick,
bouncetime=600)
bouncetime=2000)

def tick(self, data):
t2 = datetime.now()
Expand Down
7 changes: 4 additions & 3 deletions wsp_control/runwsp.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#! /usr/bin/python
import sys
import time

import RPi.GPIO as GPIO
from datetime import datetime

from wsp_control.config import (PIN, UPLIFT_THRESHOLD, TEMP_CHECK_INTERVAL,
PROBE_IN, PROBE_OUT, PROBE_AIR)
from wsp_control.models import Pump, DataLog, FlowMeter, Thermometer
from wsp_control.models import Pump, DataLog, FlowMeter, Thermometer, logger

GPIO.setwarnings(False)
# Choose numbering scheme
Expand Down Expand Up @@ -38,10 +39,10 @@

uplift = temp_out - temp_in
if uplift >= UPLIFT_THRESHOLD:
print 'On {0}'.format(uplift)
logger.info('On {0}'.format(uplift))
p.turn_on()
else:
print 'Off {0}'.format(uplift)
logger.info('Off {0}'.format(uplift))
p.turn_off()

time.sleep(TEMP_CHECK_INTERVAL)
Expand Down

0 comments on commit 9618c13

Please sign in to comment.