mqtt failed to start return code 14 (check ip/port)

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

mqtt failed to start return code 14 (check ip/port)

Post 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

Code: Select all

netstat -na | grep 1883
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?
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post by roblom »

You are right....

I had in my mosquitto.conf the line below

Code: Select all

include_dir /etc/mosquitto/conf.d
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!
domoticzos
Posts: 1
Joined: Wednesday 07 February 2018 1:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
azriel
Posts: 2
Joined: Thursday 24 March 2022 12:38
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
azriel
Posts: 2
Joined: Thursday 24 March 2022 12:38
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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
HoogendoornJH
Posts: 29
Joined: Wednesday 31 July 2019 16:43
Target OS: Windows
Domoticz version: 12736
Location: Netherlands
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post 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).
Aeotec Z-wave Gen5, RFXtrx433xl, Philips Hue Bridge, Davies Weather Station, Honeywell HGI/S80, AurAir CO2
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: mqtt failed to start return code 14 (check ip/port)

Post by Derik »

Iemand de oplossing?
Ben op zoek naar een goed werkende dockercompose file.
Dat mqtt is bij mij nog steeds niet werkend.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests