esp32: Using umqtt blocks access to webrepl
I'm using a ESP32-WROOM32 flashed with esp32-20181229-v1.9.4-762-gfa50047bb.bin.
When using umqtt in main.py with:
c = MQTTClient('relay-board-esp32', 'example.com')
c.set_callback(sub_cb)
c.connect()
c.subscribe('POWER')
try:
while True:
c.wait_msg()
finally:
c.disconnect()
and webrepl in boot.py with:
import time
import network
import webrepl
nic = network.WLAN(network.STA_IF)
nic.active(True)
nic.connect('wifi', 'password')
while not nic.isconnected():
time.sleep(1)
print('Connected to WiFi!')
print(nic.ifconfig())
webrepl.start()
no further connections via webrepl are possible.
Is this intended? Is there a solution or work around?
I thought the webrepl is listening in the background for new connections, but as soon as I run umqtt, webrepl does not accept new connections any more.
Does this mean no simultaneous access to webrepl and mqtt subscriptions is possible?
[Errno 103] ECONNABORTED MQTT
Hello,
I flashed the last stable of micropython to my ESP-01 1mb with esptool. I connected to it the wifi, I can ping the esp from my mqtt server.
Esp is fed from external power and extra 1000uf capacitor was added for extra stability. I reflashed the module.
>>> print(sta_if.ifconfig())
('192.168.4.55', '255.255.255.0', '192.168.4.1', '192.168.4.1')
>>> from umqtt.simple import MQTTClient
>>> c = MQTTClient("umqtt_client", "192.168.4.10")
>>> c.connect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "umqtt/simple.py", line 56, in connect
OSError: [Errno 103] ECONNABORTED
>>> c.ping()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "umqtt/simple.py", line 94, in ping
OSError: [Errno 103] ECONNABORTED
>>> import esp
>>> esp.check_fw()
size: 586684
md5: 2c7ce68f0e1a5690257698e5e42caf16
True
What MQTT broker is running on 192.168.4.10 ? umqtt.simple implements MQTT Version 3.11. Have you tested the broker with another MQTT client with version 3.11 enabled ?
Hello,
same here.
on my esp8266 with micropython 1.9.2 I tried:
and got:
The server running on 192.168.1.116 is mosquitto 1.3.4 (which should support mqtt 3.1.1) and is working with another client (publishing and subscribing).
What else can I try?
Could you try enabling authentication on mosquitto ? It could be that there is a malformed MQTT packet when authentication is not on
In the meantime I installed the newest version 1.4.14 of mosquitto that didn't change that error.
How do I configure that?
https://medium.com/@eranda/setting-up-authentication-on-mosquitto-mqtt-broker-de5df2e29afc
seems like a decent howto
Okay, I enabled authentication on the mosquitto server, that is working fine.
On the esp8266 I tried it with:
and still get:
I found out that I accidentally had connected the esp8266 to my guest wifi instead of the wifi in which my mosquitto server is.
So my problem is solved.
Thanks... that could have taken a while
Problem solved, issue should be closed.