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",
|
||||
"deviceName":"mainMeshify",
|
||||
"driverId":"0000",
|
||||
"releaseVersion":"16",
|
||||
"files": {
|
||||
"file1":"mainMeshify.py",
|
||||
"file2":"main.py",
|
||||
"file3":"device_base.py",
|
||||
"file4":"meshifyData.py"
|
||||
"driverFileName": "mainMeshify.py",
|
||||
"deviceName": "mainMeshify",
|
||||
"driverId": "0000",
|
||||
"releaseVersion": "17",
|
||||
"files": {
|
||||
"file1": "mainMeshify.py",
|
||||
"file2": "main.py",
|
||||
"file3": "device_base.py",
|
||||
"file4": "meshifyData.py"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,6 +143,11 @@ class deviceBase():
|
||||
topic = 'v1/devices/me/telemetry'
|
||||
print(topic, payload)
|
||||
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):
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class main():
|
||||
self.dst = ""
|
||||
# queue for sets to the mesh network will handeled through a queue in this main driver
|
||||
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)
|
||||
thread.start_new_thread(self.registerThread, ())
|
||||
@@ -1171,10 +1171,11 @@ class meshifyMain():
|
||||
print("error understanding the mqtt message")
|
||||
|
||||
def on_message(self, mosq, obj, msg):
|
||||
print("!!!!!!! ON MESSAGE !!!!!!!")
|
||||
print(msg.topic)
|
||||
print(msg.payload)
|
||||
|
||||
try:
|
||||
print("!!!!!!! ON MESSAGE !!!!!!!")
|
||||
print(msg.topic)
|
||||
print(msg.payload)
|
||||
if "rpc" in msg.topic:
|
||||
payload = {}
|
||||
payload["msgId"] = msg.topic.split("/")[-1]
|
||||
|
||||
@@ -27,7 +27,7 @@ class start(threading.Thread):
|
||||
print self.deviceName
|
||||
mac2 = mac.replace(":", "")
|
||||
self.mac = mac2.upper()
|
||||
self.version = "16" #mistification #added Nodes in v5
|
||||
self.version = "17" #mistification #added Nodes in v5
|
||||
self.finished = threading.Event()
|
||||
|
||||
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"
|
||||
},
|
||||
"deviceName": "tankalarms",
|
||||
"releaseVersion": "3",
|
||||
"releaseVersion": "4",
|
||||
"driverFileName": "tankalarms.py",
|
||||
"driverId": "0100"
|
||||
}
|
||||
@@ -17,7 +17,7 @@ _ = None
|
||||
log.info("tankalarms startup")
|
||||
|
||||
# GLOBAL VARIABLES
|
||||
WAIT_FOR_CONNECTION_SECONDS = 20
|
||||
WAIT_FOR_CONNECTION_SECONDS = 5
|
||||
IP_CHECK_PERIOD = 60
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "3"
|
||||
self.version = "4"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
@@ -73,7 +73,10 @@ class start(threading.Thread, deviceBase):
|
||||
if self.force_send:
|
||||
log.warning("FORCE SEND: TRUE")
|
||||
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:
|
||||
val = chan.read()
|
||||
payload["values"][chan.mesh_name] = val
|
||||
@@ -91,11 +94,7 @@ class start(threading.Thread, deviceBase):
|
||||
self.force_send = False
|
||||
send_loops = 0
|
||||
else:
|
||||
send_loops += 1
|
||||
|
||||
|
||||
|
||||
|
||||
send_loops += 1
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
|
||||
@@ -156,6 +155,7 @@ class start(threading.Thread, deviceBase):
|
||||
log.info("Result of tankalarms_alarmreset {}, {}, {}".format(name, value, write_res))
|
||||
if write_res is None:
|
||||
write_res = "Error writing to PLC..."
|
||||
self.sync("sync", 1)
|
||||
return write_res
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user