I have add my Xiaomi Honeywell smoke detector JTYJ-GD-01LM/BW and it works fine and publish the "smoke" state.
But the smoke detector is the didn't publish any state of the battery in MQTT.
Is it possible to get this state also as a publish?
For how long did you let it run? It should publish it's battery state after 1/2 hours.
Hi
I have the same issue, but I only get the smoke state when I press the test button. (last entry)
I should expect every hour the state with the battery, like an xiaomi door sensor does
2018-6-26 05:46:22 INFO 0x00158d0002092004 (0x00158d0002092004): MCCGQ11LM - Xiaomi Aqara door & window contact sensor (EndDevice)
2018-6-26 05:46:22 INFO 0x00158d0001fd66e2 (0x00158d0001fd66e2): JTYJ-GD-01LM/BW - Xiaomi MiJia Honeywell smoke detector (EndDevice)
2018-6-26 05:46:22 WARN `permit_join` set to `true` in configuration.yaml.
2018-6-26 05:46:22 WARN Allowing new devices to join.
2018-6-26 05:46:22 WARN Set `permit_join` to `false` once you joined all devices.
2018-6-26 05:46:22 INFO Zigbee: allowing new devices to join.
2018-6-26 05:46:22 INFO Connecting to MQTT server at mqtt://192.168.180.10
2018-6-26 05:46:22 INFO zigbee-shepherd ready
2018-6-26 05:46:22 INFO Connected to MQTT server
2018-6-26 05:46:22 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
2018-6-26 05:58:15 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 06:48:25 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 07:38:36 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 08:28:48 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 09:18:58 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 10:09:07 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 10:59:18 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 11:49:30 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 12:39:42 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 13:29:49 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 14:20:00 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 15:10:11 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3055}'
2018-6-26 16:00:22 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 16:50:33 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002092004', payload: '{"battery":"100.00","voltage":3065}'
2018-6-26 17:28:19 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0001fd66e2', payload: '{"smoke":false}'
I have run 4 devices for few days and only get the smoke state as publish. All of my other Xiaomi devices publish the battery state only the smoke detector didn't.
By pressing the Button the device is publishing only:
{"smoke":false}
Hope you can help
Can you try changing the entry of this device in node_modules/zigbee-shepherd-converters/devices.js to:
{
zigbeeModel: ['lumi.sensor_smoke'],
model: 'JTYJ-GD-01LM/BW',
description: 'MiJia Honeywell smoke detector',
supports: 'smoke',
vendor: 'Xiaomi',
fromZigbee: [fz.JTYJGD01LMBW_smoke, fz.ignore_basic_change],
toZigbee: [],
},
And check if any WARN: No converter available for.... messages appear?
I have try it and get this error by pressing the Button on smoke detector:
WARN No converter available for 'JTYJ-GD-01LM/BW' with cid 'genBasic' and type 'attReport'
any other ideas?
how can i help you to found the error and fix it?
Good! Can you now set advanced -> log_level: debug in data/configuration.yaml. https://github.com/Koenkk/zigbee2mqtt/wiki/Configuration
This will print the message.
OK, now im getting the message
2018-6-29 23:46:12 WARN No converter available for 'JTYJ-GD-01LM/BW' with cid 'genBasic' and type 'attReport'
2018-6-29 23:46:12 WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
2018-6-29 23:46:12 DEBUG Recieved zigbee message with data {"cid":"genBasic","data":{"modelId":"lumi.sensor_smoke"}}
2018-6-29 23:46:12 DEBUG Recieved zigbee message with data {"cid":"ssIasZone","zoneStatus":0}
2018-6-29 23:46:12 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d000202eff6', payload: '{"smoke":false}'
It doesn't contain any battery information.
Could you post the entry of this device from data/database.db?
I hope this is the right line...
{"id":11,"type":"EndDevice","ieeeAddr":"0x00158d000202eff6","nwkAddr":20594,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.sensor_smoke","epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":1026,"inClusterList":[0,1,3,12,18,1280],"outClusterList":[25],"clusters":{"genBasic":{"dir":{"value":1},"attrs":{}},"genPowerCfg":{"dir":{"value":1},"attrs":{}},"genIdentify":{"dir":{"value":1},"attrs":{}},"genAnalogInput":{"dir":{"value":1},"attrs":{}},"genMultistateInput":{"dir":{"value":1},"attrs":{}},"genOta":{"dir":{"value":2},"attrs":{}},"ssIasZone":{"dir":{"value":1},"attrs":{}}}}},"_id":"pCPL00secZLGvXec"}
That's the right line, but I don't see the battery being in.
@kirovilya can you help with this?
I have not Xiaomi Smoke sensor... I'll ask the users of my application for this issue.
Think, it was like for other xiaomi sensor. Strange that this is not so...
Confirmed. Battery not received :(
Need research events and data... I request a detailed log of work with the sensor.
Found some code here
https://github.com/veeceeoh/xiaomi-hubitat/blob/0c42285fc9c7cb4554d7b8968087d50ef9cb048b/devicedrivers/xiaomi-honeywell-smoke-detector.src/xiaomi-honeywell-smoke-detector.groovy#L86
In i can help, let me know...
@Sonsi79 Can you collect detailed log from smoke-sensor like describe here https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-debug#all-debug-logging during short press button on sensor. And put file here.
@kirovilya ok i will do it later after work and publish the results here...
Here's the log file from DEBUG run.
During this run i have first pressed buttons on my Switch and later pressed the button on smoke detector. It seems my thermometer also publish something during thins time.
I hope this file helps...
log.txt
@Sonsi79 that is not all... you need start DEBUG=* npm start and save all from console to file. So, command will be: DEBUG=* npm start > log.txt
Ok, done. Here the file...
log.txt
Hm it seems that most of Debug Infos wasn't Safe in this file.
Here the Output of Console during Debug start. I have copy/paste it.
debug_output.txt
@Sonsi79 Well! I think we got it:
cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 0, srcaddr: 20594, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 52, securityuse: 0, timestamp: 94508, transseqnumber: 0, len: 46, data: <Buffer 18 7f 0a 01 ff 42 28 01 21 85 0c 03 28 19 04 21 a8 43 05 21 0e 00 06 24 03 00 00 00 00 0a 21 00 00 08 21 04 10 64 20 00 96 23 00 00 00 00> } +21ms
Splited version of buffer:
18 7f 0a - header
01 ff - attrId ----- this is xiaomi attribute for heartbeat = 65281
42 - type 'charStr'
28 - length 40 byte
01 - index '1' ----- this is battery value of attribute
21 - type 'uint16'
85 0c - data ----- this is battery voltage = 3205
03 - index '3'
28 - type 'int8'
19 - data
04 - index '4'
21 - type 'uint16'
a8 43 - data
05 - index '5'
21 - type 'uint16'
0e 00 - data
06 - index '6'
24 - type 'uint40'
03 00 00 00 00 - data
0a 21 04 10 - '10' 'uint16' data
64 20 00 - '100' 'int8' data
96 23 00 00 00 00 - '150', 'uint32', data
So, this message is correctly understood by me, but why it not parsed by zigbee-shepherd...
Any ideas?
Or may be it is not from smoke sensor message :)
Is this the message from 0x00158d000202eff6?
This is my smoke detector for sure.
You can see it at Logfile
2018-7-4 10:57:19 [32mINFO[39m 0x00158d000202eff6 (0x00158d000202eff6): JTYJ-GD-01LM/BW - Xiaomi MiJia Honeywell smoke detector (EndDevice)
I think I understand the reason.
The specified length of the charStr does not match the length of the data in the buffer.
In the evening I'll try again and suggest how to fix it.
Found this case with FF01 attribute https://github.com/Frans-Willem/AqaraHub/commit/a2cc15fad172ccb9a323f30ea50991e6001c32d0#diff-e45011ea876daa1366f56d10f998db49
You're great. Thanks much.
@Sonsi79 Ok. let's try.
find file /node_modules/zcl-packet/lib/foundation.js:652.
was:
if (stopLen <= parsedBufLen ) end();
change to:
if (this._buffer.length <= parsedBufLen+1) end();
after that was error TypeError: ru[dataType] is not a function - it fixing in file /node_modules/zcl-packet/lib/foundation.js:681.
was:
this.tap(function () {
var dataType = getDataType(this.vars[dataTypeParam]);
ru[dataType](name)(this);
});
change to:
this.tap(function () {
if (this.vars[dataTypeParam]) {
var dataType = getDataType(this.vars[dataTypeParam]);
ru[dataType](name)(this);
}
});
try it and you will get battery :) I think so.
If ok, then I change in library.
Im sorry, there is still just the "smoke" state. No "battery" state :-(
Did you short press on sensor? show detailed log please
Yes i pressed short on sensor button.
Did you mean the DEBUG log or normal Log?
with DEBUG
@kirovilya Here the new log
Log2.txt
hmm... did you really change file?
ok let's add log to file.
insert line in /node_modules/zcl-packet/lib/foundation.js:652:
console.log(stopLen, this._buffer.length, parsedBufLen+1);
and after 659 line:
console.log(res);
and DEBUG log again
I edited the lines for sure.
Heres the DEBUG Output on Screen
In the Logfile is
2018-7-4 22:28:54 ^[[32mINFO^[[39m Connecting to MQTT server at mqtt://localhost
2018-7-4 22:28:54 ^[[32mINFO^[[39m zigbee-shepherd ready
2018-7-4 22:28:55 ^[[32mINFO^[[39m Connected to MQTT server
2018-7-4 22:28:55 ^[[32mINFO^[[39m MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
42 43 7
42 43 11
42 43 14
42 43 18
42 43 22
42 43 29
42 43 33
42 43 37
42 43 40
42 43 46
2018-7-4 22:29:16 ^[[32mINFO^[[39m MQTT publish, topic: 'zigbee2mqtt/0x00158d000202eff6', payload: '{"smoke":false}'
42 43 7
42 43 11
42 43 14
42 43 18
42 43 22
42 43 29
42 43 33
42 43 37
42 43 40
42 43 46
2018-7-4 22:29:34 ^[[32mINFO^[[39m MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'offline'
2018-7-4 22:29:34 ^[[32mINFO^[[39m Disconnecting from MQTT server
2018-7-4 22:29:34 ^[[32mINFO^[[39m zigbee-shepherd stopped
[Log3.txt](https://github.com/Koenkk/zigbee2mqtt/files/2164272/Log3.txt)
Im sorry the file wasn't uploaded.
The file Log3.txt is the output on screen.
The other file is the generated file
Ok. Replace block from /node_modules/zcl-packet/lib/foundation.js:644:
ru.clause('xiaoMiStruct', function (name) {
var stopLen = parsedBufLen+this.vars.len-2;
this.tap(function(){
this.loop('attrData', function (end) {
console.log(stopLen, this._buffer.length, parsedBufLen+1);
if (this._buffer.length <= parsedBufLen+1) {
end();
} else {
parsedBufLen += 2;
this.uint8('index').uint8('dT').tap(function () {
ru.variable('data', 'dT')(this);
});
console.log(stopLen, this._buffer.length, parsedBufLen+1);
if (this._buffer.length <= parsedBufLen+1) end();
}
}).tap(function () {
var res = {};
this.vars.attrData.forEach(function (element) {
if (element.index != undefined) {
res[element.index.toString()] = element.data;
}
});
console.log(res);
this.vars.attrData = res;
});
});
});
In your case, end() function never called and so console.log(res) not called too
Oh my god. You're best. Im getting now:
And here is the output on screen. It looks strange. There're many "Null" results.
Or is it ok?
:)
And here is also the new log file...
There are many infos more as before
log.txt
Good. Now you can remove console.log lines... I will change zcp-packet library
Ok. Thanks so much for great support!
@Koenkk Look at https://github.com/Koenkk/zcl-packet/pull/2
@kirovilya thanks!
@Sonsi79 can you check out the zigbee2mqtt dev branch and check if this is fixed? https://github.com/Koenkk/zigbee2mqtt/tree/dev
@Koenkk For sure, i will.
Can i also "git clone" the dev branch? Im getting error by using git clone with your link.
git clone [email protected]:Koenkk/zigbee2mqtt.git
cd zigbee2mqtt
git checkout dev
@ciotlosm Thanks for help...
@Koenkk I can confirm. The dev branch fixed the bug, the smoke detector published everything as excepted :-)
Strange, after new installation of zigbee2mqtt the smoke sensor doesn't get information of battery again.
@kirovilya Did you have any idea about the reason?
@Koenkk I have to pull back my confirmation. It seems the bug still exists. I have reinstall zigbee2mqtt and the old bug (no battery state), before @kirovilya Helps seems still to exists.
Or is this fix just in the dev branch? With fresh install i used the master branch
Recently my changes cause of error #198 So we rolled back.
I trying to fix https://github.com/kirovilya/zcl-packet/commit/274ac22332394caaf9a8d5ee0028a987dcd248c7
can you check this commit? You need update zcl-packet module to this commit.
Sure i will. Can you please tell me how to update to this version?
Thnx lot
Go to zigbee2mqttdirectory and run:
npm install git+https://github.com/kirovilya/zcl-packet.git#dev
Check that zigbee2mqtt\node_modules\zcl-packet\lib\foundation.js in 648 line has code:
stopLen = this._buffer.length-2;
Then, go to zigbee2mqtt\node_modules\zigbee-shepherd\node_modules and remove or rename zcl-packet directory in this location.
@kirovilya It works great!
Should i wait for release of this fix or leave this workaround?
Will it survive a update of zigbee2mqtt?
Thnx for your quick reply and help
@Sonsi79 yes, just merged this into the dev branch!
@kirovilya and @Koenkk:
Im sorry but i think there is a new bug through this fix?
When i press the button on my "Xiaomi Water Leak Sensor" (SJCGQ11LM), the zigbee2mqtt crash with the following error.
`/opt/zigbee2mqtt/node_modules/zcl-packet/lib/foundation.js:297
dataTypeStr = zclId.dataType(dataType).key;
^
TypeError: Cannot read property 'key' of undefined
at ensureDataTypeString (/opt/zigbee2mqtt/node_modules/zcl-packet/lib/foundation.js:297:47)
at getDataType (/opt/zigbee2mqtt/node_modules/zcl-packet/lib/foundation.js:307:16)
at Dissolve.
at Dissolve._transform (/opt/zigbee2mqtt/node_modules/dissolve/index.js:80:16)
at Dissolve.Transform._read (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at Dissolve.Transform._write (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:279:12)
at writeOrBuffer (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:266:5)
at Dissolve.Writable.write (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:211:11)
at Dissolve.Writable.end (/opt/zigbee2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:426:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/csonsalla/.npm/_logs/2018-07-30T18_50_30_618Z-debug.log`
When i simulate a water leak, the sensor works and i get the publish via mqtt. Just pressing the button let the zigbee2mqtt crash. Im not sure about the reason by this fix. Maybe it is a new/other bug?.
@Sonsi79 :( It is on dev version? I will check the leak sensor in the evening...
Yes ist is on the dev Version by the way you told me.
@Sonsi79 Can you check again dev branch of https://github.com/kirovilya/zcl-packet.git (as I decribed above)?
It is necessary to check the smoke and leak sensors. And also you can check the addition of new devices.
@kirovilya check done :-) smoke sensor and the leak sensor works fine again. thnx much!
I have to check the addition of new devices later. Have to go to work now.
@Sonsi79 battery for smoke sensor works? hmm, strange... :)
@Koenkk Sorry for previous fix. How to test, so that it does not out like last time? https://github.com/kirovilya/zcl-packet/commit/b7d5b4478a88cd3fc65328c6dc94572c277c7d3e
@kirovilya I merged it to the dev branch for now so we can test for some time.
@kirovilya addition of new devices isn't possible.
I receive the message during start of zigbee2mqtt:
{"message":"request unsuccess: 17","stack":"Error: request unsuccess: 17\n at /opt/zigbee2mqtt/node_modules/zigbee-shepherd/lib/components/zdo.js:46:21\n at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:257:13)\n at Object.onceWrapper (events.js:315:30)\n at emitOne (events.js:116:13)\n at CcZnp.emit (events.js:211:7)\n at CcZnp._mtIncomingDataHdlr (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:357:14)\n at /opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:333:22\n at _combinedTickCallback (internal/process/next_tick.js:131:7)\n at process._tickCallback (internal/process/next_tick.js:180:9)"}
@Sonsi79 hmm. it is not error of my code...
https://github.com/Koenkk/zigbee2mqtt/issues/184
@kirovilya OK, htnx.
The zigbee2mqtt is running after this error.
You asked me about possibility of pair new devices. It is not possible actually. Nothing happens during holding down pair button. The old devices working fine also the battery of smoke detector.
i have completely update to dev branch, maybe is this my fault?
If you press the pairing button, the device must first leave the network.
If you then press the pairing button again, it should enter the network again.
Look at logs with debug.
I know i have 15 Xiaomi devices. This ist the first time im not able the pair my 3 new WSDCGQ11LM.
Noting happens actually by holding and pressing the pair button. There is also no message shown. I will try debug.
After reflash the error is gone and the Stick is able to pair again... sorry for confusing you. thnx for help
I'm experiencing the same issue at the moment. Out of the blue this message presents it self on the start of zigbee2mqtt. Fun fact: only when I have permit join set to true. So no error when permit join is false.
Perhaps that will help squat the bug.
Most helpful comment
I think I understand the reason.
The specified length of the charStr does not match the length of the data in the buffer.
In the evening I'll try again and suggest how to fix it.
Found this case with FF01 attribute https://github.com/Frans-Willem/AqaraHub/commit/a2cc15fad172ccb9a323f30ea50991e6001c32d0#diff-e45011ea876daa1366f56d10f998db49