Mosquitto on Ubuntu - no connection

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Mosquitto on Ubuntu - no connection

#1 Post by craigcurtin » 07 Sep 2018, 08:03

Guys,

New to the product - but have been using Mosquitto for a fair amount of time and have MQTT running from a number of android devices etc.

Flashed a Node-MCU with your software - absolutely brilliant how easy it was.

Stumbled my way through the initial config and all seems fine

However i am not getting anything showing up at the Mosquitto broker.

I fired up MQTT SPY on my laptop and changed the controller (Openhab MQTT) to point to my laptop IP address rather than the Mosquitto VM (I have mosquitto running on my laptop also)

I have told it to use IP address

192.168.1.134

I have changed the default Sub and pub templates to

%sysname%/#

%sysname%/%tskname%/%valname%

i.e. i have removed the leading /

IN MQTT Spy i can see the messages coming in

When i change the IP address to point to my Mosquitto on my Ubuntu VM - no messages come in

I have logging enabled to All on Mosquitto - on the Ubuntu VM - i am tailing the log file and can see all the other connection messages coming in from Node-red and the other clients - but nothing from ESP_Easy

I have the firewall disabled on Ubuntu.

They are both on the same flat IP network 192.168.1.x

I will roll back to an older firmware and see if that makes any diference - otherwise - any ideas ?

Craig

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#2 Post by craigcurtin » 07 Sep 2018, 08:42

This is now resolved with going back to R120 - previously i was on the latest Dev release - It may be something the Devs want to look at

regards

Craig

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Mosquitto on Ubuntu - no connection

#3 Post by grovkillen » 07 Sep 2018, 08:43

I would think it has to do with the Mosquitto setup? We're now using unique client IDs for example.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

randytsuch
Normal user
Posts: 33
Joined: 05 Jun 2017, 05:32

Re: Mosquitto on Ubuntu - no connection

#4 Post by randytsuch » 07 Sep 2018, 17:35

FWIW, I'm using a dev version from July I think (at work and can't check), and mosquitto works fine for me.

I can both send commands, and receive status over mosquitto.

Also, if it works on your laptop, but not on Ubuntu, that seems to point to a difference between the two.

Randy

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#5 Post by craigcurtin » 13 Sep 2018, 04:33

Guys,

OK more follow up on this

I went back to the 1.20 release and it worked fine to my Mosquitto on Node-Red (Ubuntu 16.04)

I was then curious to see what was going on

So i flashed a brand new Sonoff Basic - with ESP_Easy_mega-20180910_normal_ESP8266_1024

Flashing is fine - same problem.

My testing setup is as follows

Windows 10 laptop - IP 192.168.1.134

Mosquitto 1.5.1 running on there in a console window - started as Administrator

run Mosquitto with mosquitto -v

On my live setup - Ubuntu 16.04 192.168.1.35 - all latest updates applied as of yesterday through Webmin - Firewall/IPTables disabled, running Mosquitto V 1.4.8 as a daemon - this is live and has 6 different clients (Arduino Ether and ESP8266) talking to it with Arduino sketches - Node-Red also runs on the same box - i am running a tail-f of the mosquitto log file for all testing

On my firewall i have defined a static IP 192.168.1.104 for the sonoff - after a reboot it gets that IP and i can hit it with Chrome.

After flashing the latest mega (as above) to the Sonoff - i setup Openhab MQTT as the broker and point it at the IP address of my ubuntu system

I define a switch on GPIO12 in devices.

I remove the leading forward slash from both the pub and sub on the ESPEASY

I see nothing at all coming into the mosquitto broker on my ubuntu system (from the Sonoff)

If i change nothing except the IP address of the OpenHab broker to point to my laptop i can see messages coming in - i can also publish messages to the sonoff and turn the relay on and off from a command line mosquitto_pub on the windows box - so all is working OK

I have MQTT spy setup on my laptop so i setup two connections on it - one pointing at my ubuntu system to monitor all topics and one pointing at the windows mosquitto to monitor all topics.

I then fire up my 2nd ESPEasy on the nodemcu from my initial testing which is now running
Build: 120
Core Version: 2_3_0

It immediately connects to my Ubuntu system and starts pumping out measurements and i can see them turn up in my node-red dashboard

So in summary Build 120 connects to Ubuntu Mosquitto 1.4.8 no problems,
mega-20180910 will not - this is from two different devices

Remembering i also did this initial test on mega-20180904

I have no security on my Mosquitto broker on either machine (i.e. username/password/machine names are not needed or checked)

Any ideas guys ? I would really much prefer to run the newer builds and am happy to help you get to the bottom of this.

Craig

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#6 Post by craigcurtin » 13 Sep 2018, 05:25

As more info.

I have now upgraded the mosquitto on Ubuntu from Source to 1.5.1 - this is now the same as the Windows version

Same problems

Here is an excerpt from the log file

1536801224: New connection from 192.168.1.104 on port 1883.
1536801224: Sending CONNACK to 192.168.1.104 (0, 5)
1536801224: Socket error on client <unknown>, disconnecting.

I have gone back in the logs and that is the only time that i see the ESP attempting to attach and then it disappears (this happened after a reboot)

I have then changed the controller to point to my laptop - and this is what comes up on the mosquitto logs

