MxMQTT Subscriber from piet66 | Control a switch

Discussions about Z-Way software and Z-Wave technology in general
EnricoC
Posts: 6
Joined: 18 Jan 2023 18:56

MxMQTT Subscriber from piet66 | Control a switch

Post by EnricoC »

Hi,
I've invest some time of integrating a the Zigbee2MQTT into Zway through the app MxMQTT Subscriber. Many thanks for @piet66 for his work so far.
Anyway after a long time of try and error, I really need some help on configure a switch with the subsciber.

Setting the state to on/off works through the MQTTExplorer and Zigbee2MQTT. My customizing issue must be in the subscriber app.

MQTT:
Value: {"child_lock":"UNLOCK","current":0,"energy":0,"indicator_mode":"off/on","linkquality":47,"power":0,"power_outage_memory":"off","state":"OFF","voltage":223}

Setting a new state over MQTT works with publish to topic:
topic: zigbee2mqtt/(S) Stecker1/set
value:
{
"state": "ON"
}

Configuration in subscriber app

General:
Prefix for Topics Sent Back to MQTT Broker: set
Suffix for Topics Sent Back to MQTT Broker:none
Alter Topics Sent Back to MQTT Broker: none


Create Virtual Devices for Single Topics :
  • Topic: zigbee2mqtt/(S) Stecker1
    icon: ../../../../../../smarthome/storage/img/icons/switch-off.png
    conditional icon: valueObj.state.toString() === "ON" ? '../../../../../../smarthome/storage/img/icons/switch-on.png' : '../../../../../../smarthome/storage/img/icons/switch-off.png'
    Create operable widget: true -> on-off switch
If i configure the virtual device as only reading everything works as expected.

If I switch in the operable mode with the same customizing, the icons don't change, no value change comes up in this virtual device (in case of manual switching the device) and there is no update on the MQTT server after pressing the button in zway.

Please could you help me, solving this issue.

Many thanks
Heinrich
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by piet66 »

Hi Heinrich,
nice to see, that my app is useful for somebody :D .

You can try following:

Code: Select all

Icon: switch-on
Conditional Icon:  level === 'off' ? 'switch-off' : 'icon' 
Data Type: user defined switch
List of Values: OFF:ON
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
EnricoC
Posts: 6
Joined: 18 Jan 2023 18:56

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by EnricoC »

Hi Piet66,
for my purpose your subscriber app fits perfectly my needs. :D
Unfortunatly your hints didn't work for me. The z-wave-server drops the following error messages after pressing the button. Do you have any idea what the error could be? I would be very grateful for an answer.
Heinrich

Code: Select all

[2023-01-19 22:31:01.108] [I] [core] ---  MxMQTTSub_3-userswitch_20 performCommand processing: {"0":"on","1":{}}
[2023-01-19 22:31:01.114] [I] [core] Notification: device-info (device-OnOff): {"dev":"Stecker1 ⚫","l":"on","location":0}
[2023-01-19 22:31:01.138] [I] [core] Notification: error (module): Fehler beim Ausführen des Befehls: TypeError: Cannot read property '0' of undefined
[2023-01-19 22:31:01.156] [I] [core] TypeError: Cannot read property '0' of undefined
    at MxMQTTSub.processDevCallback (automation/userModules/MxMQTTSub/index.js:1007:42)
    at MxMQTTSub.onPoll (automation/userModules/MxMQTTSub/index.js:854:18)
    at MxMQTTSub.MxBaseModule.callOnPoll (automation/userModules/MxBaseModule/index.js:703:10)
    at callback (automation/userModules/MxBaseModule/index.js:1513:22)
    at EventEmitter.emit (automation/lib/eventemitter2.js:311:33)
    at _.extend.emit (automation/classes/VirtualDevice.js:396:26)
    at automation/classes/VirtualDevice.js:324:10
    at Array.forEach (native)
    at _.extend.set (automation/classes/VirtualDevice.js:320:12)
    at vStruct.handler (automation/userModules/MxBaseModule/index.js:2038:33)
[2023-01-19 22:31:01.158] [I] [core] [BaseModule-21] Set lastLevel to on for MxMQTTSub_3-userswitch_20 (was null)
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by piet66 »

Hi,
I've found the place, where it's happening. But I need more information to understand, why.

