squashed bugs

This commit is contained in:
2020-01-24 15:59:43 -06:00
parent 04080eebd2
commit 85a45e832d
4 changed files with 14 additions and 10 deletions

View File

@@ -6,6 +6,6 @@
},
"deviceName": "flowmonitor",
"driverId": "0140",
"releaseVersion": "15",
"releaseVersion": "17",
"driverFileName": "flow-monitor.py"
}

View File

@@ -179,7 +179,7 @@ class start(threading.Thread, deviceBase):
self.force_send = False
self.daemon = True
self.version = "15"
self.version = "17"
self.finished = threading.Event()
threading.Thread.start(self)
@@ -349,8 +349,7 @@ class start(threading.Thread, deviceBase):
psi_val = scale(analog1_val, self.pressure_raw_min, self.pressure_raw_max, self.pressure_psi_min, self.pressure_psi_max)
if din1_val == 0 and scaled_cloop > 10:
din1_val = 1
if gpm_val < self.GPM_IGNORE_LIMIT:
gpm_val = 0
if self.gpm_or_bpd == "gpm":
gpm_val = scaled_cloop
@@ -358,7 +357,10 @@ class start(threading.Thread, deviceBase):
else:
bpd_val = scaled_cloop
gpm_val = (((bpd_val * gal_per_bbl) / 24) / 60) # Computes GPM from BPD
if gpm_val < self.GPM_IGNORE_LIMIT:
gpm_val = 0
bpd_val = 0
now = time.time()
time_diff = now - last_measured_timestamp
if time_diff > 0 and time_diff < 180:
@@ -611,6 +613,8 @@ class start(threading.Thread, deviceBase):
try:
self.GPM_IGNORE_LIMIT = float(value)
self.sendtodb("setgpmignorelimit", self.GPM_IGNORE_LIMIT, 0)
PERSIST['gpm_ignore_limit'] = self.GPM_IGNORE_LIMIT
persistence.store(PERSIST)
return True
except Exception as e:
logger.error("Error during flowmonitor_setgpmignorelimit: {}".format(e))

View File

@@ -8,7 +8,7 @@
"file4": "Tags.py"
},
"deviceName": "plcfreshwater",
"releaseVersion": "4",
"releaseVersion": "5",
"driverFileName": "plcfreshwater.py",
"driverId": "0100"
}

View File

@@ -52,7 +52,7 @@ class start(threading.Thread, deviceBase):
mqtt=mqtt, Nodes=Nodes)
self.daemon = True
self.version = "4"
self.version = "5"
self.finished = threading.Event()
self.force_send = False
self.public_ip_address = ""
@@ -60,7 +60,7 @@ class start(threading.Thread, deviceBase):
self.private_ip_address = ""
self.plcip = ""
self.ping_counter = 0
self.plc_ping_status = 'Comms Error to PLC'
self.plc_ping_status = 'Default'
threading.Thread.start(self)
# this is a required function for all drivers, its goal is to upload some piece of data
@@ -112,11 +112,11 @@ class start(threading.Thread, deviceBase):
# print("plcfreshwater driver still alive...")
plc_ping = os.system("ping -c 1 " + IP_TABLE[self.mac])
if plc_ping == 0:
if self.plc_ping_status == "Comms Error to PLC":
if not self.plc_ping_status == "OK":
self.sendtodbDev(1, "plc_ping","OK", 0, 'plcfreshwater')
self.plc_ping_status = "OK"
else:
if self.plc_ping_status == "OK":
if not self.plc_ping_status == "Comms Error to PLC":
self.sendtodbDev(1, 'plc_ping', "Comms Error to PLC",0, 'plcfreshwater')
self.plc_ping_status = 'Comms Error to PLC'
time.sleep(10)