Zigbee2mqtt: Support for Nuki or Danalock or.... smartlocks

Created on 30 Dec 2018  路  41Comments  路  Source: Koenkk/zigbee2mqtt

Hi,

I tried to find anything about supporting zigbee smartocks. I'm thinking of buying one, at this moment I'm looking at Nuki https://nuki.io/nl/smart-lock/ or Danalock V3 https://danalock.com/products/danalock-v3-smart-lock/ , both with support for European (Dutch) locks.

Can anyone confirm that one of these or maybe another manufacturer would work with zigbee2mqtt?

KInd regards,

Michel

stale

Most helpful comment

Hi, I Found solution from another post where this same problem was solved by resetting danalock and repairing it. I did that and now it works. I think manual state indication stopped working when I paired it to my phone app and updated firmware, but no problems any more after repairing.

I am wondering... When I send LOCK command to zigbee2mqtt/danalock/set

zigbee2mqtt/danalock Responds
LOCK (this is the command?)
LOCK (state after action?)
LOCK (what is this state?)

I want to read state after command so I know for sure that door is locked. How can I separate command from real state? Now my homekit shows locked right after command, but it takes second or two when it is locked for real.

All 41 comments

Yeah.. I am interested too... anyone?

I'm very interested too!
Developer any word from you?

I don't have one, so it totally depends on you guys.

@Koenkk what information do you need?
For Danalock V3 Zigbee I get the following message:

error: Cannot get the Node Descriptor of the Device: 0x000b57fffe59e701 (Error: Timed out after 10000 ms)

@kalle2000

Can you please start zigbee2mqtt in debug mode DEBUG=* npm start Your problem now is that the device havent been pair do you have a router near? Looks that you need to try to pair it again.

serialport:unixRead Starting read +10s
serialport:unixRead Finished read 6 bytes +1ms
serialport:main binding.read finished +13ms
cc-znp { sof: 254,
cc-znp len: 1,
cc-znp type: 'SRSP',
cc-znp subsys: 'ZDO',
cc-znp cmd: 'nodeDescReq',
cc-znp payload: { status: 0 },
cc-znp fcs: 102,
cc-znp csum: 102 } +22ms
serialport:main _read reading +7ms
serialport:bindings read +8ms
serialport:unixRead Starting read +8ms
cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +5ms
serialport:unixRead waiting for readable because of code: EAGAIN +2ms
serialport:poller Polling for "readable" +13ms
zigbee2mqtt:error 2019-3-15 11:06:18 Cannot get the Node Descriptor of the Device: 0x000b57fffe59e701 (Error: Timed out after 10000 ms)

@kalle2000 it doenst seen to be paired yet. Can you try to put a router closer if you have any ? please put the logs on https://hastebin.com/ and paste here the link.

This is what i receive in debug mode

https://hastebin.com/urivehiluq.bash

@kalle2000 if you have any question you can also join Discord for zigbee2mqtt, https://discord.gg/VaQQnn
Iam happy to help you cause iam thinking of buying the same lock
Can you check whats modelid of the device 0x000b57fffe59e701 of V3-BTZB in database.db file and
Please follow this https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html
The next step is the to add an entry of your device to node_modules/zigbee-shepherd-converters/devices.js. In order to provide support for E.G. the lumi.sens from step 1 you would add:
Add this and then pair it again.
```.js
// Danalock
{
zigbeeModel: ['V3-BTZB'],
model: 'V3-BTZB',
vendor: 'Danalock',
description: 'Danalock V3 Bluetooth and Zigbee',
supports: 'lock/unlock, battery',
fromZigbee: [],
toZigbee: [],
configure: (ieeeAddr, shepherd, coordinator, callback) => {
const device = shepherd.find(ieeeAddr, 1);

        const actions = [
            (cb) => device.report('closuresDoorLock', 'lockState', 0, repInterval.HOUR, 0, cb),
            (cb) => device.report('genPowerCfg', 'batteryPercentageRemaining', 0, repInterval.MAX, 0, cb),
        ];

        execute(device, actions, callback);
    },

```

The log gives good info maybe someone can help out using the some parts from YRD426NRSC
and i also found more info on SmartThingsCommunity
zigbee2mqtt:debug 2019-3-19 20:40:03 Received zigbee message of type 'readRsp' with data '{"cid":"closuresDoorLock","data":{"1":0,"lockState":1,"actuatorEnabled":0,"numOfLockRecordsSupported":17918,"numOfTotalUsersSupported":0}}' of device 'V3-BTZB' (0x000b57fffe59e701)

