MQTT App connection problems

Discussions about RaZberry - Z-Wave board for Raspberry computer
Spacely
Posts: 1
Joined: 06 Jul 2020 12:22

MQTT App connection problems

Post by Spacely »

Hi there,

I'm using a razberry module on raspberry. I have installes the MQTT package and configured it to communicate with my remote mosquitto installation.
Mosquitto is allowing anonymopus connections. Many Tasmotas accessing it right now every second...
No Messages arriving at mosquitto server from zwave. Errors in z-way-server.log:

[2020-07-06 11:20:25.075] [core] [MQTT-14] Socket connection opened.
[2020-07-06 11:20:25.075] [core] [MQTT-14] Connected to 192.168.10.7
[2020-07-06 11:20:25.075] [core] [MQTT-14] ----------------- undefined
[2020-07-06 11:20:25.075] [core] [MQTT-14] +++++++++++++++++ {"first_start_up":"2020-07-02T18:24:43.146Z","count_of_reconnects":4,"firstaccess":false}
[2020-07-06 11:20:26.090] [core] [MQTT-14] Trying to reconnect (0)
[2020-07-06 11:20:27.115] [core] [MQTT-14] Socket connection closed.
[2020-07-06 11:20:27.121] [core] [MQTT_14] Error: Disconnected, will retry to connect...
at MQTT.BaseModule.error (automation/userModules/BaseModule/index.js:122:17)
at MQTT.onDisconnect (automation/userModules/MQTT/index.js:139:7)
at MQTTClient._disconnectCallback (automation/userModules/MQTT/index.js:92:46)
at MQTTClient._onClose (automation/userModules/MQTT/lib/mqtt.js:303:10)
at tcp._connection.onclose (automation/userModules/MQTT/lib/mqtt.js:173:10)

Any Ideas?
gbone001
Posts: 6
Joined: 18 Oct 2020 19:13

Re: MQTT App connection problems

Post by gbone001 »

did you ever resolve this, I have the same issue.....

thanks
User avatar
PoltoS
Posts: 6289
Joined: 26 Jan 2011 19:36

Re: MQTT App connection problems

Post by PoltoS »

Please upgrade the MQTT package to the latest version. Should work then
gbone001
Posts: 6
Joined: 18 Oct 2020 19:13

Re: MQTT App connection problems

Post by gbone001 »

1.4.1? I have that version and its not working
User avatar
PoltoS
Posts: 6289
Joined: 26 Jan 2011 19:36

Re: MQTT App connection problems

Post by PoltoS »

Should be working. Pleasae show us your error.
johnpdowling
Posts: 2
Joined: 04 Jan 2018 11:36

Re: MQTT App connection problems

Post by johnpdowling »

I'm seeing the same thing on newest builds of z-way-server, basemodule, and mqtt. Here are logs for:
z-way-server

Code: Select all

[2020-10-28 11:40:21.958] [I] [core] --- Starting module MQTT
[2020-10-28 11:40:21.970] [I] [core] Executing script: /*** Buffer ******************************************************************* ...
[2020-10-28 11:40:21.973] [I] [core] Executing script: /*** MQTTClient ************************************************************** ...
[2020-10-28 11:40:21.984] [W] [core] Send error: Broken pipe
[2020-10-28 11:40:21.986] [I] [core] --- ERROR: Can't register duplicate module instance: 16
[2020-10-28 11:40:21.987] [I] [core] Notification: error (core): Can't register duplicate module instance: 16
[2020-10-28 11:40:21.997] [I] [core] [MQTT-16] Socket connection closed.
[2020-10-28 11:40:22.004] [I] [core] [MQTT_16] Error: Disconnected, will retry to connect...
    at MQTT.BaseModule.error (automation/userModules/BaseModule/index.js:122:17)
    at MQTT.onDisconnect (automation/userModules/MQTT/index.js:173:7)
    at MQTTClient._disconnectCallback (automation/userModules/MQTT/index.js:110:46)
    at MQTTClient._onClose (automation/userModules/MQTT/lib/mqtt.js:303:10)
    at tcp._connection.onclose (automation/userModules/MQTT/lib/mqtt.js:173:10)
[2020-10-28 11:40:22.025] [I] [core] [MQTT-16] Trying to reconnect (0)
[2020-10-28 11:40:22.991] [W] [core] Send error: Broken pipe
[2020-10-28 11:40:22.992] [I] [core] [MQTT-16] Reconnect attempt finished
[2020-10-28 11:40:23.012] [I] [core] [MQTT-16] Socket connection closed.
[2020-10-28 11:40:23.015] [I] [core] [MQTT_16] Error: Disconnected, will retry to connect...
    at MQTT.BaseModule.error (automation/userModules/BaseModule/index.js:122:17)
    at MQTT.onDisconnect (automation/userModules/MQTT/index.js:173:7)
    at MQTTClient._disconnectCallback (automation/userModules/MQTT/index.js:110:46)
    at MQTTClient._onClose (automation/userModules/MQTT/lib/mqtt.js:303:10)
    at tcp._connection.onclose (automation/userModules/MQTT/lib/mqtt.js:173:10)
[2020-10-28 11:40:24.021] [I] [core] [MQTT-16] Trying to reconnect (1)
[2020-10-28 11:40:24.022] [W] [core] Send error: Broken pipe
[2020-10-28 11:40:24.023] [I] [core] [MQTT-16] Reconnect attempt finished
[2020-10-28 11:40:24.043] [I] [core] [MQTT-16] Socket connection closed.
[2020-10-28 11:40:24.045] [I] [core] [MQTT_16] Error: Disconnected, will retry to connect...
    at MQTT.BaseModule.error (automation/userModules/BaseModule/index.js:122:17)
    at MQTT.onDisconnect (automation/userModules/MQTT/index.js:173:7)
    at MQTTClient._disconnectCallback (automation/userModules/MQTT/index.js:110:46)
    at MQTTClient._onClose (automation/userModules/MQTT/lib/mqtt.js:303:10)
    at tcp._connection.onclose (automation/userModules/MQTT/lib/mqtt.js:173:10)
    
on the broker, a repeat of a new connection that immediately fails

Code: Select all

1603913909: New connection from 172.30.33.7 on port 1883.
1603913910: Socket error on client <unknown>, disconnecting.
aivs
Posts: 52
Joined: 04 Mar 2011 15:26

Re: MQTT App connection problems

Post by aivs »

After restarting Z-Way MqttClient works well for me:

Code: Select all

[2020-11-02 18:54:26.436] [I] [core] Instantiating module 41 from class MQTT
[2020-11-02 18:54:26.438] [I] [core] --- Starting module MQTT
[2020-11-02 18:54:26.498] [I] [core] Executing script: /*** Buffer ******************************************************************* ...
[2020-11-02 18:54:26.502] [I] [core] Executing script: /*** MQTTClient ************************************************************** ...
[2020-11-02 18:54:26.538] [I] [core] [MQTT-41] Socket connection opened.
[2020-11-02 18:54:26.539] [I] [core] [MQTT-41] Connected to localhost as zway

Code: Select all

pi@raspberrypi:~ $ sudo mosquitto
1604332024: mosquitto version 1.5.7 starting
1604332024: Using default config.
1604332024: Opening ipv4 listen socket on port 1883.
1604332024: Opening ipv6 listen socket on port 1883.
1604332466: New connection from 127.0.0.1 on port 1883.
1604332466: New client connected from 127.0.0.1 as zway (c0, k30).
I think the problem occurs when MqttClient doesn't close the socket after reloading the instance.
zwaFisher
Posts: 25
Joined: 12 Jul 2020 13:53

Re: MQTT App connection problems

Post by zwaFisher »

Hi.
Has anyone overcome the issue with Zway unable to publish to mqtt.
On Mosquitto side it looks like

Code: Select all

1611934649: New connection from 127.0.0.1:54531 on port 1883.
1611934650: Client <unknown> closed its connection.
Also found the logs of Zway:
[2021-02-05 21:18:48.886] [core] --- Starting module Dummy Device
[2021-02-05 21:18:48.895] [core] Creating device switchBinary DummyDevice_16
[2021-02-05 21:20:27.778] [core] --- Starting module MQTT
[2021-02-05 21:20:28.009] [core] Executing script: /*** Buffer ******************************************************************* ...
[2021-02-05 21:20:28.009] [core] Executing script: /*** MQTTClient ************************************************************** ...
[2021-02-05 21:20:29.073] [core] --- ERROR: Can't register duplicate module instance: 15
[2021-02-05 21:20:29.073] [core] Notification: error (core): Can't register duplicate module instance: 15
[2021-02-05 21:21:28.110] [core] [MQTT_15] Error: Error: Timeout
at MQTT.BaseModule.error (automation/userModules/BaseModule/index.js:122:17)
at MQTTClient._errorCallback (automation/userModules/MQTT/index.js:109:46)
at MQTTClient._onError (automation/userModules/MQTT/lib/mqtt.js:276:10)
at MQTTClient._onTimeout (automation/userModules/MQTT/lib/mqtt.js:307:8)
at Function.<anonymous> (automation/userModules/MQTT/lib/mqtt.js:472:40)
[2021-02-05 21:22:14.178] [core] Reading remote id has failed. Service is not available.
[2021-02-05 21:22:14.213] [core] Error: пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅ.
zwaFisher
Posts: 25
Joined: 12 Jul 2020 13:53

Re: MQTT App connection problems

Post by zwaFisher »

I've set up a fresh virtual PC with win10, Z-way, mosquitto. All latest versions.
With the same outcome.
There is definatelly a problem with MQTT module. Hope that it will be addressed soon. THis is one the most important modules for 3rd party integration, I would say.

Code: Select all

[I] [core] [MQTT_15] Error: Error: Timeout
User avatar
PoltoS
Posts: 6289
Joined: 26 Jan 2011 19:36

Re: MQTT App connection problems

Post by PoltoS »

Looks like MQTT connection times out. Can you check it with wireshark?
Post Reply