1536809029: Tank_Top_Up_Pump/# (QoS 0)
1536809029: ESPClient_5C:CF:7F:81:B2:B1 0 Tank_Top_Up_Pump/#
1536809029: Sending SUBACK to ESPClient_5C:CF:7F:81:B2:B1
1536809029: Received PUBLISH from ESPClient_5C:CF:7F:81:B2:B1 (d0, q0, r1, m0, 'Tank_Top_Up_Pump/status/LWT', ... (2 bytes))
1536809029: Sending PUBLISH to mosqsub|15192-CCs-Dell- (d0, q0, r0, m0, 'Tank_Top_Up_Pump/status/LWT', ... (2 bytes))
1536809029: Sending PUBLISH to ESPClient_5C:CF:7F:81:B2:B1 (d0, q0, r0, m0, 'Tank_Top_Up_Pump/status/LWT', ... (2 bytes))
1536809039: Received PINGREQ from ESPClient_5C:CF:7F:81:B2:B1
1536809039: Sending PINGRESP to ESPClient_5C:CF:7F:81:B2:B1
1536809049: Received PINGREQ


Any ideas ?

Craig

TD-er
Core team member
Posts: 8607
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Mosquitto on Ubuntu - no connection

#7 Post by TD-er » 13 Sep 2018, 19:48

What are the IP-addresses of the Windows and the Ubuntu machine?
Are they in the same subnet?
Do you connect using hostname, or IP-address?

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#8 Post by craigcurtin » 13 Sep 2018, 23:42

Yep they are all on the same subnet

Ubuntu is 192.168.1.35
Windows is 192.168.1.134
Nodemcu with 1.2 is 192.168.1.103
Sonoff basic with ver 2 is 192.168.1.104

All hosts are resolved by IP address
The ESPEasy devices get their IP through DHCP - it is a reserved address on the firewall

Craig

TD-er
Core team member
Posts: 8607
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Mosquitto on Ubuntu - no connection

#9 Post by TD-er » 14 Sep 2018, 00:19

And just to be sure, the subnetmask is 255.255.255.0 ?

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#10 Post by craigcurtin » 14 Sep 2018, 05:27

Umm yeah - i do networking for a living !! Pretty sure my infrastructure is OK

To confirm this i flashed the misbehaving device with 1.2 ESPEasy and it worked straight away and is chattering away doing its thing now. (This is on the Sonoff Basic)

regards

Craig

TD-er
Core team member
Posts: 8607
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Mosquitto on Ubuntu - no connection

#11 Post by TD-er » 14 Sep 2018, 20:24

OK, I will also install Mosquito 1.5 to one of my Ubuntu machines (currently it is running here on a Pi3) to see if I can reproduce it.
OpenHab MQTT and no user/pass?

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#12 Post by craigcurtin » 15 Sep 2018, 05:56

Yep, Ubunutu 16.04 - all modules updated through webmin

Initially Mosquitto 1.4.8, then updated (from source to 1.5.1)

The same unit that would not connect on Mega 2 version is quite happily working for the last 3 days on 1.2 - no issues.

I have blasted the Mega 2 release onto a spare unit so can do any testing you would like to do

Craig

oisisi
Normal user
Posts: 81
Joined: 06 Jul 2016, 13:47

Re: Mosquitto on Ubuntu - no connection

#13 Post by oisisi » 15 Sep 2018, 19:16

In recent versions there is an advanced setting "MQTT usage unit name as ClientId" have you tried activating that?

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#14 Post by craigcurtin » 16 Sep 2018, 23:54

No i have not tried that - but i have no security on my setup i.e. i do not demand user/password combos nor do i tie it down to ClientIDs/IP addresses etc.

The sticking point i have is that i can take the exact same hardware i.e. the same physical device - put 1.2 on it and it works as expected - as soon as i flash the Mega 2 - it fails to connect - i can not see how that is anything in the Mosquitto setup - but as a pointer the exact same version of mosquitto on windows (10) - does work - so it would see to point to something that is different in the underlying comms

Craig

oisisi
Normal user
Posts: 81
Joined: 06 Jul 2016, 13:47

Re: Mosquitto on Ubuntu - no connection

#15 Post by oisisi » 17 Sep 2018, 12:18

The client ID is not about security it is about identity. Every MQTT client introduces itself with an ID when connecting to the broker. I observed similar behavior when a client ID was not unique. The broker would reject connections from clients using an ID that is already in use by another connected client.

craigcurtin
New user
Posts: 9
Joined: 07 Sep 2018, 07:51

Re: Mosquitto on Ubuntu - no connection

#16 Post by craigcurtin » 19 Sep 2018, 02:27

OK but that would then imply that there is something fundamentally different in the code in ESPEasy. V1.2 works fine to the broker, flash with 2 and it stops working. THats with Zero changes to the Broker

Craig

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Mosquitto on Ubuntu - no connection

#17 Post by grovkillen » 19 Sep 2018, 06:13

The client ID has been changed since version 1. Now we use MAC address together with the unit name. Before it was only the unit name I think.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

oisisi
Normal user
Posts: 81
Joined: 06 Jul 2016, 13:47

Re: Mosquitto on Ubuntu - no connection

#18 Post by oisisi » 19 Sep 2018, 13:59

So this implies that a client ID collision could not be the cause of the observed issue.

edahl
New user
Posts: 1
Joined: 10 Jan 2019, 13:59

Re: Mosquitto on Ubuntu - no connection

#19 Post by edahl » 10 Jan 2019, 14:19

Hi,

Was there ever a solution to this problem?
I have a very similar problem - everything works fine with R147, but using r2.0 (mega-20190110) result in the following:

1547124475: New connection from 10.10.201.30 on port 1883.
1547124475: Socket error on client <unknown>, disconnecting.

Using a RasperryPi and HassIO with the Mosquitto broker. Network is in same subnet etc.

Any good suggestions

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest