updated tankalarms
This commit is contained in:
BIN
meshifyDrivers/.DS_Store
vendored
BIN
meshifyDrivers/.DS_Store
vendored
Binary file not shown.
@@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"driverFileName": "mainMeshify.py",
|
||||||
"driverFileName":"mainMeshify.py",
|
"deviceName": "mainMeshify",
|
||||||
"deviceName":"mainMeshify",
|
"driverId": "0000",
|
||||||
"driverId":"0000",
|
"releaseVersion": "17",
|
||||||
"releaseVersion":"16",
|
"files": {
|
||||||
"files": {
|
"file1": "mainMeshify.py",
|
||||||
"file1":"mainMeshify.py",
|
"file2": "main.py",
|
||||||
"file2":"main.py",
|
"file3": "device_base.py",
|
||||||
"file3":"device_base.py",
|
"file4": "meshifyData.py"
|
||||||
"file4":"meshifyData.py"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -143,6 +143,11 @@ class deviceBase():
|
|||||||
topic = 'v1/devices/me/telemetry'
|
topic = 'v1/devices/me/telemetry'
|
||||||
print(topic, payload)
|
print(topic, payload)
|
||||||
self.q.put([topic, payload, 0])
|
self.q.put([topic, payload, 0])
|
||||||
|
|
||||||
|
def sendToTBAttributes(self, payload):
|
||||||
|
topic = 'v1/devices/me/attributes'
|
||||||
|
print(topic, payload)
|
||||||
|
self.q.put([topic, payload, 0])
|
||||||
|
|
||||||
def sendtodbCH(self, ch, channel, value, timestamp):
|
def sendtodbCH(self, ch, channel, value, timestamp):
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class main():
|
|||||||
self.dst = ""
|
self.dst = ""
|
||||||
# queue for sets to the mesh network will handeled through a queue in this main driver
|
# queue for sets to the mesh network will handeled through a queue in this main driver
|
||||||
self.meshQ = Queue.Queue()
|
self.meshQ = Queue.Queue()
|
||||||
version = "16" # 6 - mistification # 5 - updated for SAT data and generic sets. 4 - devices changed to drivers for dia
|
version = "17" # 6 - mistification # 5 - updated for SAT data and generic sets. 4 - devices changed to drivers for dia
|
||||||
|
|
||||||
# self.sendtodb("version", version, 0)
|
# self.sendtodb("version", version, 0)
|
||||||
thread.start_new_thread(self.registerThread, ())
|
thread.start_new_thread(self.registerThread, ())
|
||||||
@@ -1171,10 +1171,11 @@ class meshifyMain():
|
|||||||
print("error understanding the mqtt message")
|
print("error understanding the mqtt message")
|
||||||
|
|
||||||
def on_message(self, mosq, obj, msg):
|
def on_message(self, mosq, obj, msg):
|
||||||
print("!!!!!!! ON MESSAGE !!!!!!!")
|
|
||||||
print(msg.topic)
|
|
||||||
print(msg.payload)
|
|
||||||
try:
|
try:
|
||||||
|
print("!!!!!!! ON MESSAGE !!!!!!!")
|
||||||
|
print(msg.topic)
|
||||||
|
print(msg.payload)
|
||||||
if "rpc" in msg.topic:
|
if "rpc" in msg.topic:
|
||||||
payload = {}
|
payload = {}
|
||||||
payload["msgId"] = msg.topic.split("/")[-1]
|
payload["msgId"] = msg.topic.split("/")[-1]
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class start(threading.Thread):
|
|||||||
print self.deviceName
|
print self.deviceName
|
||||||
mac2 = mac.replace(":", "")
|
mac2 = mac.replace(":", "")
|
||||||
self.mac = mac2.upper()
|
self.mac = mac2.upper()
|
||||||
self.version = "16" #mistification #added Nodes in v5
|
self.version = "17" #mistification #added Nodes in v5
|
||||||
self.finished = threading.Event()
|
self.finished = threading.Event()
|
||||||
|
|
||||||
threading.Thread.start(self)
|
threading.Thread.start(self)
|
||||||
|
|||||||
2
meshifyDrivers/sync_to_aws.sh
Executable file
2
meshifyDrivers/sync_to_aws.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
cd /Users/nico/Documents/GitHub/ThingsBoard/meshifyDrivers
|
||||||
|
aws s3 sync . s3://hp-thingsboard --acl public-read --exclude "*.DS_Store*" --exclude ".ipynb_checkpoints/" --exclude "*.zip*" --exclude "*.sh*"
|
||||||
2
meshifyDrivers/sync_to_aws_dryrun.sh
Executable file
2
meshifyDrivers/sync_to_aws_dryrun.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
cd /Users/nico/Documents/GitHub/ThingsBoard/meshifyDrivers
|
||||||
|
aws s3 sync . s3://hp-thingsboard --acl public-read --exclude "*.DS_Store*" --exclude ".ipynb_checkpoints/" --exclude "*.zip*" --exclude "*.sh*" --dryrun
|
||||||
2
meshifyDrivers/sync_to_local.sh
Executable file
2
meshifyDrivers/sync_to_local.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
cd /Users/nico/Documents/GitHub/ThingsBoard/meshifyDrivers
|
||||||
|
aws s3 sync s3://hp-thingsboard . --exclude "*.DS_Store*" --exclude ".ipynb_checkpoints/" --exclude "*.zip*" --exclude "*.sh*"
|
||||||
2
meshifyDrivers/sync_to_local_dryrun.sh
Executable file
2
meshifyDrivers/sync_to_local_dryrun.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
cd /Users/nico/Documents/GitHub/ThingsBoard/meshifyDrivers
|
||||||
|
aws s3 sync s3://hp-thingsboard . --exclude "*.DS_Store*" --exclude ".ipynb_checkpoints/" --exclude "*.zip*" --exclude "*.sh*" --dryrun
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"file4": "Tags.py"
|
"file4": "Tags.py"
|
||||||
},
|
},
|
||||||
"deviceName": "tankalarms",
|
"deviceName": "tankalarms",
|
||||||
"releaseVersion": "3",
|
"releaseVersion": "4",
|
||||||
"driverFileName": "tankalarms.py",
|
"driverFileName": "tankalarms.py",
|
||||||
"driverId": "0100"
|
"driverId": "0100"
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ _ = None
|
|||||||
log.info("tankalarms startup")
|
log.info("tankalarms startup")
|
||||||
|
|
||||||
# GLOBAL VARIABLES
|
# GLOBAL VARIABLES
|
||||||
WAIT_FOR_CONNECTION_SECONDS = 20
|
WAIT_FOR_CONNECTION_SECONDS = 5
|
||||||
IP_CHECK_PERIOD = 60
|
IP_CHECK_PERIOD = 60
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class start(threading.Thread, deviceBase):
|
|||||||
mqtt=mqtt, Nodes=Nodes)
|
mqtt=mqtt, Nodes=Nodes)
|
||||||
|
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
self.version = "3"
|
self.version = "4"
|
||||||
self.finished = threading.Event()
|
self.finished = threading.Event()
|
||||||
self.force_send = False
|
self.force_send = False
|
||||||
self.public_ip_address = ""
|
self.public_ip_address = ""
|
||||||
@@ -73,7 +73,10 @@ class start(threading.Thread, deviceBase):
|
|||||||
if self.force_send:
|
if self.force_send:
|
||||||
log.warning("FORCE SEND: TRUE")
|
log.warning("FORCE SEND: TRUE")
|
||||||
if int(time.time()) % 600 == 0 or self.force_send:
|
if int(time.time()) % 600 == 0 or self.force_send:
|
||||||
payload = {"ts": round(time.time()/600)*600*1000, "values": {}}
|
if self.force_send:
|
||||||
|
payload = {"ts": time.time()*1000, "values": {}}
|
||||||
|
else:
|
||||||
|
payload = {"ts": round(time.time()/600)*600*1000, "values": {}}
|
||||||
for chan in CHANNELS:
|
for chan in CHANNELS:
|
||||||
val = chan.read()
|
val = chan.read()
|
||||||
payload["values"][chan.mesh_name] = val
|
payload["values"][chan.mesh_name] = val
|
||||||
@@ -91,11 +94,7 @@ class start(threading.Thread, deviceBase):
|
|||||||
self.force_send = False
|
self.force_send = False
|
||||||
send_loops = 0
|
send_loops = 0
|
||||||
else:
|
else:
|
||||||
send_loops += 1
|
send_loops += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(e)
|
log.error(e)
|
||||||
|
|
||||||
@@ -156,6 +155,7 @@ class start(threading.Thread, deviceBase):
|
|||||||
log.info("Result of tankalarms_alarmreset {}, {}, {}".format(name, value, write_res))
|
log.info("Result of tankalarms_alarmreset {}, {}, {}".format(name, value, write_res))
|
||||||
if write_res is None:
|
if write_res is None:
|
||||||
write_res = "Error writing to PLC..."
|
write_res = "Error writing to PLC..."
|
||||||
|
self.sync("sync", 1)
|
||||||
return write_res
|
return write_res
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user