Update statedata.be topic handling (#23878)

Could would react to any topic including the string "STATE", specifically including "ZBSTATE" payload from the command "ZbScan"
This commit is contained in:
sfromis 2025-09-06 21:31:45 +02:00 committed by GitHub
parent 1736c640f3
commit 27532f8d81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,14 +36,15 @@ class mqttdata_cls
end
def stop()
mqtt.unsubscribe("tele/#") # Assume default Fulltopic (%prefix%/%topic%/) and Prefix3 (tele)
tasmota.remove_driver(self)
end
def handle_state_data(full_topic, idx, data, databytes)
import json
if string.find(full_topic, "STATE") > 0 # tele/wemos7/STATE
var subtopic = string.split(full_topic, "/") # Assume default Fulltopic (%prefix%/%topic%/)
var subtopic = string.split(full_topic, "/") # Assume default Fulltopic (%prefix%/%topic%/)
if subtopic[-1] == "STATE" # tele/wemos7/STATE
var topic = subtopic[1] # wemos7
var state = json.load(data)