Berry MQTT subscription gets lost after few hours. #23473
Replies: 5 comments 6 replies
-
Actually, you do not need to delay the MQTT subscribe, since a long time ago the And if you actually needed the delay, a more robust approach would be new new feature of Back to the topic, one step in debugging could be to inspect the list |
Beta Was this translation helpful? Give feedback.
-
This suggested version of code (see below) does not work. So I went back to the code version above. none working code: # rename to autoexec.be
import json
import mqtt
import string
var Batt_Volt=0
# ----- MQTT callback function for battery data:
def cb_MQTT_data(topic, idx, payload, bindata)
if string.find(topic,"PowMr") > 0 && string.find(payload,"Batt") > 0
Batt_Volt = json.load(payload)['Batt']['Batt_Volt']
print("+++ MQTT from", topic, payload, Batt_Volt)
end
end
mqtt.subscribe("stat/PowMr/RESULT", cb_MQTT_data) |
Beta Was this translation helpful? Give feedback.
-
Doing a test with your "none working code" (with different strings to match my setup), I saw the subscription work as expected, without that fluff about wrapping in a Right after boot, I'm getting
Detail: If you want to check if a string contains some substring, it would be more reliable with |
Beta Was this translation helpful? Give feedback.
-
I have another detail and probably bug #3. You suggested using def loadmqtt()
mqtt.subscribe("stat/PowMr/RESULT", cb_MQTT_data)
end
tasmota.when_network_up(loadmqtt) # start when network is connected |
Beta Was this translation helpful? Give feedback.
-
Tasmota version 15.0.0 did not solve the issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I got MQTT subscription running smoothly in Berry for the first few hours. After ~12h the engine simply stops calling the MQTT callback function. Berry continues to work without MQTT data. It seems to be a bug. Debugging is time consuming. I will add more information over the next weeks.
HW: ESP32C3
FW: Tasmota 14.6.0.1 self compiled
Beta Was this translation helpful? Give feedback.
All reactions