@JLFN thanks for the initial device definiton. I am a step further and receiving the no converters messages:

No converter available for 'V3-BTZB' with cid 'closuresDoorLock', type 'attReport' and data '{"cid":"closuresDoorLock","data":{"lockState":2}}'

No converter available for 'V3-BTZB' with cid 'genPowerCfg', type 'devChange' and data '{"cid":"genPowerCfg","data":{"batteryPercentageRemaining":160}}'

Need to figure out how to get these added properly...

@Koenkk
I'm able to read most off informations from Danalock V3 unit, but I'm not sure how to write datas (or command(s)) to it. May I ask you for guiding me? For example how to write "set" convertor for: cluster 0x0101 (page 7 in attached PDF) -> LockDoor command

Code below, block of 'set', do not work as expected -> lock unit does not do anything.

            const cid = 'genBasic';
            const attrId = 0x00;
        if (type === 'get') {
                return {
                    cid: cid,
                    cmd: 'read',
                    cmdType: 'foundation',
                    zclData: [{attrId: attrId}],
                    cfg: cfg.default,
                };
            } else if (type === 'set') {
        return {
            cid: 0x0101, // cluster Door lock
            cmd: 'write', // I'm really not sure if command name is OK
                    cmdType: 'foundation',
                    zclData: [{
                        attrId: 0x00,  // Lock state attribute
                        dataType: 0x10, // BOOLEAN_8BITS 
                        attrData: 0x00, // "locked state"
                    }],
                    cfg: cfg.default,   
        }
        }

Thanks a lot

TD003 Zigbee manual.pdf

Danalock v3 is now supported, (https://github.com/Koenkk/zigbee-shepherd-converters/pull/407).

@janbezdek please take a look at that pr, I think you can re-use almost all code.

@Koenkk As I see, last hours were quite busy in case of lock units support. Thanks :-)

Danalock V3 lock/unlock commands support confirmed - by "generic_lock" in devices.js. The un/lock command expect one parameter, which I miss. I have to find out the way how to read supported commands (with params) from zigbee device.

Hi,

I did run update.sh and added the V3 info manually into the converters file.
Now I am getting this error when locking/unlocking the smartlock:

/home/pi/xiaomi-zb2mqtt/lib/extension/deviceReceive.js:109
if (c.cid === cid) {
^

TypeError: Cannot read property 'cid' of undefined
at mappedDevice.fromZigbee.filter (/home/pi/xiaomi-zb2mqtt/lib/extension/deviceReceive.js:109:23)
at Array.filter ()
at DeviceReceive.onZigbeeMessage (/home/pi/xiaomi-zb2mqtt/lib/extension/deviceReceive.js:105:52)
at extensions.filter.forEach (/home/pi/xiaomi-zb2mqtt/lib/controller.js:145:31)
at Array.forEach ()
at Controller.onZigbeeMessage (/home/pi/xiaomi-zb2mqtt/lib/controller.js:145:14)
at Zigbee.onMessage (/home/pi/xiaomi-zb2mqtt/lib/zigbee.js:224:18)
at ZShepherd.emit (events.js:182:13)
at ZShepherd. (/home/pi/xiaomi-zb2mqtt/node_modules/zigbee-shepherd/lib/shepherd.js:170:14)
at ZShepherd.emit (events.js:182:13)

https://hastebin.com/rayehosuxo.coffeescript

@kalle2000 copying anything manually shouldn't be needed. Just follow http://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html, especially:

rm -rf node_modules
npm install

is important in this case.

Dear @Koenkk

thanks for the hint to switch to dev branch. I did a clean install and synced the dev branch.
After a couple of retries, i got the danalock paired. However zigbee2mqtt cannot get it configured.

Here are my logs: https://hastebin.com/ufazikanib.pl

What Can I do to help you pinpointing this issues?

thx
kalle2000

btw ... there is a couple of warnings during npm install: https://hastebin.com/ralijanogi.rb

The device is not awake when configuring, to make sure it's awake, either press some buttons on the device when starting zigbee2mqtt or re-pair it.

Thanks all for your help. I finally got it working.
It ended up with replacing the cc2530 with a cc2531 antenna. I now can unlock/lock the door via mqtt.
COOL STUFF! :)

Thanks all for your help. I finally got it working.
It ended up with replacing the cc2530 with a cc2531 antenna. I now can unlock/lock the door via mqtt.
COOL STUFF! :)

Can you please share your home assistant mqtt yaml for the lock.

Hi @JLFN

