Hello,
I’v a problem to connect to MQTT with my D1 mini!
Cann you help me?
Failed to connect to MQTT broker. Reconnecting...
Traceback (most recent call last):
File "main.py", line 65, in <module>
File "main.py", line 56, in <module>
NameError: name 'client' isn't defined
Code:
while True:
try:
client.check_msg()
if (time.time() - last_sensor_reading) > readings_interval:
msg = read_ds_sensor()
client.publish(topic_pub, msg)
last_sensor_reading = time.time()
except onewire.OneWireError:
print('Failed to read/publish sensor readings.')
time.sleep(1)
except OSError as e:
restart_and_reconnect()
3 Answers
Hi Gerhard.
I think you’re getting that error because you haven’t installed the umqttsimple library.
Can you double check that you have the library installed and try again_
Regards,
Sara