Page 1 of 1
mqtt failed to start return code 14 (check ip/port)
Posted: Saturday 29 January 2022 19:55
by roblom
I've installed MQTT by folowing the wiki but when I do the test below
Code: Select all
mosquitto_pub -h localhost -m '{ "idx" : 2820, "nvalue" : 0, "svalue" : "25.0" }' -t 'domoticz/in'
The dummy device isn't update and I get in the domoticz log the error
Code: Select all
mqtt failed to start return code 14 (check ip/port)
When I do
I get
Code: Select all
tcp 0 0 127.0.0.1:1883 0.0.0.0:* LISTEN
tcp6 0 0 ::1:1883 :::* LISTEN
tcp6 0 0 ::1:1883 ::1:45032 ESTABLISHED
tcp6 0 0 ::1:45032 ::1:1883 ESTABLISHED
i'm running mosquitto version 2.0.12
Hope someone can help?
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Saturday 29 January 2022 23:31
by FireWizard
Hi @roblom,
Did you configure the mosquitto.conf file?
It should at least contain:
Code: Select all
listener 1883
allow_anonymous true
Regards
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 13:45
by roblom
I found out that in the Domoticz MQTT hardware I need to place localhost in the settings instead of the IP adres (thought it was the same but it seems not). Now the device does update with the command below.
Code: Select all
mosquitto_pub -h localhost -m '{ "idx" : 2820, "nvalue" : 0, "svalue" : "25.0" }' -t 'domoticz/in'
So it seems that it internally works, but the main goal was to let my Tasmota device put data in Domoticz using MQTT. That still gives the error below
Code: Select all
Connection failed to 192.168.178.7:1883, rc -2
I think the problem is that the newer mosquitto need some kind of default authentification but I tried many websites and they are all give different settings and none of them does work for me. Maybe someone can point me to a guide that works for Mosquitto version 2.0.12
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 14:13
by FireWizard
Hello @roblom,
You wrote:
I found out that in the Domoticz MQTT hardware I need to place localhost in the settings instead of the IP adres (thought it was the same but it seems not).
From:
https://unix.stackexchange.com/question ... -localhost
So, to answer your question - yes, they are different.
localhost is given an ip address in the 127.0.0.0 network and given to a virtual loopback network device lo. This device is present on all systems, regardless of whether they have a physical network device fitted (WiFi or Ethernet, for example). A system that is not connected to any network will have this loopback device and hence a 127.0.0.0 address. The name localhost is simply a name that resolves to this IP address and is configured in /etc/hosts.
Your real IP address (10.x.x.x for example) is allocated to a network device. This is usually a physical network device (WiFi or Ethernet) although advanced setups using tun or tap devices can use them too. Again, the name resolution (for example
www.example.org to 10.0.1.1) can be configured in /etc/hosts or can be set up to use DNS.
So it should not make any difference if you place localhost or its ip address (127.0.0.1) in the Domoticz Config
Can you try to install
http://mqtt-explorer.com/ on your laptop or desktop, in order to see what your Tasmota device publishes?
And you checked your mosquitto.conf file?
Regards
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 14:55
by roblom
I used the 192.168.178.7 for the ip address...
I've already tried the MQTT explorer but can't establish a connection. I only get a "Disconnected from server" message, whatever settings I try.
I've used the settings in the post on the bottom of the page below.
https://stackoverflow.com/questions/700 ... spberry-pi
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 16:24
by FireWizard
Hello @roblom,
Just a question.
You don't have a firewall running somewhere?
See:
https://forums.raspberrypi.com/viewtopic.php?t=140011
[Edit]
Follow this guideline to install/configure Mosquitto:
https://randomnerdtutorials.com/how-to- ... pberry-pi/
Regards
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 16:33
by roblom
Ok, found it, for some reason (a change after version 1.5 of mosquitto) you need to remove the "listener 1883" and "port 1883". I commented them out and now it's working.
Found it in an old jessie topic
here
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 16:47
by FireWizard
@roblom
Perfect, that you found it, but listener 1883 should be present in your conf file. But as long as it works in your situation, it is okay.
Regards
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Sunday 30 January 2022 17:06
by roblom
You are right....
I had in my mosquitto.conf the line below
And in that file I added
Code: Select all
listener 1883
allow_anonymous true
But I forgot to remove the "listener 1883" line in the mosquitto.conf so it was in there twice. After removing the listener 1883 in the mosquitto.conf it worked.
Appreciated your your help!
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Thursday 17 March 2022 9:48
by domoticzos
hey,
since last nights beta update I have the same problem, but I see in the log that the "MQTT Client Gateway with LAN interface" Hardware tries to connect to Port 8883 instead of 1883.
.
.
.
2022-03-17 09:45:51.492 Status: OS-MQTT_Server: Connecting to 192.168.1.11:8883
2022-03-17 09:45:51.492 Status: OS-MQTT_Server: enabled TLS mode
2022-03-17 09:45:51.493 Error: OS-MQTT_Server: Failed to start, return code: 14/Connection refused (Check IP/Port)
.
.
.
Setting in the Hardware setting is definitely Port 1883
Any solution for this ?
Thank's
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Thursday 17 March 2022 10:37
by FireWizard
Hi,
Any solution for this ?
Yes.
See:
viewtopic.php?f=6&t=38250 and see also the links to Github.
New beta has been published.
Regards
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Thursday 24 March 2022 13:27
by azriel
Problem persist for me on v 2022.1 build c9526851b :-/
Code: Select all
Error: Mosquitto: Failed to start, return code: 14/Connection timed out (Check IP/Port)
Everything was ok before upgrade, and no problem when i try to subscribe via mosquitto_sub
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Thursday 24 March 2022 13:49
by azriel
My bad, seems that my firewall decided to deny all traffic for this container... don't know why, but it's fixed. Sry
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Friday 10 February 2023 13:35
by HoogendoornJH
Which firewall do you mean azriel? That of the router, that of the operating system or a self-installed firewall?
(I have the same problem and I am looking for a solution).
Re: mqtt failed to start return code 14 (check ip/port)
Posted: Monday 24 July 2023 2:18
by Derik
Iemand de oplossing?
Ben op zoek naar een goed werkende dockercompose file.
Dat mqtt is bij mij nog steeds niet werkend.