Discovery missing effects

This commit is contained in:
2026-04-21 23:22:50 +02:00
parent 179fb77b95
commit a294ce1fd9

View File

@@ -883,10 +883,13 @@ def _subscribe_all(c):
def connect_mqtt():
global client_ref, _mqtt_connected
from umqtt.robust import MQTTClient
gc.collect()
info(f"Heap before MQTT: {gc.mem_free()} bytes")
info(f"Connecting to MQTT broker {MQTT_BROKER}:{MQTT_PORT} ...")
last_error = None
for attempt in range(3):
gc.collect()
info(f" attempt {attempt + 1}: heap {gc.mem_free()} bytes")
try:
if client_ref is not None:
try:
@@ -906,7 +909,8 @@ def connect_mqtt():
client.connect()
client_ref = client
_mqtt_connected = True
info(f"MQTT connected client_id={MQTT_CLIENT_ID}")
gc.collect()
info(f"MQTT connected client_id={MQTT_CLIENT_ID} heap {gc.mem_free()} bytes")
return
except Exception as e:
last_error = e