Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeMCU won't connect to MQTT "Broker" #22

Open
eayoungs opened this issue Aug 25, 2017 · 1 comment
Open

NodeMCU won't connect to MQTT "Broker" #22

eayoungs opened this issue Aug 25, 2017 · 1 comment

Comments

@eayoungs
Copy link

eayoungs commented Aug 25, 2017

Setup:

Client

  • NodeMCU Board
  • TSL2591 sensor: Adafruit

Broker

  • Lenovo ThinkPad X61 ~2006
  • Ubuntu 14.04 LTS
  • Mosquitto: MQTT v3.1

When I connect to the network, using mpfshell, I get the following response:
"Wifi connect successful, network config: ('192.168.43.87', '255.255.255.0', '192.168.43.1', '192.168.43.1')"

I check that port 1883 is open with this command:
netstat -ntlp | grep 1883
...and I get this response:
tcp 0 0 0.0.0.0:1883 0.0.0.0: LISTEN -
tcp6 0 0 :::1883 :::* LISTEN -*

I check the mosquitto MQTT broker (my X61 Thinkpad) with two terminals as described on Read the Docs and get the response, as expected.

When I try to connect to the the Broker, with this command:
m = MQTTWriter('esp8266', 'IP_VERIFIED_WITH-WHAT_IS_MY_IP', 1883, 'sensor-data')

I get the following response.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mqtt_writer.py", line 13, in __init__
  File "mqtt_writer.py", line 17, in _connect
  File "umqtt/simple.py", line 56, in connect
OSError: [Errno 103] ECONNABORTED

I've tried different networks, making sure each time that both devices are on the same network. I've searched the web for the error but can't find any help online.

I'm so close and I have so many projects that I want to use this with. Any advice would be greatly appreciated!

Thanks in advance!

@jfischer
Copy link
Owner

Hmm. That is a strange one. Here are a few ideas that you might look into:

Is port 1883 really open to the outside world? If you have a firewall turned on (e.g. ufw), it probably blocks that port by default. If you have another linux box, you might run the mosquitto_pub utility and see if you can remotely publish to the broker.

Is your ESP8266 really on the network? You might look at your WiFi access point and see if you see the connection.

Have you switched networks? The connection parameters seem to be stored in nonvolatile memory, and it will connect to the last network automatically during the boot process. If you have switched networks at some point, you might try forcing a disconnect from the WiFi network and then reconnecting.

Let me know if that helps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants