added attributes for plcpond

This commit is contained in:
Nico Melone
2026-01-14 17:30:32 -06:00
parent ab81c8524d
commit 961fdb2338
2 changed files with 2913 additions and 1 deletions

View File

@@ -129,6 +129,7 @@ def sendData(message):
payload = {}
payload["ts"] = (round(dt.timestamp(dt.now())/600)*600)*1000
payload["values"] = {}
attribute_payload = {{"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}}
try:
checkCredentialConfig()
except Exception as e:
@@ -137,9 +138,11 @@ def sendData(message):
try:
logger.debug(measure)
payload["values"][measure["name"]] = measure["value"]
if "_spt" in measure["name"]:
attribute_payload[measure["name"]] = measure["value"]
except Exception as e:
logger.error(e)
for chunk in chunk_payload(payload=payload):
publish(__topic__, json.dumps(chunk), __qos__)
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__)

File diff suppressed because one or more lines are too long