- is this problem persistent, or only at first switching? I think it's persistent.
- are there error messages in the log after starting the module? For example, such as ''eval error: wrong format'?
- what value do you have in the config field 'Topics /Alter Topics Sent Back to MQTT Broker'?
- can you please try with:
Alter Topics Sent Back to MQTT Broker= replace('/xxx/', '/xxx/')
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by piet66 »

In the new version 1.2.5 it's fixed.
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
EnricoC
Posts: 6
Joined: 18 Jan 2023 18:56

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by EnricoC »

Dear piet66,
thanks for updating the module.
Now I facing the following error.
[2023-05-30 14:45:47.859] [core] TypeError: Cannot read property 'hasOwnProperty' of undefined
at MxMQTTSub.processDevCallback (automation/userModules/MxMQTTSub/index.js:927:40)
at MxMQTTSub.onPoll (automation/userModules/MxMQTTSub/index.js:862:18)
at MxMQTTSub.MxBaseModule.callOnPoll (automation/userModules/MxBaseModule/index.js:703:10)
at callback (automation/userModules/MxBaseModule/index.js:1513:22)
at EventEmitter.emit (automation/lib/eventemitter2.js:311:33)
at _.extend.emit (automation/classes/VirtualDevice.js:396:26)
at automation/classes/VirtualDevice.js:324:10
at Array.forEach (native)
at _.extend.set (automation/classes/VirtualDevice.js:320:12)
at vStruct.handler (automation/userModules/MxBaseModule/index.js:2038:33)
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by piet66 »

Hi,
sorry that there are still issues in the program. But unfortunately, it has become quite complex. :cry:

I can fix the bug on this line, even if I don't know the original cause.

Do you have any clue as to why? Are there more message after these?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
EnricoC
Posts: 6
Joined: 18 Jan 2023 18:56

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by EnricoC »

It is crazy with your 1.2 I found a configuration which worked for me. With the 1.25 I'm having more issues than before.
To avoid any error regarding the migration from 1.2 to 1.25 I deleted all customizing and started from scratch. After customizing the window sensors the log have these errors. It seams that the subscriber crashes and restarts after a few seconds.

