def autowateringcheck(refsensor): logger.info('Starting Autowatering Evaluation ') # iterate among the water actuators elementlist = autowateringdbmod.getelementlist() for element in elementlist: autowateringexecute(refsensor, element) return
def autowateringcheck(refsensor): logger.info('Starting Autowatering Evaluation ') # iterate among the water actuators elementlist= autowateringdbmod.getelementlist() for element in elementlist: autowateringexecute(refsensor,element) return
def cycleresetall(): global AUTO_data elementlist = autowateringdbmod.getelementlist() for element in elementlist: AUTO_data[element] = { "cyclestartdate": datetime.now(), "lastwateringtime": datetime.now(), "cyclestatus": "done", "checkcounter": 0, "alertcounter": 0, "watercounter": 0 }
import logging from datetime import datetime, time, timedelta import hardwaremod import os import subprocess import emailmod import autowateringdbmod import sensordbmod import actuatordbmod import autofertilizermod import statusdataDBmod logger = logging.getLogger("hydrosys4." + __name__) # status array, required to check the ongoing actions within a watering cycle elementlist = autowateringdbmod.getelementlist() AUTO_data = {} # dictionary of dictionary AUTO_data["default"] = { "cyclestartdate": datetime.now(), "lastwateringtime": datetime.now(), "cyclestatus": "done", "checkcounter": 0, "alertcounter": 0, "watercounter": 0 } allowwateringplan = { } # define the flag that control the waterscheduling activation # cyclestartdate, datetime of the latest cycle start # cyclestatus, describe the status of the cycle: lowthreshold, rampup, done # "lowthreshold" means that the cycle is just started with lowthreshold activation, if the lowthreshold persists for several checks them alarm should be issued # "rampup", this is in full auto mode, the status in between the lowthreshold and high, not reach yet high. if this status persist then alarm should be issued
def cycleresetall(): global AUTO_data elementlist= autowateringdbmod.getelementlist() for element in elementlist: AUTO_data[element]={"cyclestartdate":datetime.now(),"lastwateringtime":datetime.now(),"cyclestatus":"done", "checkcounter":0, "alertcounter":0, "watercounter":0}
import logging from datetime import datetime, time ,timedelta import hardwaremod import os import subprocess import emailmod import autowateringdbmod import sensordbmod import actuatordbmod import autofertilizermod import statusdataDBmod logger = logging.getLogger("hydrosys4."+__name__) # status array, required to check the ongoing actions within a watering cycle elementlist= autowateringdbmod.getelementlist() AUTO_data={} # dictionary of dictionary AUTO_data["default"]={"cyclestartdate":datetime.now(),"lastwateringtime":datetime.now(),"cyclestatus":"done", "checkcounter":0, "alertcounter":0, "watercounter":0} allowwateringplan={} # define the flag that control the waterscheduling activation # cyclestartdate, datetime of the latest cycle start # cyclestatus, describe the status of the cycle: lowthreshold, rampup, done # "lowthreshold" means that the cycle is just started with lowthreshold activation, if the lowthreshold persists for several checks them alarm should be issued # "rampup", this is in full auto mode, the status in between the lowthreshold and high, not reach yet high. if this status persist then alarm should be issued # "done", ready for next start with lowthreshold # sample of database filed # {"element": "", "threshold": ["2.0", "4.0"],"workmode": "None","sensor": "","wtstepsec": "100","maxstepnumber": "3","allowedperiod": ["21:00","05:00"],"maxdaysbetweencycles": "10", "pausebetweenwtstepsmin":"45", "mailalerttype":"warningonly" , "sensorminacceptedvalue":"0.5"} def cyclereset(element): global AUTO_data