made mappings for channels reporting a number that needed to be mapped

This commit is contained in:
2020-02-26 17:03:56 -06:00
parent 2970ac9f5a
commit bd0f7def24
21 changed files with 203 additions and 56 deletions

View File

@@ -2,7 +2,7 @@
"driverFileName": "multisensor.py",
"deviceName": "multisensor",
"driverId": "0240",
"releaseVersion": "5",
"releaseVersion": "6",
"files": {
"file1": "multisensor.py",
"file2": "utilities.py",

View File

@@ -78,7 +78,7 @@ class start(threading.Thread, deviceBase):
mqtt=mqtt, Nodes=Nodes)
self.daemon = True
self.version = "5"
self.version = "6"
self.finished = threading.Event()
self.force_send = False
self.public_ip_address = ""
@@ -120,15 +120,15 @@ class start(threading.Thread, deviceBase):
if "active" in chan.plc_tag:
PERSIST[chan.mesh_name] = val
persistence.store(PERSIST,'persist.json')
if "scaledValue" in chan.plc_tag:
if val <= PERSIST[chan.mesh_name[:3]+"low"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "LOW", 0, 'multisensor')
elif val >= PERSIST[chan.mesh_name[:3]+"high"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "HIGH", 0, 'multisensor')
else:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "OK", 0, 'multisensor')
if chan.check(val, self.force_send):
self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'multisensor')
if "scaledValue" in chan.plc_tag:
if val <= PERSIST[chan.mesh_name[:3]+"low"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "LOW", 0, 'multisensor')
elif val >= PERSIST[chan.mesh_name[:3]+"high"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "HIGH", 0, 'multisensor')
else:
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "OK", 0, 'multisensor')
#time.sleep(5)