[2023-05-30 16:46:55.414] [core] [MxMQTTSub-20/MxMQTT Subscriber] start communication...
[2023-05-30 16:46:55.415] [core] [MxMQTTSub-20/MxMQTT Subscriber] prepareMQTT...
[2023-05-30 16:46:55.418] [core] [MxMQTTSub-20/MxMQTT Subscriber] startTcp...
[2023-05-30 16:46:55.418] [core] [MxMQTTSub-20/MxMQTT Subscriber] creating a new tcp socket...
[2023-05-30 16:46:56.081] [core] [MxMQTTSub-20/MxMQTT Subscriber] connecting to localhost:1883
[2023-05-30 16:46:56.083] [core] [MxMQTTSub-20/MxMQTT Subscriber] tcp connected.
[2023-05-30 16:46:56.086] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendCONNECT...
[2023-05-30 16:46:56.127] [core] [MxMQTTSub-20/MxMQTT Subscriber] socket closed by remote: ["onrecv","onclose","onerror"]: {}
[2023-05-30 16:46:56.129] [core] [MxMQTTSub-20/MxMQTT Subscriber] close communication...
[2023-05-30 16:46:56.153] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"waiting...","location":0}
[2023-05-30 16:46:56.165] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 4
[2023-05-30 16:46:56.168] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] recvCONNACK...
[2023-05-30 16:46:56.169] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] CONNECT acknowledged
[2023-05-30 16:46:56.170] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPUBLISH...
[2023-05-30 16:46:56.171] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] ----- send: message_id: : qos: 0: topic: MxMQTTSub-20/status: payload: online
[2023-05-30 16:46:57.114] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendSUBSCRIBE...
[2023-05-30 16:46:57.116] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/GartenWasser/#"}
[2023-05-30 16:46:57.117] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) Büro/#"}
[2023-05-30 16:46:57.119] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) Leo/#"}
[2023-05-30 16:46:57.120] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) ElternR/#"}
[2023-05-30 16:46:57.121] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) ElternL/#"}
[2023-05-30 16:46:57.121] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(S) Stecker1/#"}
[2023-05-30 16:46:58.125] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] initPing...
[2023-05-30 16:46:58.140] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] stop
[2023-05-30 16:46:58.140] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] close communication...
[2023-05-30 16:46:58.140] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] clearing timerReconnect...
[2023-05-30 16:46:58.157] [I] [core] Deleting device switchBinary MxMQTTSub_logging_20
[2023-05-30 16:46:58.183] [I] [core] Deleting device sensorMultilevel MxMQTTSub_status_20
[2023-05-30 16:46:58.200] [I] [core] Notification: info (module): History removed for device: MxMQTTSub-20 MQTT State
[2023-05-30 16:46:58.203] [I] [core] "000"
[2023-05-30 16:46:58.205] [I] [core] Deleting device text MxMQTTSub_info_20
[2023-05-30 16:46:58.209] [I] [core] Deleting device sensorMultiline MxMQTTSub_multiline_20
[2023-05-30 16:46:58.212] [I] [core] Deleting device sensorMultilevel MxMQTTSub_0_20
[2023-05-30 16:46:58.224] [I] [core] Notification: info (module): History removed for device: (F) Leo 🟢
[2023-05-30 16:46:58.225] [I] [core] "000"
[2023-05-30 16:46:58.227] [I] [core] Deleting device sensorMultilevel MxMQTTSub_1_20
[2023-05-30 16:46:58.236] [I] [core] Notification: info (module): History removed for device: (F) Büro 🟢
[2023-05-30 16:46:58.237] [I] [core] "000"
[2023-05-30 16:46:58.238] [I] [core] Deleting device sensorMultilevel MxMQTTSub_2_20
[2023-05-30 16:46:58.248] [I] [core] Notification: info (module): History removed for device: (F) Eltern Links
[2023-05-30 16:46:58.249] [I] [core] "000"
[2023-05-30 16:46:58.251] [I] [core] Deleting device sensorMultilevel MxMQTTSub_3_20
[2023-05-30 16:46:58.263] [I] [core] Notification: info (module): History removed for device: (F) Eltern Rechts
[2023-05-30 16:46:58.264] [I] [core] "000"
[2023-05-30 16:46:58.265] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] . --------------------- stop MxMQTTSub-20 V1.2.5 2023-01-22/peb ---------------------------
[2023-05-30 16:46:58.265] [I] [core] --- Stopping module MxMQTT Subscriber
[2023-05-30 16:46:58.270] [I] [core] --- Starting module MxMQTT Subscriber
[2023-05-30 16:46:58.297] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] . --------------------- init MxMQTTSub-20 V1.2.5 2023-01-22/peb ---------------------------
[2023-05-30 16:46:58.302] [I] [core] Creating device switchBinary MxMQTTSub_logging_20
[2023-05-30 16:46:58.329] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] MQTTBrokerData: 127.0.0.1: 1883: none: none
[2023-05-30 16:46:58.329] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] MQTTClientData: MxMQTTSub-20
[2023-05-30 16:46:58.330] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] MQTTSubscription: zigbee2mqtt/(T) Leo/#,zigbee2mqtt/(T) Büro/#,zigbee2mqtt/(T) ElternR/#,zigbee2mqtt/(T) ElternL/#,zigbee2mqtt/(S) Stecker1/#,zigbee2mqtt/GartenWasser/#
[2023-05-30 16:46:58.331] [I] [core] Creating device sensorMultilevel MxMQTTSub_status_20
[2023-05-30 16:46:58.361] [I] [core] Notification: info (module): History added to device: MxMQTTSub-20 MQTT State
[2023-05-30 16:46:58.363] [I] [core] "000"
[2023-05-30 16:46:58.368] [I] [core] Creating device text MxMQTTSub_info_20
[2023-05-30 16:46:58.375] [I] [core] Creating device sensorMultiline MxMQTTSub_multiline_20
[2023-05-30 16:46:58.383] [I] [core] Creating device sensorMultilevel MxMQTTSub_0_20
[2023-05-30 16:46:58.413] [I] [core] Notification: info (module): History added to device: (F) Leo 🟢
[2023-05-30 16:46:58.414] [I] [core] "000"
[2023-05-30 16:46:58.421] [I] [core] Notification: device-info (device-status): {"dev":"(F) Leo","l":"null","location":0}
[2023-05-30 16:46:58.425] [I] [core] Creating device sensorMultilevel MxMQTTSub_1_20
[2023-05-30 16:46:58.450] [I] [core] Notification: info (module): History added to device: (F) Büro 🟢
[2023-05-30 16:46:58.451] [I] [core] "000"
[2023-05-30 16:46:58.566] [I] [core] Notification: device-info (device-status): {"dev":"(F) Büro","l":"null","location":0}
[2023-05-30 16:46:58.568] [I] [core] Creating device sensorMultilevel MxMQTTSub_2_20
[2023-05-30 16:46:58.595] [I] [core] Notification: info (module): History added to device: (F) Eltern Links
[2023-05-30 16:46:58.596] [I] [core] "000"
[2023-05-30 16:46:58.603] [I] [core] Creating device sensorMultilevel MxMQTTSub_3_20
[2023-05-30 16:46:58.629] [I] [core] Notification: info (module): History added to device: (F) Eltern Rechts
[2023-05-30 16:46:58.629] [I] [core] "000"
[2023-05-30 16:46:58.642] [I] [core] Executing script: /*** Buffer ******************************************************************* ...
[2023-05-30 16:46:58.681] [I] [core] [BaseModule-21] Set lastLevel to waiting... for MxMQTTSub_status_20 (was connecting...)
[2023-05-30 16:46:58.685] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 131
[2023-05-30 16:46:58.686] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] SUBSCRIBE acknowledged
[2023-05-30 16:46:58.687] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 121
[2023-05-30 16:46:58.689] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] recvPUBLISH...
[2023-05-30 16:46:58.691] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] ----- received: message_id: 0: qos: 0: topic: dup: 0: zigbee2mqtt/(T) Büro: payload: {"battery":27,"battery_low":false,"contact":true,"linkquality":57,"tamper":false,"voltage":2600}
[2023-05-30 16:46:58.703] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] data not changed
[2023-05-30 16:46:58.717] [I] [core] [BaseModule-21] Set lastLevel to waiting... for MxMQTTSub_status_20 (was connecting...)
[2023-05-30 16:46:58.719] [I] [core] [BaseModule-21] Set lastLevel to null for MxMQTTSub_0_20 (was 0)
[2023-05-30 16:46:58.720] [I] [core] [BaseModule-21] Set lastLevel to null for MxMQTTSub_1_20 (was 0)
[2023-05-30 16:46:59.011] [I] [zway] Adding job: Get background noise level
[2023-05-30 16:46:59.017] [D] [zway] SENDING: ( 01 03 00 3B C7 )
[2023-05-30 16:46:59.019] [D] [zway] RECEIVED ACK
[2023-05-30 16:46:59.019] [D] [zway] RECEIVED: ( 01 05 01 3B B6 B5 C3 )
[2023-05-30 16:46:59.019] [D] [zway] SENT ACK
[2023-05-30 16:46:59.019] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel1 = 182 (0x000000b6)
[2023-05-30 16:46:59.019] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel2 = 181 (0x000000b5)
[2023-05-30 16:46:59.019] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel3 = 127 (0x0000007f)
[2023-05-30 16:46:59.019] [I] [zway] Job 0x3b (Get background noise level): RSSI Ch#1: -74 dBm, Ch#2: -75 dBm, Ch#3: not available
[2023-05-30 16:46:59.019] [D] [zway] Job 0x3b (Get background noise level): success
[2023-05-30 16:46:59.019] [I] [zway] Removing job: Get background noise level
[2023-05-30 16:47:00.658] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] waiting for 1 minutes...
[2023-05-30 16:47:03.049] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:03.209] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:03.210] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:08.475] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:09.286] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:09.287] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:14.725] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:15.368] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:15.370] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:19.251] [D] [zway] Job 0x3b: deleted from queue
[2023-05-30 16:47:22.989] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:23.463] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:23.465] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:27.286] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:27.517] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:27.518] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:28.920] [I] [zway] Adding job: Get background noise level
[2023-05-30 16:47:28.929] [D] [zway] SENDING: ( 01 03 00 3B C7 )
[2023-05-30 16:47:28.931] [D] [zway] RECEIVED ACK
[2023-05-30 16:47:28.932] [D] [zway] RECEIVED: ( 01 05 01 3B B5 B0 C5 )
[2023-05-30 16:47:28.932] [D] [zway] SENT ACK
[2023-05-30 16:47:28.932] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel1 = 181 (0x000000b5)
[2023-05-30 16:47:28.932] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel2 = 176 (0x000000b0)
[2023-05-30 16:47:28.933] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel3 = 127 (0x0000007f)
[2023-05-30 16:47:28.934] [I] [zway] Job 0x3b (Get background noise level): RSSI Ch#1: -75 dBm, Ch#2: -80 dBm, Ch#3: not available
[2023-05-30 16:47:28.934] [D] [zway] Job 0x3b (Get background noise level): success
[2023-05-30 16:47:28.934] [I] [zway] Removing job: Get background noise level
[2023-05-30 16:47:30.580] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:31.572] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:31.572] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:32.210] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:32.593] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:32.593] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:46.181] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:46.759] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:47.760] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:47.761] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:47.782] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:47.782] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:49.145] [D] [zway] Job 0x3b: deleted from queue
[2023-05-30 16:47:58.387] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:58.951] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:58.952] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:47:58.973] [I] [zway] Adding job: Get background noise level
[2023-05-30 16:47:58.975] [D] [zway] SENDING: ( 01 03 00 3B C7 )
[2023-05-30 16:47:58.977] [D] [zway] RECEIVED ACK
[2023-05-30 16:47:58.977] [D] [zway] RECEIVED: ( 01 05 01 3B B6 AB DD )
[2023-05-30 16:47:58.978] [D] [zway] SENT ACK
[2023-05-30 16:47:58.978] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel1 = 182 (0x000000b6)
[2023-05-30 16:47:58.978] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel2 = 171 (0x000000ab)
[2023-05-30 16:47:58.978] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel3 = 127 (0x0000007f)
[2023-05-30 16:47:58.979] [I] [zway] Job 0x3b (Get background noise level): RSSI Ch#1: -74 dBm, Ch#2: -85 dBm, Ch#3: not available
[2023-05-30 16:47:58.979] [D] [zway] Job 0x3b (Get background noise level): success
[2023-05-30 16:47:58.979] [I] [zway] Removing job: Get background noise level
[2023-05-30 16:47:59.394] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:47:59.936] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] onDataReceived...: chunk.length: 2
[2023-05-30 16:47:59.937] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] PINGREQ acknowledged
[2023-05-30 16:48:00.684] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] start communication...
[2023-05-30 16:48:00.688] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] creating a new tcp socket...
[2023-05-30 16:48:00.957] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"connecting...","location":0}
[2023-05-30 16:48:00.967] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] socket created: object: ["onrecv","onclose","onerror"]: {}
[2023-05-30 16:48:00.968] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] connecting to 127.0.0.1:1883
[2023-05-30 16:48:01.991] [I] [core] [BaseModule-21] Set lastLevel to connecting... for MxMQTTSub_status_20 (was waiting...)
[2023-05-30 16:48:01.996] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] tcp connection closed by remote
[2023-05-30 16:48:01.998] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] close communication...
[2023-05-30 16:48:01.999] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] initPing...
[2023-05-30 16:48:02.001] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendUNSUBSCRIBE...
[2023-05-30 16:48:02.002] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/GartenWasser/#"}
[2023-05-30 16:48:02.005] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) Büro/#"}
[2023-05-30 16:48:02.008] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) Leo/#"}
[2023-05-30 16:48:02.009] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) ElternR/#"}
[2023-05-30 16:48:02.010] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(T) ElternL/#"}
[2023-05-30 16:48:02.011] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] {"qos":1,"topic":"zigbee2mqtt/(S) Stecker1/#"}
[2023-05-30 16:48:02.979] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPUBLISH...
[2023-05-30 16:48:02.981] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] ----- send: message_id: : qos: 0: topic: MxMQTTSub-20/status: payload: offline
[2023-05-30 16:48:02.983] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendDISCONNECT...
[2023-05-30 16:48:02.984] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] clearing tcp connection...
[2023-05-30 16:48:02.986] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] setTimerReconnect...
[2023-05-30 16:48:02.986] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] waiting for 60 seconds...
[2023-05-30 16:48:02.999] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"connected","location":0}
[2023-05-30 16:48:03.993] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"send data","location":0}
[2023-05-30 16:48:05.003] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"subscribing...","location":0}
[2023-05-30 16:48:05.007] [I] [core] [BaseModule-21] Set lastLevel to connecting... for MxMQTTSub_status_20 (was waiting...)
[2023-05-30 16:48:05.032] [I] [core] [BaseModule-21] Set lastLevel to connected for MxMQTTSub_status_20 (was connecting...)
[2023-05-30 16:48:05.036] [I] [core] [BaseModule-21] Set lastLevel to send data for MxMQTTSub_status_20 (was connecting...)
[2023-05-30 16:48:05.044] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"subscribed","location":0}
[2023-05-30 16:48:05.050] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 MQTT State","l":"recv data","location":0}
[2023-05-30 16:48:05.097] [I] [core] Notification: device-info (device-status): {"dev":"MxMQTTSub-20 Multiline Device 🟢","l":"1","location":0}
[2023-05-30 16:48:05.099] [I] [core] [BaseModule-21] Set lastLevel to subscribing... for MxMQTTSub_status_20 (was connecting...)
[2023-05-30 16:48:05.122] [I] [core] [BaseModule-21] Set lastLevel to subscribed for MxMQTTSub_status_20 (was send data)
[2023-05-30 16:48:05.125] [I] [core] [BaseModule-21] Set lastLevel to recv data for MxMQTTSub_status_20 (was send data)
[2023-05-30 16:48:05.127] [I] [core] [BaseModule-21] Set lastLevel to 1 for MxMQTTSub_multiline_20 (was 4)
[2023-05-30 16:48:10.525] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:10.535] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:19.198] [D] [zway] Job 0x3b: deleted from queue
[2023-05-30 16:48:23.365] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:23.374] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:28.674] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:28.683] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:28.947] [I] [zway] Adding job: Get background noise level
[2023-05-30 16:48:28.947] [D] [zway] SENDING: ( 01 03 00 3B C7 )
[2023-05-30 16:48:28.949] [D] [zway] RECEIVED ACK
[2023-05-30 16:48:28.949] [D] [zway] RECEIVED: ( 01 05 01 3B B5 B0 C5 )
[2023-05-30 16:48:28.949] [D] [zway] SENT ACK
[2023-05-30 16:48:28.949] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel1 = 181 (0x000000b5)
[2023-05-30 16:48:28.950] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel2 = 176 (0x000000b0)
[2023-05-30 16:48:28.950] [D] [zway] SETDATA controller.data.statistics.backgroundRSSI.channel3 = 127 (0x0000007f)
[2023-05-30 16:48:28.950] [I] [zway] Job 0x3b (Get background noise level): RSSI Ch#1: -75 dBm, Ch#2: -80 dBm, Ch#3: not available
[2023-05-30 16:48:28.950] [D] [zway] Job 0x3b (Get background noise level): success
[2023-05-30 16:48:28.950] [I] [zway] Removing job: Get background noise level
[2023-05-30 16:48:35.677] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:35.686] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:40.682] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:40.691] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:41.188] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:41.198] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:49.159] [D] [zway] Job 0x3b: deleted from queue
[2023-05-30 16:48:53.619] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:53.628] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)
[2023-05-30 16:48:53.973] [I] [core] [MxMQTTSub-20/MxMQTT Subscriber] sendPINGREQ...
[2023-05-30 16:48:53.982] [E] [core] Callback execution error: TypeError: undefined is not a function
at MxMQTTSub.sendTcp (automation/userModules/MxMQTTSub/index.js:1246:15)
at MxMQTTSub.sendPINGREQ (automation/userModules/MxMQTTSub/index.js:2529:10)
at Function.<anonymous> (automation/userModules/MxMQTTSub/index.js:2474:18)

Basic Configuration is:
"moduleId": "MxMQTTSub",
"active": "true",
"title": "MxMQTT Subscriber",
"params": {
"logging": false,
"MxBMRequired": "3.7",
"uniqueId": 65326935380,
"COMMENT": "remaining defaults are defined in postRender.js",
"loggingDev": {
"createDevice": true,
"deviceTitle": "%M%-%I% Logging",
"icon": "icon.png"
},
"Variables": {
"InstNo": "%I%",
"ModName": "%M%",
"Unique": "%U%",
"UserVariable": "%M%-%I%"
},
"MQTTClientData": {
"clientId": "%X%",
"clientIdRandomize": false
},
"MQTTBrokerData": {
"host": "127.0.0.1",
"port": "1883",
"user": "none",
"password": "none"
},
"MQTTSubscription": {
"topics": "zigbee2mqtt/(T) Leo/#\nzigbee2mqtt/(T) B\u00fcro/#\nzigbee2mqtt/(T) ElternR/#\nzigbee2mqtt/(T) ElternL/#\nzigbee2mqtt/(S) Stecker1/#\nzigbee2mqtt/GartenWasser/#",
"objectKeys": "val:lc:ack:ts",
"prefix": "set",
"suffix": "none",
"replace": "none"
},
"statusDev": {
"createDevice": true,
"deviceTitle": "%M%-%I% MQTT State",
"icon": "icon.png",
"dispPingEvents": false
},
"htmlDev": {
"createDevice": true,
"deviceTitle": "%M%-%I% Html Page",
"icon": "icon.png"
},
"multilineDev": {
"createDevice": true,
"deviceTitle": "%M%-%I% Multiline Device",
"icon": "icon.png"
},
"specPoints": {
"notification": false,
"scriptLinux": false
},
"specDevices": {
"Arr": [
{
"Topic": "zigbee2mqtt/(T) Leo",
"deviceTitle": "(F) Leo",
"icon": "../../../../../../smarthome/storage/img/icons/door-open.png",
"conditionalIcon": "valueObj.contact === true ? \"../../../../../../smarthome/storage/img/icons/door-closed.png\" : \"../../../../../../smarthome/storage/img/icons/door-open.png\"",
"writeAccess": false,
"convertLevelEval": "valueObj.contact === true ? 0:1",
"multilineHistory": false
},
{
"Topic": "zigbee2mqtt/(T) B\u00fcro",
"deviceTitle": "(F) B\u00fcro",
"icon": "../../../../../../smarthome/storage/img/icons/door-open.png",
"conditionalIcon": "valueObj.contact === true ? \"../../../../../../smarthome/storage/img/icons/door-closed.png\" : \"../../../../../../smarthome/storage/img/icons/door-open.png\"",
"writeAccess": false,
"convertLevelEval": "valueObj.contact === true ? 0:1",
"multilineHistory": false
},
{
"Topic": "zigbee2mqtt/(T) ElternL",
"deviceTitle": "(F) Eltern Links",
"icon": "../../../../../../smarthome/storage/img/icons/door-open.png",
"conditionalIcon": "valueObj.contact === true ? \"../../../../../../smarthome/storage/img/icons/door-closed.png\" : \"../../../../../../smarthome/storage/img/icons/door-open.png\"",
"writeAccess": false,
"convertLevelEval": "valueObj.contact === true ? 0:1",
"multilineHistory": false
},
{
"Topic": "zigbee2mqtt/(T) ElternR",
"deviceTitle": "(F) Eltern Rechts",
"icon": "../../../../../../smarthome/storage/img/icons/door-open.png",
"conditionalIcon": "valueObj.contact === true ? \"../../../../../../smarthome/storage/img/icons/door-closed.png\" : \"../../../../../../smarthome/storage/img/icons/door-open.png\"",
"writeAccess": false,
"convertLevelEval": "valueObj.contact === true ? 0:1",
"multilineHistory": false
}
]
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by piet66 »

Hi,
I don't think, that this behavior has anything to do with the latest version. I have changed only a little thing and this version is running on my system since months without problems.

I tried to reproduce this on my system, but I didn't succeed.

It looks like it's a problem with the TCP socket. It wasn't closed correctly. Don't know how this can happen. But there are situations when the app isn't run through the stop procedure.

To solve such a situation, you can do a reboot. If the MQTT broker is running on a different system, reboot this too.
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
EnricoC
Posts: 6
Joined: 18 Jan 2023 18:56

Re: MxMQTT Subscriber from piet66 | Control a switch

Post by EnricoC »

Dear Piet
restarts solved my issues.

Error messages:
Anyway I faced this error " TypeError: undefined is not a function" during customizing the app often and had to restart the raspberry to continue. Also after a few days sometimes the messages comes up. I could not find the reason for this message.

The configuration of my system is in case you want to step into troubleshooting.

- Raspberry 3 rpi3 6.1.21-v7+
- Z-way 4.1.0
- Mosquitto version 2.0.11
-Zigbee2MQTT 1.29.1 commit: 7d67ffc

Operable widgets
The operable widgets are working now with one exempt.

The widgets differs a little bit from the only reading widgets. The dot behind the name is black and not green.

If I switch the device in the zway GUI with the buttons everthings works as espected. The dot behind the name switches to blue and than back to black. If I press the icon and not the buttons the dot switches to blue and black but the devices status is not changed. (Switching the device in the mobile view is not working)

In addition the gui not showing state changes, which are fired by the device. If I press the on button the Gui does not change the icon but I can see in the logs that the event was received by the subsciber.

If you change from a operable widgets to a readonly widget the state changes are shown in the gui.

I this behavior correct?


Heinrich
Post Reply