Browse Source

2023-03-14:
- fixed bug in MQTT on_message callback if add_statTopics_on is defined for device

FloKra 1 year ago
parent
commit
69c1dd83fc
2 changed files with 4 additions and 1 deletions
  1. 3 0
      CHANGELOG.txt
  2. 1 1
      cul2mqtt.py

+ 3 - 0
CHANGELOG.txt

@@ -1,3 +1,6 @@
+2023-03-14:
+  - fixed bug in MQTT on_message callback if add_statTopics_on is defined for device
+  
 2022-11-18:
   - basic support for sensors sending values
   - small changes to config structure (TX_interface_prefer moved to cul section)

+ 1 - 1
cul2mqtt.py

@@ -354,7 +354,7 @@ def on_message(client, userdata, msg):
                         if 'on_payload' in res and 'topic' in res and 'payload' in res:
                             if payload == res['on_payload'] and payload != "" and res['topic'] != "" and res['payload'] != "":
                                 if verbose: log_write("  on '" + payload + "': '" + res['payload'] + "' => '" + res['topic'] + "'")
-                                mqttc.publish(res[topic], res[payload], qos=0, retain=False)
+                                mqttc.publish(res['topic'], res['payload'], qos=0, retain=False)
 
                     
 def publish_device_statusupdate(device, cmd, value):