I am using fhem (with MQTT plugin) as home automation software and not home assistant.
The MQTT commands are:
publish zigbee2mqtt/<deviceid>/set {"state":"UNLOCK"} resp. publish zigbee2mqtt/<deviceid>/set {"state":"LOCK"}

I hope they add support for pulling the latch vs. simple unlock. Currently you can only configure that the latch is pulled when unlocking. Not that practical. Home assistant even has a 'open' command already for locks. I got in touch with the manufacturer, let's see! Maybe you guys can also request this feature to push it a bit?

Just came here to confirm my Danalock v3 works with the edge build.

I tried two different danalocks and got this error with both after some time:

Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.

I also had trouble with pairing them (for one it took hours). So removing and re-pairing is annoying.

I have no trouble with other zigbee devices. What could be the problem here?

Just came here to confirm my Danalock v3 works with the edge build.

Does this mean that it works "out of the box"? Sorry, I've tried to follow the comments on this issue, but...well, I didn't understand it, it's out of my knowledge! :|

I also just want to confirm that it is working for me.
My setup: zigbee2mqtt version 1.4.0 with the linked CC2530 default firmware.
Danalock FW version 0.11. It also worked with 0.9.6.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I can confirm Danalock V3 is working.. partialy.. I can lock and unlock but everytime with error:
Publish 'set' 'state' to 'my-danalock' failed: 'Error: Timeout - 53074 - 1 - 241 - 257 - 11 after 15000ms'
And it looks like publishing is not working. Even battery state is not showing in my MQTT console..

Can somebody confirm publish is working?

@frogale this issue should already be fixed in zigbee2mqtt 1.10

@frogale this issue should already be fixed in zigbee2mqtt 1.10

Aaah. Thanks! It is working now! Danalock is useles without zigbee2mqtt

One more thing.. Does danalock send info about manual state change?

I just installed danalock v3 and commands works great. But what it comes to frogale question, it looks like manual state change won't update? And if I control danalock via danalock iOS app, it won't update state to zigbee2mqtt. Or am I doing something wrong?

@juhpesis can you share your database.db?

Hi, I Found solution from another post where this same problem was solved by resetting danalock and repairing it. I did that and now it works. I think manual state indication stopped working when I paired it to my phone app and updated firmware, but no problems any more after repairing.

I am wondering... When I send LOCK command to zigbee2mqtt/danalock/set

zigbee2mqtt/danalock Responds
LOCK (this is the command?)
LOCK (state after action?)
LOCK (what is this state?)

I want to read state after command so I know for sure that door is locked. How can I separate command from real state? Now my homekit shows locked right after command, but it takes second or two when it is locked for real.

Danalock entry from my database.db looks like this:

{"id":13,"type":"EndDevice","ieeeAddr":"0x000b57fffe59df3f","nwkAddr":53074,"manufId":4444,"manufName":"Danalock","powerSource":"Battery","modelId":"V3-BTZB","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":10,"inClusterList":[0,1,3,9,32,257,2821],"outClusterList":[10,25,2821],"clusters":{"genBasic":{"attributes":{"modelId":"V3-BTZB","manufacturerName":"Danalock","powerSource":3,"zclVersion":2,"appVersion":1,"stackVersion":1,"hwVersion":4,"dateCode":"20190806\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}},"closuresDoorLock":{"attributes":{"lockState":2}},"genPowerCfg":{"attributes":{"batteryPercentageRemaining":194}}},"binds":[{"cluster":257,"type":"endpoint","deviceIeeeAddress":"0x00124b0018df46a4","endpointID":1},{"cluster":1,"type":"endpoint","deviceIeeeAddress":"0x00124b0018df46a4","endpointID":1}]}},"appVersion":1,"stackVersion":1,"hwVersion":4,"dateCode":"20190806\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","zclVersion":2,"interviewCompleted":true,"meta":{"configured":5},"lastSeen":1582492665450}

But I will try factory reset and new repair as @juhpesis suggested..

Yeah.. After reset and repair lock state is indicated just fine. Thanks @juhpesis !

@juhpesis can you try to:

@Koenkk I did that, and now it works.
After command homekit is showing Opening... or Closing... and waits until lock is actually locked or opened. Thanks!

@juhpesis thanks for confirming, I've fixed this for all locks supported by Zigbee2mqtt now.

Do we have three options?

  • Lock
  • Unlock
  • Pulling the latch

My use cases would be:

  • Locking the door if nobody is at home.
  • Unlocking the door if someone is near home.
  • Pulling the latch if I'm connecting to the WiFi.
Was this page helpful?
0 / 5 - 0 ratings