- raise exception i case hendi cannot be enabled

git-svn-id: http://moon:8086/svn/projects/HendiControl@369 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2020-04-19 19:34:55 +00:00
parent 63bd991cb2
commit bcad769329
3 changed files with 45 additions and 37 deletions
+14 -6
View File
@@ -16,16 +16,24 @@ class Plant(APlant):
self.cycleCounter = 0
def activate(self, enable=True):
if enable == True:
self.heater.remoteEnable(enable)
self.heater.setSwitch(enable)
if enable:
if not self.heater.isRemoteEnable():
raise Exception ("Heater: Cannot enable remote mode!")
else:
try:
self.heater.remoteEnable(enable)
except:
raise Exception("Error: Could not activate heater!")
self.heater.setSwitch(enable)
self.heater.remoteEnable(enable)
print ("Plant activated")
else:
if self.heater.isRemoteEnable():
self.heater.setSwitch(enable)
self.heater.remoteEnable(enable)
print ("Plant deactivated")
def process(self, dt=1):
if not self.heater.isRemoteEnable():
return
isOn = self.isOn
self.cycleCounter += dt
if self.cycleCounter >= self.cycleTime: