Skip to content

Commit

Permalink
Trying python entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric George committed Feb 28, 2015
1 parent 5582233 commit 475cb04
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 47 deletions.
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
package_dir={'wsp_control': 'src'},
install_requires=['RPi.GPIO', 'redis', 'gspread', 'raven'],
scripts=['src/runwsp.py'],
entry_points = {
'my_ep_group_id': [
'check = wsp_control.functions:check',
'toggle = wsp_control.functions:toggle',
'override = wsp_control.functions:override',
]
},
)
14 changes: 0 additions & 14 deletions src/check

This file was deleted.

32 changes: 32 additions & 0 deletions src/functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! /usr/bin/python
import time
import RPi.GPIO as GPIO
from wsp_control.config import PIN

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)
GPIO.setup(PIN.PUMP, GPIO.OUT)
GPIO.setup(PIN.FLOW, GPIO.IN)

def check():
if GPIO.input(PIN.PUMP):
print 'Pump is on'
else:
print 'Pump is off'

def toggle():
while True:
print 'Switching', GPIO.input(PIN.PUMP)
GPIO.output(PIN.PUMP, not GPIO.input(PIN.PUMP))
time.sleep(2)

def override():
print 'Switching on'
GPIO.output(PIN.PUMP, GPIO.HIGH)

if GPIO.input(PIN.PUMP):
print 'Pump is on'
else:
print 'Pump is off'

2 changes: 1 addition & 1 deletion src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import RPi.GPIO as GPIO
from datetime import datetime

from config import PIN, LITERS_PER_REV, TEMP_ENDPOINT, PUMP_ENDPOINT, AUTH
from wsp_control.config import PIN, LITERS_PER_REV, TEMP_ENDPOINT, PUMP_ENDPOINT, AUTH


logger = logging.getLogger(__name__)
Expand Down
16 changes: 0 additions & 16 deletions src/override

This file was deleted.

4 changes: 2 additions & 2 deletions src/runwsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import RPi.GPIO as GPIO
from datetime import datetime

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

GPIO.setwarnings(False)
# Choose numbering scheme
Expand Down
14 changes: 0 additions & 14 deletions src/toggle

This file was deleted.

0 comments on commit 475cb04

Please sign in to comment.