Browse Source

2023-11-30:
- add MQTT publishing STATETOPIC/lastReceived for monitoring purposes, updates every time a code is received

FloKra 4 months ago
parent
commit
992f21282c
2 changed files with 6 additions and 1 deletions
  1. 3 0
      CHANGELOG.txt
  2. 3 1
      cul2mqtt.py

+ 3 - 0
CHANGELOG.txt

@@ -1,3 +1,6 @@
+2023-11-30:
+ - add MQTT publishing STATETOPIC/lastReceived for monitoring purposes, updates every time a code is received
+
 2023-08-28:
  - enable/disable actions from received remote commands via MQTT (i.E. to switch that from Home Assistant when no one is in the house etc.)
    see comment in cul2mqtt_example.ini for details

+ 3 - 1
cul2mqtt.py

@@ -801,7 +801,9 @@ def cul_received(payload, source_cul):
     else:
         if debug:
             print("DEBUG: lastReceivedStatusFile not defined")
-            
+    
+    # send lastUpdate status to MQTT (for monitoring)
+    mqttc.publish(MQTT_Control_StateTopic + "/lastReceived", str(int(lastDataReceiveTime)), qos=0, retain=False)
     
     if payload[:2] == 'is': # msg is reply from CUL to raw send command
         pass