chinezbrun / pytes_esp

PYTES and PYLONTECH LiFePo4 batteries integration with Home Assistant via MQTT.
GNU General Public License v3.0
8 stars 2 forks source link

mqtt data stops within 24h #3

Closed axwell closed 6 months ago

axwell commented 6 months ago

It looks like esp32 fails to send data to mqtt server within 24h of running. replacing umqtt.simple with umqtt.robust fixes the issue.

https://github.com/micropython/micropython-lib/tree/master/micropython/umqtt.robust

" It consists of two submodules: umqtt.simple and umqtt.robust. umqtt.robust is built on top of umqtt.simple and adds auto-reconnect facilities for some of networking errors."

chinezbrun commented 6 months ago

Thanks from your comment. The script has also the possibility to auto restart after an interval to prevent such situations but please let me know what did you changed and confirm also the running time without any stop in order to decide the update of the main.py

axwell commented 6 months ago

yeah the auto-restart it's ok, but if it stops after 2-3 h then you loose important data in HA. I just changed from umqtt.simple import MQTTClient to from umqtt.robust import MQTTClient

For me it's now stable and runs fine over 2 days.

chinezbrun commented 6 months ago

Thanks for testing. I will release a new version soon.