problems with mqtt Topic is solved

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

problems with mqtt

Post by JuanUil »

Hi all,

since yesterday I have a big problem with mosquitto mqqt.

The broker doesn't want to connect anymore.
In domoticz log I get:

Code: Select all

2022-12-16 19:25:24.839 Status: MQTT: Worker stopped...
2022-12-16 19:25:25.851 Status: MQTT: Connecting to 192.168.2.21:1883
2022-12-16 19:25:25.851 Error: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)
when i ssh and give the command systemctl status mosquitto.service I get:

Code: Select all

systemctl status mosquitto.service
* mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-12-16 19:27:19 CET; 1min 45s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 2792 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2793 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2794 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2795 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2796 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 2796 (code=exited, status=1/FAILURE)
        CPU: 95ms

dec 16 19:27:19 PI4Nieuw systemd[1]: mosquitto.service: Failed with result 'exit-code'.
dec 16 19:27:19 PI4Nieuw systemd[1]: Failed to start Mosquitto MQTT Broker.
dec 16 19:27:19 PI4Nieuw systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
dec 16 19:27:19 PI4Nieuw systemd[1]: Stopped Mosquitto MQTT Broker.
dec 16 19:27:19 PI4Nieuw systemd[1]: mosquitto.service: Start request repeated too quickly.
dec 16 19:27:19 PI4Nieuw systemd[1]: mosquitto.service: Failed with result 'exit-code'.
dec 16 19:27:19 PI4Nieuw systemd[1]: Failed to start Mosquitto MQTT Broker.
in /etc/mosquitto/mosquitto.conf I have:

Code: Select all

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /run/mosquitto/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d
listener 1883
allow_anonymous true
strange is also that the problem is coming back even if i use a backup image of a working system!!

some more info:

Code: Select all

pi@server5:~ $ mosquitto -v
1671219391: mosquitto version 2.0.11 starting
1671219391: Using default config.
1671219391: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671219391: Create a configuration file which defines a listener to allow remote access.
1671219391: For more details see https://mosquitto.org/documentation/authentication-methods/
1671219391: Opening ipv4 listen socket on port 1883.
1671219391: Error: Address already in use
1671219391: Opening ipv6 listen socket on port 1883.
1671219391: Error: Address already in use
Any help is highly appreciated!!!

Jan
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: problems with mqtt

Post by ferrosk »

these messages:

1671219391: Opening ipv4 listen socket on port 1883.
1671219391: Error: Address already in use
1671219391: Opening ipv6 listen socket on port 1883.
1671219391: Error: Address already in use

means that some other service is already using port 1883 on your system so mosquitto cannot bind to this port and fails to start... Try find which process is using the port by:

Code: Select all

sudo netstat -anp | grep 1883
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: problems with mqtt

Post by JuanUil »

Thnx ferrosk for your advice,

made a complete new install and everything working again.

greetz
Jan
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
User avatar
gizmocuz
Posts: 2548
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: problems with mqtt

Post by gizmocuz »

Try using docker compose
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest