From 5fdac4043ee546b21a58013c1a0b29382c38e143 Mon Sep 17 00:00:00 2001 From: Nico Melone Date: Fri, 2 Oct 2020 08:44:40 -0500 Subject: [PATCH] Added In Flowrate summation --- tenflowmeterskid/tenflowmeterskid.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tenflowmeterskid/tenflowmeterskid.py b/tenflowmeterskid/tenflowmeterskid.py index 0f43db8..84341d5 100644 --- a/tenflowmeterskid/tenflowmeterskid.py +++ b/tenflowmeterskid/tenflowmeterskid.py @@ -71,6 +71,7 @@ class start(threading.Thread, deviceBase): self.private_ip_address = "" self.public_ip_address_last_checked = 0 self.ping_counter = 0 + self.flowrates = [0] * 10 threading.Thread.start(self) # this is a required function for all drivers, its goal is to upload some piece of data @@ -100,16 +101,21 @@ class start(threading.Thread, deviceBase): for chan in CHANNELS: val = chan.read() + if chan.mesh_name == "total_in_flowrate": + val = sum(self.flowrates) if chan.check(val, self.force_send): if chan.mesh_name in PERSIST["ignore_list"]: if "lifetime" in chan.mesh_name and chan.mesh_name not in ['forward_out_lifetime', 'reverse_out_lifetime', 'net_out_lifetime']: self.totalizer_null(chan.mesh_name[:-9]) else: self.sendtodbDev(1, chan.mesh_name, None, 0, 'tenflowmeterskid') + elif "lifetime" in chan.mesh_name and chan.mesh_name not in ['forward_out_lifetime', 'reverse_out_lifetime', 'net_out_lifetime']: self.totalize(val, chan.mesh_name[:-9]) else: self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'tenflowmeterskid') + if "flowrate" in chan.mesh_name and chan.mesh_name not in ["total_in_flowrate","total_out_flowrate"]: + self.flowrates[int(chan.mesh_name.split("_")[0][2:]) - 1] = val #time.sleep(TAG_DATAERROR_SLEEPTIME) # sleep to allow Micro800 to handle ENET requests for pond_index in range(1, 3):