formtapez / ZigUP

CC2530 based multi-purpose ZigBee Relais, Switch, Sensor and Router
314 stars 73 forks source link

Cannot read property '41368' of undefined #13

Closed copystring closed 4 years ago

copystring commented 4 years ago

Not sure if this is an issue with ZigUP or z2m. Let me know if it does not belong here.

I am getting a lot of this:

Oct 19 11:17:12 raspberrypi npm[9723]: zigbee2mqtt:error 2019-10-19T09:17:12: Failed to call 'DeviceReceive' 'onZigbeeEvent' (TypeError: Cannot read property '41368' of undefined
Oct 19 11:17:12 raspberrypi npm[9723]:     at Object.convert (/opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/converters/fromZigbee.js:1353:30)
Oct 19 11:17:12 raspberrypi npm[9723]:     at converters.forEach (/opt/zigbee2mqtt/lib/extension/deviceReceive.js:146:41)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Array.forEach (<anonymous>)
Oct 19 11:17:12 raspberrypi npm[9723]:     at DeviceReceive.onZigbeeEvent (/opt/zigbee2mqtt/lib/extension/deviceReceive.js:144:20)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Controller.callExtensionMethod (/opt/zigbee2mqtt/lib/controller.js:320:44)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Controller.onZigbeeEvent (/opt/zigbee2mqtt/lib/controller.js:228:14)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Zigbee.emit (events.js:198:13)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Controller.herdsman.on (/opt/zigbee2mqtt/lib/zigbee.js:56:52)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Controller.emit (events.js:198:13)
Oct 19 11:17:12 raspberrypi npm[9723]:     at Controller.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/controller.js:405:22))

Looking at the code of z2m it seems it does that with the precompiled firmware since it does not have the temp sensor connected?

formtapez commented 4 years ago

Property '41368' is a newer way of reporting DS18B20 sensors. It is used even if you have no sensors. Support for that is merged into Zigbee2MQTT source, but it seems that it hasn't reached into the "stable" channel yet. You can manually update this file just by replacing it: https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/converters/fromZigbee.js

copystring commented 4 years ago

Replace it? Not sure what to replace it with. Or do you meant to delete it?

formtapez commented 4 years ago

Replace the file from your zigbee2mqtt installation with that linked file from the zigbee2mqtt repository.

copystring commented 4 years ago

Oh. Sorry I missunderstood. I already have that file on my system. Using the dev version of z2m only updated it yesterday and that includes this file.

formtapez commented 4 years ago

Hm, do you find '41368' in that file?

copystring commented 4 years ago

Yes. It is there. This is why I am wondering what is going on :)

This is what mine looks like:

https://imgur.com/Y56lz6H

formtapez commented 4 years ago

Ah, okay. Sorry, i see the problem now. I forgot to publish the new precompiled firmware which is sending that 41368 property. Have a look at https://github.com/formtapez/ZigUP/releases

copystring commented 4 years ago

Okay. I flashed my devices again. Now I cannot control them anymore. They do not rejoin even after resetting.

formtapez commented 4 years ago

Deleting them from your zigbee2mqtt database-file before re-pairing helps.

copystring commented 4 years ago

Yes. I tried this. I think it has something to do with the channel. No idea how it worked before since you compiled it with channel 25 and I use channel 11. Looked into compiling myself. It is a pain... Could you make one with channel 11 as well? Surely that makes sense. That is the default channel. Most people use this one.

copystring commented 4 years ago

Okay. I managed to compile it with channel 11 and #define ATTRID_EXT_TEMPS 41368. Re-paired the device. The Problem remains.

copystring commented 4 years ago

In this file: https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/converters/fromZigbee.js

Line 1353: if (msg.data.data['41368']) {

Is that correct? Should it not be: if (msg.data['41368']) {?

The lines below line 1353 use msg.data instead of msg.data.data.

copystring commented 4 years ago

Changed

if (msg.data.data['41368']) { ds18b20Id = msg.data.data['41368'].split(':')[0]; ds18b20Value = precisionRound(msg.data.data['41368'].split(':')[1], 2); }

to

if (msg.data['41368']) { ds18b20Id = msg.data['41368'].split(':')[0]; ds18b20Value = precisionRound(msg.data['41368'].split(':')[1], 2); }

It actually works fine now. Also getting a lot more readings. Like CPU temp, etc. They did not appear before. Do you think this was the issue?