Discovery missing effects
This commit is contained in:
6
gauge.py
6
gauge.py
@@ -883,10 +883,13 @@ def _subscribe_all(c):
|
|||||||
def connect_mqtt():
|
def connect_mqtt():
|
||||||
global client_ref, _mqtt_connected
|
global client_ref, _mqtt_connected
|
||||||
from umqtt.robust import MQTTClient
|
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} ...")
|
info(f"Connecting to MQTT broker {MQTT_BROKER}:{MQTT_PORT} ...")
|
||||||
last_error = None
|
last_error = None
|
||||||
for attempt in range(3):
|
for attempt in range(3):
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
info(f" attempt {attempt + 1}: heap {gc.mem_free()} bytes")
|
||||||
try:
|
try:
|
||||||
if client_ref is not None:
|
if client_ref is not None:
|
||||||
try:
|
try:
|
||||||
@@ -906,7 +909,8 @@ def connect_mqtt():
|
|||||||
client.connect()
|
client.connect()
|
||||||
client_ref = client
|
client_ref = client
|
||||||
_mqtt_connected = True
|
_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
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
last_error = e
|
last_error = e
|
||||||
|
|||||||
Reference in New Issue
Block a user