added attributes for plcpond
This commit is contained in:
@@ -129,6 +129,7 @@ def sendData(message):
|
|||||||
payload = {}
|
payload = {}
|
||||||
payload["ts"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
payload["ts"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
payload["values"] = {}
|
payload["values"] = {}
|
||||||
|
attribute_payload = {{"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}}
|
||||||
try:
|
try:
|
||||||
checkCredentialConfig()
|
checkCredentialConfig()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -137,9 +138,11 @@ def sendData(message):
|
|||||||
try:
|
try:
|
||||||
logger.debug(measure)
|
logger.debug(measure)
|
||||||
payload["values"][measure["name"]] = measure["value"]
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
if "_spt" in measure["name"]:
|
||||||
|
attribute_payload[measure["name"]] = measure["value"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
for chunk in chunk_payload(payload=payload):
|
for chunk in chunk_payload(payload=payload):
|
||||||
publish(__topic__, json.dumps(chunk), __qos__)
|
publish(__topic__, json.dumps(chunk), __qos__)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
publish("v1/devices/me/attributes", json.dumps({"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}), __qos__)
|
publish("v1/devices/me/attributes", json.dumps(attribute_payload), __qos__)
|
||||||
2909
Pub_Sub/fk_plcpond_gateway/thingsboard/fk_plcpond_tb_v6.cfg
Normal file
2909
Pub_Sub/fk_plcpond_gateway/thingsboard/fk_plcpond_tb_v6.cfg
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user