From 27532f8d81153642c4b7c530516209bb6539ce1f Mon Sep 17 00:00:00 2001 From: sfromis <47082390+sfromis@users.noreply.github.com> Date: Sat, 6 Sep 2025 21:31:45 +0200 Subject: [PATCH] Update statedata.be topic handling (#23878) Could would react to any topic including the string "STATE", specifically including "ZBSTATE" payload from the command "ZbScan" --- tasmota/berry/examples/statedata.be | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasmota/berry/examples/statedata.be b/tasmota/berry/examples/statedata.be index bbfd4ee08..bf51cd828 100644 --- a/tasmota/berry/examples/statedata.be +++ b/tasmota/berry/examples/statedata.be @@ -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)