diff --git a/config.txt b/config.txt index 52744c5..338ad5f 100644 --- a/config.txt +++ b/config.txt @@ -6,6 +6,6 @@ }, "deviceName": "flowmonitor", "driverId": "0140", - "releaseVersion": "9", + "releaseVersion": "10", "driverFileName": "flow-monitor.py" } diff --git a/flow-monitor.py b/flow-monitor.py index 31157e5..83b504a 100644 --- a/flow-monitor.py +++ b/flow-monitor.py @@ -133,7 +133,7 @@ class start(threading.Thread, deviceBase): self.GPM_IGNORE_LIMIT = 1.0 self.daemon = True - self.version = "8" + self.version = "10" self.finished = threading.Event() threading.Thread.start(self) @@ -235,8 +235,9 @@ class start(threading.Thread, deviceBase): try: self.GPM_IGNORE_LIMIT = PERSIST['gpm_ignore_limit'] - except KeyError: + except Exception: print("no persisted GPM Ignore Limit. Using default of {}".format(self.GPM_IGNORE_LIMIT)) + self.flowmonitor_setgpmignorelimit("gpm_ignore_limit", self.GPM_IGNORE_LIMIT) # on bootup, if the day has changed, clear the totalizers. # this would happen if the device is off when the time changes to Midnight. @@ -253,7 +254,7 @@ class start(threading.Thread, deviceBase): din1_val = 1 if mcu_status['din1'] == 'On' else 0 # Check DIGITAL INPUT 1 for run status gpm_val = scale(cloop_val, self.RAW_MIN, self.RAW_MAX, self.GPM_MIN, self.GPM_MAX) - if gpm_val < GPM_IGNORE_LIMIT: + if gpm_val < self.GPM_IGNORE_LIMIT: gpm_val = 0 bpd_val = (gpm_val / gal_per_bbl) * 60.0 * 24.0 # Computes BPD from GPM