-
Notifications
You must be signed in to change notification settings - Fork 4
/
platform_prototype.py
44 lines (36 loc) · 1.27 KB
/
platform_prototype.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# *****************************************
# Irrigator Prototype Interface Library
# *****************************************
#
# Description: This library supports controlling
# via the prototype GPIOs,
#
# *****************************************
# *****************************************
# Imported Libraries
# *****************************************
# None
# *****************************************
# Class Definition
# *****************************************
class Platform:
def __init__(self, _outpins, relay_trigger=0):
self.outpins = _outpins # { 'zone_00' : 17, 'zone_01': 18, etc... }
self.current = {}
for item in self.outpins:
self.current[item] = not relay_trigger #Set the Zone Pins 'Off'
print(f'{item} initialized to {self.current[item]}.')
def setrelay(self, value, zonename):
try:
self.current[zonename] = value
print(f' - {zonename} set to {value}.')
except:
print(f'An exception occurred when changing zone {zonename} to {value}')
return(1)
return(0) # Return ErrorCode = 0
def getoutputstatus(self):
return(self.current)
def cleanup(self):
print('Cleaning up.')
return()