dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 498 forks source link

Yale YRD226 ZigBee keypad door lock #3750

Closed zeiphon closed 3 years ago

zeiphon commented 3 years ago

Device

This is a new issues as requested by @Smanar here: https://github.com/dresden-elektronik/deconz-rest-plugin/issues/579#issuecomment-729018037 for Yale lock YRD226.

Using ZigBee module: AYR202-ZB-HA V261 , Model: YRMZB2

I believe the Yale integration guide will probably still apply, found here: http://maxicom.net/public/Yale%20Locks%20ZigBee%20HA%20Integrators%20Guide%20RevC.pdf (source: https://github.com/dresden-elektronik/deconz-rest-plugin/issues/579#issuecomment-459896727 )

It looks like these locks should support PIN management (setting/retrieval etc) via ZigBee but I don't see this capability reflected in the clusters, unless I'm missing something?

Thanks!

Screenshots

node

basic_cluster power_cluster identity_cluster alarms_cluster time_cluster door_cluster poll_cluster diagnostics_cluster

Smanar commented 3 years ago

Home automation, domoticz, openHAB, ect .....

AntiqS commented 3 years ago

can you confirm please if I am doing it right, I am running the command:

curl -H 'Content-Type: application/json' -X PUT -d '{"lock": true}' http://LOCALHOST-IP:8080/api/MY-API/sensors/16/config

Where LOCALHOST IP is IP address of my ubuntu with plugged in deconz stick, MY API - I got from the home assistant for deconz

In this code - what is number 16?

AntiqS commented 3 years ago

Assuming number 16 is my lock ID, I tried all numbers from 0 to 20, not sure how to get this ID from Deconz. All numbers give: [{"error":{"address":"/sensors/20","description":"resource, /sensors/20, not available","type":3}}] Number 1 returns: [{"error":{"address":"/sensors/1/config/lock","description":"parameter, lock, not available","type":6}}]

Smanar commented 3 years ago

16 is the device ID, you can find the list on a browser with http://LOCALHOST-IP:8080/api/MY-API/sensors/

[{"error":{"address":"/sensors/20","description":"resource, /sensors/20, not available","type":3}}] Mean there is no device with this ID, not visible on the previous link

[{"error":{"address":"/sensors/1/config/lock","description":"parameter, lock, not available","type":6}}] Mean the id is good, there isa device with this ID, but not the field "lock" in it, so can be my fault

You can have the complete JSON just for this device on a browser with : http://LOCALHOST-IP:8080/api/MY-API/sensors/1

AntiqS commented 3 years ago

I tried that link http://LOCALHOST-IP:8080/api/MY-API/sensors/ it only shows me one device id 1, but it's not the lock - not sure what it is, maybe my Philips hue or standard daylight sensor:

image

And I still can lock and unlock the lock from Deconz

Smanar commented 3 years ago

Ok so you are right, it mean the device was not included in the API, but perhaps in deconz ? I m checking

Model id : YRD226/246 TSDB
Manufacture name 0x101D
Mac adress starting by 0x000d6f

Ok, so after a verification I have updated the code, forget your model ...

cd deconz-rest-plugin
git pull
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

To update it.

Hoping for a new sensor this time.

And I still can lock and unlock the lock from Deconz

Ha, if you can see it in deconz, you don't need the reset procedure to re-include it in the network, you just need

It will trigger the inclusion in the API (if I m right ofc)

But it s strange you can't use deconz to make the device react, you have succed with it before > https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3750#issuecomment-751912280

almperez commented 3 years ago

Hi @Smanar! I too have a Yale Smart Lock, but mine is a different model. Can you please add it so I can test it here?

image

image

Many thanks!

Smanar commented 3 years ago

Sure, Have added YRD256L TSDB SL

Same command to compile

sudo apt install deconz-dev
git clone --branch doorlock https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins
AntiqS commented 3 years ago

I think we are getting there :) I set phoscon app to allow to join and then read basic attributes, new device ID appeared:

image

curl -H 'Content-Type: application/json' -X PUT -d '{"lock": true}' http://LOCALHOST-IP:8080/api/MY-API/sensors/2/config locks and returns: [{"success":{"/sensors/2/config/lock":true}}]

curl -H 'Content-Type: application/json' -X PUT -d '{"lock": false}' http://LOCALHOST-IP:8080/api/MY-API/sensors/2/config unlocks and returns: [{"success":{"/sensors/2/config/lock":false}}]

Smanar commented 3 years ago

But the value config / lock and state / lockstate are not working ? they are "null" on your capture ?

AntiqS commented 3 years ago

image "Config / Lock" value - changes to false and stays false no matter what I do (locked unlocked multiple times) Tried multiple times (img 1) Then I set permit to join in phoscon app, read basic attributes and tried locking unlocking. Same results (img 2) - Lock false, lockstate null. But with permit to join have 2 more values populated - lastseen and reachable

Smanar commented 3 years ago

Ok so have updated the code with 2/3 things.

Can you try the new code, don't need to re include, just restart deconz, and if you can share the debug when locking/unlocking ? with "info" and 'info_l2" pls ?

ashar38 commented 3 years ago

Hi @Smanar Subscribing to this issue as I have a Yale Lock as well. Would it be possible to add model YRD220/240TSDB as well whenever this is packaged inside the firmware.

image

Just to add, the manufacturer code on mine is 0xaaaa.

image

Smanar commented 3 years ago

Have added your model, but can you help us to test the code too ? I have added 4/5 models but realy few users can test them.

I need at least to make the 2 news fields working, and test the new XML file that add command in the GUI before making the PR, and adding the missing feature later.

ashar38 commented 3 years ago

Sure. I run deconz as a service on my windows machine. can I compile the dev code on Windows?

Smanar commented 3 years ago

Nope justly ^^. You need a linux machine for that.

ashar38 commented 3 years ago

Nope justly ^^. You need a linux machine for that.

ok. no worries. I will setup a linux VM on virtualbox on the same machine so that I wont have plug out/in the USB stick. I will let you know once I have compiled and installed the dev version.

Smanar commented 3 years ago

No one are some time to make tests ?

ashar38 commented 3 years ago

Hi @Smanar apologies. I have been away for a few days. I have setup an Ubuntu VM on Oracle virtual box. I will install the Deconz Dev branch and update back.

ashar38 commented 3 years ago

Just wanted to confirm that I have Deconz Dev installed and ready now. I am hoping I have the right version. It is pretty cold here today so will be difficult for me to go outside and try to pair the lock. Tomorrow looks better, so I will let everyone know how it goes. image

AntiqS commented 3 years ago

I have updated Deconz and tried locking/unlocking. It's still the same lockstate "null" Info and Info_l2 below:

16:37:46:122 UPNP socket not bound, state: 0 16:37:49:338 CTRL got nwk update id 0 16:37:49:462 CTRL got nwk update id 0 16:38:44:295 CTRL got nwk update id 0 16:38:57:263 enqueue event config/localtime for /config/ 16:38:57:474 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:38:57:474 Poll light node Color temperature light 5 16:38:58:264 enqueue event config/localtime for /config/ 16:38:58:316 poll node 00:15:8d:00:05:4d:de:6b-01 16:38:58:316 Poll light node Window covering device 6 16:38:59:189 poll node 00:17:88:01:08:d4:43:80-0b 16:38:59:189 Poll light node Color temperature light 4 16:38:59:264 enqueue event config/localtime for /config/ 16:39:00:091 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:00:093 Poll light node Window covering device 3 16:39:00:263 enqueue event config/localtime for /config/ 16:39:00:939 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:00:940 Poll light node Color temperature light 5 16:39:01:267 enqueue event config/localtime for /config/ 16:39:01:763 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:01:764 Poll light node Window covering device 6 16:39:02:264 enqueue event config/localtime for /config/ 16:39:02:658 poll node 00:17:88:01:08:d4:43:80-0b 16:39:02:660 Poll light node Color temperature light 4 16:39:03:264 enqueue event config/localtime for /config/ 16:39:03:475 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:03:476 Poll light node Window covering device 3 16:39:04:263 enqueue event config/localtime for /config/ 16:39:04:314 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:04:315 Poll light node Color temperature light 5 16:39:05:189 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:05:190 Poll light node Window covering device 6 16:39:05:263 Daylight now: goldenHour1, status: 160, daylight: 1, dark: 0 16:39:05:264 enqueue event config/localtime for /config/ 16:39:06:089 poll node 00:17:88:01:08:d4:43:80-0b 16:39:06:090 Poll light node Color temperature light 4 16:39:06:263 enqueue event config/localtime for /config/ 16:39:06:936 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:06:937 Poll light node Window covering device 3 16:39:07:265 enqueue event config/localtime for /config/ 16:39:07:616 Door lock debug 0x000D6F0010FE8DBE, data 0x00000000 16:39:07:635 Door lock debug 0x000D6F0010FE8DBE, data 0x00000000 16:39:07:735 void deCONZ::zmNode::setFetched(deCONZ::RequestId, bool) fetched item: 8, node: 0x0000 16:39:07:740 enqueue event attr/lastseen for /lights/1 16:39:07:745 Websocket 192.168.255.133:60412 send message: {"attr":{"id":"1","lastannounced":null,"lastseen":"2021-03-02T00:39Z","manufacturername":"dresden elektronik","modelid":"ConBee II","name":"Configuration tool 1","swversion":"0x26660700","type":"Configuration tool","uniqueid":"00:21:2e:ff:ff:04:f9:22-01"},"e":"changed","id":"1","r":"lights","t":"event","uniqueid":"00:21:2e:ff:ff:04:f9:22-01"} (ret = 344) 16:39:07:763 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:07:765 Poll light node Color temperature light 5 16:39:08:264 enqueue event config/localtime for /config/ 16:39:08:656 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:08:658 Poll light node Window covering device 6 16:39:09:264 enqueue event config/localtime for /config/ 16:39:09:472 poll node 00:17:88:01:08:d4:43:80-0b 16:39:09:473 Poll light node Color temperature light 4 16:39:10:263 enqueue event config/localtime for /config/ 16:39:10:264 sql exec SELECT conf FROM zbconf ORDER BY rowid desc limit 1 16:39:10:266 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:10:267 Poll light node Window covering device 3 16:39:10:268 Idle timer triggered 16:39:11:189 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:11:191 Poll light node Color temperature light 5 16:39:11:264 enqueue event config/localtime for /config/ 16:39:12:086 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:12:087 Poll light node Window covering device 6 16:39:12:264 enqueue event config/localtime for /config/ 16:39:12:931 poll node 00:17:88:01:08:d4:43:80-0b 16:39:12:931 Poll light node Color temperature light 4 16:39:13:264 enqueue event config/localtime for /config/ 16:39:13:416 Search sensors done 16:39:13:763 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:13:765 Poll light node Window covering device 3 16:39:14:263 send permit join, duration: 0 16:39:14:265 enqueue event config/localtime for /config/ 16:39:14:657 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:14:660 Poll light node Color temperature light 5 16:39:14:711 read attributes of 0x14B457FFFE6BE882 cluster: 0x0006: [ 16:39:14:712 0x0000 16:39:14:712 ] 16:39:14:713 add task 345 type 19 to 0x14B457FFFE6BE882 cluster 0x0006 req.id 238 16:39:14:714 Poll APS request 238 to 0x14B457FFFE6BE882 cluster: 0x0006 16:39:14:802 Poll APS confirm 238 status: 0x00 16:39:14:804 Erase task req-id: 238, type: 19 zcl seqno: 37 send time 0, profileId: 0x0104, clusterId: 0x0006 16:39:14:869 Node data 0x14b457fffe6be882 profileId: 0x0104, clusterId: 0x0006 16:39:14:870 0x14B457FFFE6BE882: added ZCL value 0x01/0x0006/0x0000 16:39:14:871 enqueue event event/checkgroupanyon for /groups/65520 16:39:14:874 enqueue event state/all_on for /groups/65520 16:39:14:875 enqueue event state/any_on for /groups/65520 16:39:14:878 Websocket 192.168.255.133:60412 send message: {"e":"changed","id":"65520","r":"groups","state":{"all_on":false,"any_on":true},"t":"event"} (ret = 92) 16:39:14:881 discard group state push for 65520: state/any_on (already pushed) 16:39:14:001 void deCONZ::zmNode::setFetched(deCONZ::RequestId, bool) fetched item: 8, node: 0x2DE8 16:39:15:025 read attributes of 0x14B457FFFE6BE882 cluster: 0x0008: [ 16:39:15:026 0x0000 16:39:15:026 ] 16:39:15:026 add task 348 type 19 to 0x14B457FFFE6BE882 cluster 0x0008 req.id 244 16:39:15:027 Poll APS request 244 to 0x14B457FFFE6BE882 cluster: 0x0008 16:39:15:096 Poll APS confirm 244 status: 0x00 16:39:15:097 Erase task req-id: 244, type: 19 zcl seqno: 38 send time 0, profileId: 0x0104, clusterId: 0x0008 16:39:15:106 read attributes of 0x14B457FFFE6BE882 cluster: 0x0300: [ 16:39:15:107 0x0000 16:39:15:108 0x0001 16:39:15:108 0x0003 16:39:15:109 0x0004 16:39:15:109 0x0007 16:39:15:109 0x0008 16:39:15:110 0x4001 16:39:15:111 ] 16:39:15:112 add task 349 type 19 to 0x14B457FFFE6BE882 cluster 0x0300 req.id 245 16:39:15:113 Poll APS request 245 to 0x14B457FFFE6BE882 cluster: 0x0300 16:39:15:163 Node data 0x14b457fffe6be882 profileId: 0x0104, clusterId: 0x0008 16:39:15:164 0x14B457FFFE6BE882: added ZCL value 0x01/0x0008/0x0000 16:39:15:194 Poll APS confirm 245 status: 0x00 16:39:15:195 Erase task req-id: 245, type: 19 zcl seqno: 39 send time 0, profileId: 0x0104, clusterId: 0x0300 16:39:15:264 Daylight now: goldenHour1, status: 160, daylight: 1, dark: 0 16:39:15:267 enqueue event config/localtime for /config/ 16:39:15:281 Node data 0x14b457fffe6be882 profileId: 0x0104, clusterId: 0x0300 16:39:15:285 0x14B457FFFE6BE882: added ZCL value 0x01/0x0300/0x0003 16:39:15:286 0x14B457FFFE6BE882: added ZCL value 0x01/0x0300/0x0004 16:39:15:288 0x14B457FFFE6BE882: added ZCL value 0x01/0x0300/0x0007 16:39:15:291 0x14B457FFFE6BE882: added ZCL value 0x01/0x0300/0x0008 16:39:15:293 0x14B457FFFE6BE882: added ZCL value 0x01/0x0300/0x4001 16:39:15:734 Door lock debug 0x000D6F0010FE8DBE, data 0x00000001 16:39:15:745 DB pushZdpDescriptorDb() 16:39:15:746 DB save zll database items 0x00000801 16:39:15:748 DB sql exec REPLACE INTO nodes (id, state, mac, name, groups, endpoint, modelid, manufacturername, swbuildid, ritems) VALUES ('5', 'normal', '14:b4:57:ff:fe:6b:e8:82-01', 'Color temperature light 5', '65520', '1', 'TRADFRI bulb E27 WS opal 1000lm', 'IKEA of Sweden', '2.0.022', '{"attr/id":"5","attr/lastannounced":null,"attr/lastseen":"2021-03-02T00:38Z","attr/manufacturername":"IKEA of Sweden","attr/modelid":"TRADFRI bulb E27 WS opal 1000lm","attr/name":"Color temperature light 5","attr/swversion":"2.0.022","attr/type":"Color temperature light","attr/uniqueid":"14:b4:57:ff:fe:6b:e8:82-01","config/colorcapabilities":0,"config/ctmax":65279,"config/ctmin":0,"state/alert":null,"state/bri":254,"state/colormode":"ct","state/ct":393,"state/on":true,"state/reachable":true}') 16:39:15:750 DB sql exec REPLACE INTO nodes (id, state, mac, name, groups, endpoint, modelid, manufacturername, swbuildid, ritems) VALUES ('1', 'normal', '00:21:2e:ff:ff:04:f9:22-01', 'Configuration tool 1', '65520', '1', 'ConBee II', 'dresden elektronik', '0x26660700', '{"attr/id":"1","attr/lastannounced":null,"attr/lastseen":"2021-03-02T00:39Z","attr/manufacturername":"dresden elektronik","attr/modelid":"ConBee II","attr/name":"Configuration tool 1","attr/swversion":"0x26660700","attr/type":"Configuration tool","attr/uniqueid":"00:21:2e:ff:ff:04:f9:22-01","state/reachable":true}') 16:39:15:751 DB sql exec UPDATE devices SET nwk = 10844 WHERE mac = '04:cf:8c:df:3c:77:bf:21';INSERT INTO devices (mac,nwk,timestamp) SELECT '04:cf:8c:df:3c:77:bf:21', 10844, strftime('%s','now') WHERE (SELECT changes() = 0); 16:39:15:755 DB saved in 9 ms 16:39:15:778 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:15:779 Poll light node Window covering device 6 16:39:16:116 void deCONZ::zmNode::setFetched(deCONZ::RequestId, bool) fetched item: 7, node: 0x2DE8 16:39:16:144 Poll APS request to 0x00158D00054DDE6B cluster: 0x0008 dropped, cluster doesn't exist 16:39:16:264 enqueue event config/localtime for /config/ 16:39:16:618 void deCONZ::zmNode::setFetched(deCONZ::RequestId, bool) fetched item: 5, node: 0x0000 16:39:16:621 DB pushZdpDescriptorDb() 16:39:16:832 poll node 00:17:88:01:08:d4:43:80-0b 16:39:16:833 Poll light node Color temperature light 4 16:39:16:880 read attributes of 0x0017880108D44380 cluster: 0x0006: [ 16:39:16:880 0x0000 16:39:16:881 ] 16:39:16:881 add task 357 type 19 to 0x0017880108D44380 cluster 0x0006 req.id 6 16:39:16:882 Poll APS request 6 to 0x0017880108D44380 cluster: 0x0006 16:39:17:005 Poll APS confirm 6 status: 0x00 16:39:17:005 Erase task req-id: 6, type: 19 zcl seqno: 40 send time 0, profileId: 0x0104, clusterId: 0x0006 16:39:17:085 Node data 0x0017880108d44380 profileId: 0x0104, clusterId: 0x0006 16:39:17:088 enqueue event attr/lastseen for /lights/4 16:39:17:090 0x0017880108D44380: added ZCL value 0x0B/0x0006/0x0000 16:39:17:092 enqueue event event/checkgroupanyon for /groups/65520 16:39:17:094 enqueue event event/checkgroupanyon for /groups/2 16:39:17:102 Websocket 192.168.255.133:60412 send message: {"attr":{"colorcapabilities":0,"ctmax":65279,"ctmin":0,"id":"4","lastannounced":null,"lastseen":"2021-03-02T00:39Z","manufacturername":"Philips","modelid":"LTD011","name":"Color temperature light 4","swversion":"1.55.7_r28193","type":"Color temperature light","uniqueid":"00:17:88:01:08:d4:43:80-0b"},"e":"changed","id":"4","r":"lights","t":"event","uniqueid":"00:17:88:01:08:d4:43:80-0b"} (ret = 389) 16:39:17:109 enqueue event state/all_on for /groups/2 16:39:17:111 enqueue event state/any_on for /groups/2 16:39:17:116 Websocket 192.168.255.133:60412 send message: {"e":"changed","id":"2","r":"groups","state":{"all_on":false,"any_on":false},"t":"event"} (ret = 89) 16:39:17:121 discard group state push for 2: state/any_on (already pushed) 16:39:17:263 enqueue event config/localtime for /config/ 16:39:17:331 read attributes of 0x0017880108D44380 cluster: 0x0300: [ 16:39:17:332 0x0000 16:39:17:333 0x0001 16:39:17:334 0x0003 16:39:17:335 0x0004 16:39:17:335 0x0007 16:39:17:336 0x0008 16:39:17:336 0x4001 16:39:17:337 ] 16:39:17:337 add task 360 type 19 to 0x0017880108D44380 cluster 0x0300 req.id 10 16:39:17:338 Poll APS request 10 to 0x0017880108D44380 cluster: 0x0300 16:39:17:393 Poll APS confirm 10 status: 0x00 16:39:17:393 Erase task req-id: 10, type: 19 zcl seqno: 41 send time 0, profileId: 0x0104, clusterId: 0x0300 16:39:17:478 Node data 0x0017880108d44380 profileId: 0x0104, clusterId: 0x0300 16:39:17:479 0x0017880108D44380: added ZCL value 0x0B/0x0300/0x0003 16:39:17:480 0x0017880108D44380: added ZCL value 0x0B/0x0300/0x0004 16:39:17:480 0x0017880108D44380: added ZCL value 0x0B/0x0300/0x0007 16:39:17:481 0x0017880108D44380: added ZCL value 0x0B/0x0300/0x0008 16:39:17:482 0x0017880108D44380: added ZCL value 0x0B/0x0300/0x4001 16:39:17:805 void deCONZ::zmNode::setFetched(deCONZ::RequestId, bool) fetched item: 7, node: 0x737A 16:39:17:968 poll node 00:15:8d:00:04:60:8d:4d-01 16:39:17:969 Poll light node Window covering device 3 16:39:18:263 enqueue event config/localtime for /config/ 16:39:18:336 Poll APS request to 0x00158D0004608D4D cluster: 0x0008 dropped, cluster doesn't exist 16:39:19:074 poll node 14:b4:57:ff:fe:6b:e8:82-01 16:39:19:075 Poll light node Color temperature light 5 16:39:19:123 Poll APS request to 0x14B457FFFE6BE882 cluster: 0x0006 dropped, values are fresh enough 16:39:19:263 DB save zll database items 0x00000001 16:39:19:264 DB sql exec REPLACE INTO nodes (id, state, mac, name, groups, endpoint, modelid, manufacturername, swbuildid, ritems) VALUES ('4', 'normal', '00:17:88:01:08:d4:43:80-0b', 'Color temperature light 4', '65520,2', '11', 'LTD011', 'Philips', '1.55.7_r28193', '{"attr/id":"4","attr/lastannounced":null,"attr/lastseen":"2021-03-02T00:39Z","attr/manufacturername":"Philips","attr/modelid":"LTD011","attr/name":"Color temperature light 4","attr/swversion":"1.55.7_r28193","attr/type":"Color temperature light","attr/uniqueid":"00:17:88:01:08:d4:43:80-0b","config/colorcapabilities":0,"config/ctmax":65279,"config/ctmin":0,"state/alert":null,"state/bri":0,"state/colormode":"ct","state/ct":366,"state/on":false,"state/reachable":true}') 16:39:19:266 DB saved in 2 ms 16:39:19:266 enqueue event config/localtime for /config/ 16:39:19:443 Poll APS request to 0x14B457FFFE6BE882 cluster: 0x0008 dropped, values are fresh enough 16:39:19:549 Poll APS request to 0x14B457FFFE6BE882 cluster: 0x0300 dropped, values are fresh enough 16:39:20:263 enqueue event config/localtime for /config/ 16:39:20:263 poll node 00:15:8d:00:05:4d:de:6b-01 16:39:20:263 Poll light node Window covering device 6 16:39:20:631 Poll APS request to 0x00158D00054DDE6B cluster: 0x0008 dropped, cluster doesn't exist 16:39:44:291 CTRL got nwk update id 0 16:40:44:294 CTRL got nwk update id 0

Smanar commented 3 years ago

Just wanted to confirm that I have Deconz Dev installed and ready now. I am hoping I have the right version. It is pretty cold here today so will be difficult for me to go outside and try to pair the lock. Tomorrow looks better, so I will let everyone know how it goes.

I realy don't know, if this window change with the dev version, never tried on my side. IDK if you are using the doorlock with another app ATM, but you need only 1 paring for test, I can explain how to simulate a new pairing if you want to make a second one, without using the doorlock (if this one is already in deconz). But yes If you are using the doorlock on another system can be a problem.

@AntiqS , I don't understand there is nothing in your log about a send command, or nothing about the doorlock cluster 0x0101 ... Have you done the locking/unlocking manually on the device or using API ?

For the problem, I think the device don't send report, so one of the two value is updated by the api itself, but as it don't send report, the second on is never updated. So is someone can check if there is realy nothing usefull in logs during the locking/unlocking ?

Smanar commented 3 years ago

Ok I think I have found the problem, the previous doorlock was a light, the new one a sensor, and the code can only manage the reporting for the light, can explain all problems, but IDK yet if I have solved the problem.

You can just update the code

cd deconz-rest-plugin
git pull
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

If I m right you will now have log about binding and reporting for the device.

ashar38 commented 3 years ago

Just wanted to confirm that I have Deconz Dev installed and ready now. I am hoping I have the right version. It is pretty cold here today so will be difficult for me to go outside and try to pair the lock. Tomorrow looks better, so I will let everyone know how it goes.

I realy don't know, if this window change with the dev version, never tried on my side. IDK if you are using the doorlock with another app ATM, but you need only 1 paring for test, I can explain how to simulate a new pairing if you want to make a second one, without using the doorlock (if this one is already in deconz). But yes If you are using the doorlock on another system can be a problem.

I currently have the doorlock added to the current production (if I can call it that) deconz network. It shows up inside deconz but naturally does not come up inside Phoscan app. I will delete from there, and pair it through the Ubuntu VM I configured. The weather is still cold up here in Canada, so standing out of the house and doing the pairing will be a pain. I guess I will just take the entire lock out and bring it in once.

Smanar commented 3 years ago

Ha ok, I understand. But this cdde is the same for all doorlock added on this code

        sensor->modelId() == QLatin1String("YRD226 TSDB") || // TODO : check if necessary
        sensor->modelId() == QLatin1String("YRD226/246 TSDB") || // TODO : check if necessary
        sensor->modelId() == QLatin1String("YRD220/240 TSDB") || // TODO : check if necessary
        sensor->modelId() == QLatin1String("easyCodeTouch_v1") || // TODO : check if necessary

You can wait for someone else for tests if you realy have so much problem, for the moment I need first find the reporting problem.

ashar38 commented 3 years ago

Ok quick update. Not sure if I did it correctly or not. I removed the lock from door and brought it inside. Then Shared Conbee stick to my Ubuntu VM. Started Phoscan app, and searched for Sensor. I think it did detect something as I got a success prompt saying that sensor was ready. But Nothing showed up in list of sensors. This is all text from Info debug logs from around that time. The door lock should be this - 0x000D6F0002FB9F6F EDIT: Screenshot 1: Deconz. It now sees the device with right model number, and identifies it as lock. image

Screenshot 2: Phoscan. Does not show the lock, even though it did report access when I ran add sensor wizard. image

18:44:20:330 UPNP socket not bound, state: 0 18:44:23:876 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:44:24:652 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:44:24:852 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:45:26:089 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:45:27:607 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:45:29:186 void DeRestPluginPrivate::pushZdpDescriptorDb(quint64, quint8, quint16, const QByteArray&),901: assertion 'changes == 1' failed 18:48:25:755 APS-DATA.indication from unknown node 0xB0CE1814030E09F4 18:48:25:756 ZCL attribute report 0xB0CE1814030E09F4 for cluster: 0x0008, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:48:29:532 DeviceAnnce of LightNode: 0x00124b0018497216 Permit Join: 0 18:48:29:620 ZDP discovery done in 88 ms 18:48:29:772 verified group capacity: 7 and group count: 1 of LightNode 0x00124b0018497216 18:48:29:780 0x00124b0018497216 found group 0xFFF0 18:48:39:206 Bind response success for 0x000d6f0002fb9f6f ep: 0x01 cluster: 0x0001 18:48:39:464 Bind response success for 0x000d6f0002fb9f6f ep: 0x01 cluster: 0x0101 18:48:39:465 skip configure report for cluster: 0x0101 attr: 0x0000 of node 0x000D6F0002FB9F6F (seems to be active) 18:48:59:151 send permit join, duration: 59 18:48:59:152 send GP proxy commissioning mode 18:49:00:002 DeviceAnnce of LightNode: 0x00124b0017fa77c1 Permit Join: 58 18:49:00:002 device announce 0x00124B0017FA77C1 (0xCECE) mac capabilities 0x8E 18:49:00:003 device announce 0x00124B0017FA77C1 (0xCECE) mac capabilities 0x8E 18:49:01:140 ZDP discovery done in 139 ms 18:49:01:215 verified group capacity: 7 and group count: 1 of LightNode 0x00124b0017fa77c1 18:49:01:216 0x00124b0017fa77c1 found group 0xFFF0 18:49:07:829 unknown node 0x000D6F0002FB9F6F (0xA3BB), lqi: 255 18:49:07:830 0x0507 nwk changed to 0xA3BB 18:49:07:867 DeviceAnnce of SensorNode: 0x000D6F0002FB9F6F [1] 18:49:07:868 nwk address changed 0x0507 -> 0xA3BB [2] 18:49:07:869 device announce 0x000D6F0002FB9F6F (0xA3BB) mac capabilities 0x80 18:49:07:869 set fast probe address to 0x000D6F0002FB9F6F (0xA3BB) 18:49:07:870 FP indication 0x0000 / 0x0013 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:07:871 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:07:871 device announce 0x000D6F0002FB9F6F (0xA3BB) mac capabilities 0x80 18:49:07:900 discard double entry in binding queue (size: 2) for for 0x000D6F0002FB9F6F, cluster 0x0101 18:49:08:067 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:08:071 [1] get node descriptor for 0x000d6f0002fb9f6f 18:49:08:072 CTRL skip polling while permit join is set 18:49:08:153 LightNode 6: On/Off plug-in unit 6 added 18:49:08:156 drop request to zombie (rx = 0) 18:49:08:324 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:08:327 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 254 ms 18:49:08:329 CTRL skip polling while permit join is set 18:49:08:568 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:08:572 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 499 ms 18:49:08:573 CTRL skip polling while permit join is set 18:49:08:749 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 676 ms 18:49:08:820 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:08:833 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 761 ms 18:49:08:836 CTRL skip polling while permit join is set 18:49:09:069 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:09:074 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 1001 ms 18:49:09:077 CTRL skip polling while permit join is set 18:49:09:100 Bind response success for 0x000d6f0002fb9f6f ep: 0x01 cluster: 0x0101 18:49:09:333 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:09:337 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 1264 ms 18:49:09:350 CTRL skip polling while permit join is set 18:49:09:364 Bind response success for 0x000d6f0002fb9f6f ep: 0x01 cluster: 0x0001 18:49:09:581 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:09:612 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 1539 ms 18:49:09:614 CTRL skip polling while permit join is set 18:49:09:657 FP indication 0x0000 / 0x8002 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:09:664 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:09:666 ZDP indication search sensors 0x000D6F0002FB9F6F (0xA3BB) cluster 0x8002 18:49:09:672 ZDP indication search sensors 0x000D6F0002FB9F6F (0xA3BB) clear timeout on cluster 0x8002 18:49:09:706 [2] get active endpoints for 0x000d6f0002fb9f6f 18:49:09:825 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:09:829 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 119 ms 18:49:09:843 CTRL skip polling while permit join is set 18:49:10:077 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:10:081 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 371 ms 18:49:10:083 CTRL skip polling while permit join is set 18:49:10:325 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:10:341 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 632 ms 18:49:10:351 CTRL skip polling while permit join is set 18:49:10:356 FP indication 0x0104 / 0x000A (0x000D6F0002FB9F6F / 0xA3BB) 18:49:10:357 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:10:360 [INFO] - No button map for: YRD220/240 TSDB, unicast to: 0x0000, endpoint: 0x01, cluster: 0x000A, command: 0x00, payload: 0100, zclSeq: 10 18:49:10:489 APS-DATA.indication from unknown node 0xB0CE18140003CF57 18:49:10:500 ZCL attribute report 0xB0CE18140003CF57 for cluster: 0x0300, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:49:10:597 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:10:616 wait response fastEnddeviceProbe() 0x000D6F0002FB9F6F, elapsed 906 ms 18:49:10:619 CTRL skip polling while permit join is set 18:49:10:640 FP indication 0x0000 / 0x8005 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:10:643 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:10:656 ZDP indication search sensors 0x000D6F0002FB9F6F (0xA3BB) cluster 0x8005 18:49:10:657 ZDP indication search sensors 0x000D6F0002FB9F6F (0xA3BB) clear timeout on cluster 0x8005 18:49:10:665 discard double entry in binding queue (size: 2) for for 0x000D6F0002FB9F6F, cluster 0x0101 18:49:10:832 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:10:836 CTRL skip polling while permit join is set 18:49:11:101 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:11:105 CTRL skip polling while permit join is set 18:49:11:329 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:11:333 CTRL skip polling while permit join is set 18:49:11:352 FP indication 0x0000 / 0x8005 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:11:353 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:11:354 ZDP indication search sensors 0x000D6F0002FB9F6F (0xA3BB) cluster 0x8005 18:49:11:590 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:11:594 CTRL skip polling while permit join is set 18:49:11:608 FP indication 0x0104 / 0x000A (0x000D6F0002FB9F6F / 0xA3BB) 18:49:11:618 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:11:619 [INFO] - No button map for: YRD220/240 TSDB, unicast to: 0x0000, endpoint: 0x01, cluster: 0x000A, command: 0x00, payload: 00000200030004000500, zclSeq: 13 18:49:11:849 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:11:863 CTRL skip polling while permit join is set 18:49:12:086 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:12:090 CTRL skip polling while permit join is set 18:49:12:333 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:12:346 CTRL skip polling while permit join is set 18:49:12:582 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:12:585 CTRL skip polling while permit join is set 18:49:12:834 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:12:836 CTRL skip polling while permit join is set 18:49:13:085 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:13:092 CTRL skip polling while permit join is set 18:49:13:227 verified group capacity: 255 and group count: 1 of LightNode 0x000d6ffffefadf32 18:49:13:230 0x000d6ffffefadf32 found group 0xFFF0 18:49:13:334 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:13:339 CTRL skip polling while permit join is set 18:49:13:583 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:13:596 CTRL skip polling while permit join is set 18:49:13:834 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:13:837 CTRL skip polling while permit join is set 18:49:14:093 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:14:104 CTRL skip polling while permit join is set 18:49:14:127 Door lock debug 0x000D6F0002FB9F6F, data 0x00000007 18:49:14:133 FP indication 0x0104 / 0x0101 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:134 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:137 ZCL configure reporting rsp seq: 135 0x000D6F0002FB9F6F for ep: 0x01 cluster: 0x0101 attr: 0x0000 status: 0x00 18:49:14:341 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:14:345 CTRL skip polling while permit join is set 18:49:14:358 FP indication 0x0104 / 0x0001 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:360 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:362 ZCL configure reporting rsp seq: 136 0x000D6F0002FB9F6F for ep: 0x01 cluster: 0x0001 attr: 0x0021 status: 0x00 18:49:14:597 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:14:599 CTRL skip polling while permit join is set 18:49:14:617 FP indication 0x0104 / 0x0019 (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:620 ... (0x000D6F0002FB9F6F / 0xA3BB) 18:49:14:844 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:14:849 CTRL skip polling while permit join is set 18:49:15:090 MAC poll fastEnddeviceProbe() 0x000D6F0002FB9F6F 18:49:15:094 CTRL skip polling while permit join is set 18:49:16:705 APS-DATA.indication from unknown node 0xB0CE18140003CF57 18:49:16:716 ZCL attribute report 0xB0CE18140003CF57 for cluster: 0x0300, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:49:17:148 send permit join, duration: 0 18:49:17:312 ZCL attribute report 0x286D97000109A6B0 for cluster: 0x0402, ep: 0x01, frame control: 0x08, mfcode: 0x0000 18:49:17:560 DB UPDATE device_descriptors SET data = x'01040102040007000001000300200002040005050b0203001900', timestamp = 1614901757 WHERE device_id = (SELECT id FROM devices WHERE mac = '28:6d:97:00:01:09:a6:b0') AND endpoint = 1 AND type = 4 18:49:17:566 DB INSERT INTO device_descriptors (device_id, endpoint, type, data, timestamp) SELECT id, 1, 4, x'01040102040007000001000300200002040005050b0203001900', 1614901757 FROM devices WHERE mac = '28:6d:97:00:01:09:a6:b0' 18:49:17:962 Search sensors done 18:49:18:732 Current channel 25 18:49:18:758 CTRL got nwk update id 2 18:49:18:794 Device TTL 2952 s flags: 0x7 18:49:26:364 DeviceAnnce of LightNode: 0x00124b0017fa8f68 Permit Join: 0 18:49:26:508 ZDP discovery done in 145 ms 18:49:26:664 delay sending request 96 dt 0 ms to 0x00124B0017FA8F68, ep: 0x01 cluster: 0x0004 onAir: 1 18:49:26:788 verified group capacity: 7 and group count: 1 of LightNode 0x00124b0017fa8f68 18:49:26:797 0x00124b0017fa8f68 found group 0xFFF0 18:49:27:650 saved node state in 1 ms 18:49:27:916 sync() in 262 ms 18:49:28:613 APS-DATA.indication from unknown node 0xB0CE18140003CD23 18:49:28:621 ZCL attribute report 0xB0CE18140003CD23 for cluster: 0x0300, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:49:28:648 Skip idle timer callback, too early: elapsed 730 msec 18:49:30:266 Bind response success for 0x000d6ffffefadf32 ep: 0x01 cluster: 0x0000 18:49:30:400 ZCL configure reporting rsp seq: 155 0x000D6FFFFEFADF32 for ep: 0x01 cluster: 0x0000 attr: 0x4000 status: 0x00 18:49:32:026 APS-DATA.indication from unknown node 0xB0CE18140003CD23 18:49:32:030 ZCL attribute report 0xB0CE18140003CD23 for cluster: 0x0300, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:49:33:481 APS-DATA.indication from unknown node 0xB0CE1814030ABE68 18:49:33:489 ZCL attribute report 0xB0CE1814030ABE68 for cluster: 0x0006, ep: 0x01, frame control: 0x18, mfcode: 0x0000 18:49:40:649 Skip idle timer callback, too early: elapsed 936 msec 18:49:42:756 APS-DATA.indication from unknown node 0x00158D0001BFA5A5 18:49:50:756 Bind response success for 0x000d6ffffefadf32 ep: 0x01 cluster: 0x0006 18:49:50:844 ZCL configure reporting rsp seq: 173 0x000D6FFFFEFADF32 for ep: 0x01 cluster: 0x0006 attr: 0x0000 status: 0x00 18:49:50:943 Bind response success for 0x000d6ffffefadf32 ep: 0x01 cluster: 0x0000 18:49:58:360 APS-DATA.indication from unknown node 0xB0CE1814030E19AF 18:49:58:362 ZCL attribute report 0xB0CE1814030E19AF for cluster: 0x0008, ep: 0x01, frame control: 0x18, mfcode: 0x0000

ashar38 commented 3 years ago

Oh between, for me, the Lockstate in cluster attribute appears to report it correctly. In fact, it locks/unlocks and reads attributes correctly even in the current production version of deconz (ver 2.9.1) that I have. image

Smanar commented 3 years ago

18:49:10:360 [INFO] - No button map for: YRD220/240 TSDB, unicast to: 0x0000, endpoint: 0x01, cluster: 0x000A, command: 0x00, payload: 0100, zclSeq: 10

It seem the device do "something" with the time ?

And yes, the device is invisible in phoscon, and on other third app too, sorry it's realy something new, for the moment the only way to act on it is using the API, like here https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3750#issuecomment-769512774

I just need to know if the return is working before making the PR. I think sending command is working as no one have problem for that. To be sure it s working I need to have value for config/lock and state/lockstate.

Or better, change the device state manualy, and check if value are updated in the api.

And BTW, if you update the xml file, you will have some more command in deconz on the cluster 0x0101

ashar38 commented 3 years ago

I have some progress: Test 1: Unlock through API. Http 200 image

Result of GET: image

Test 2: Lock through API image

GET: image

Question: Why does the lockstate return Open in second test. Shouldn't it return closed/locked?

Deconz appears to show it correctly. image

ashar38 commented 3 years ago

Further updates. Having done it again. I think the GET method is working as well, however as the lock takes a few seconds to respond to and execute the command, if I fire the GET in between that, it still returns Stale values, if that makes sense.

However, two issue still remain, not sure if this is intentional or otherwise. image

  1. LastUpdated is never updated. It is always None.
  2. Lockstate states the opposite of what the actual state is. What I mean is when the door is locked, it says LockState = Open. And when the door is unlocked, it says Lockstate = Closed. Deconz continues to read it correctly so it is likely just an issue with the API.
ashar38 commented 3 years ago

Another thing I forgot to highlight, I made HTTP Patch requests instead of Put (which was recommended earlier). I think patch makes more sense since we only want to change one attribute, not everything.

Smanar commented 3 years ago

Another thing I forgot to highlight, I made HTTP Patch requests instead of Put (which was recommended earlier). I think patch makes more sense since we only want to change one attribute, not everything.

Logic.

LastUpdated is never updated. It is always None.

Yes, need to correct.

Lockstate states the opposite of what the actual state is. What I mean is when the door is locked, it says LockState = Open. And when the door is unlocked, it says Lockstate = Closed. Deconz continues to read it correctly so it is likely just an issue with the API.

I don't see Lockstate = Closed on your capture, the state is not locked on "open" ? Have corrected too.

Have updated the code, and yes I think it s normal it take some time, there is a state "partial unlocked", so I think the device check for this state too before sending state.

cd deconz-rest-plugin
git pull
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

Just restart deconz, no need to re include the device.

ashar38 commented 3 years ago

Here are new results: Screen shots added at the bottom. Summary of results

  1. LockState updating well
  2. LastUpdatedDate is also updating well.

Questions: What does lock attribute inside config mean? My understanding is that to lock we will send { "lock" : true} and to unlock we will send { "lock" : false}. Is my understanding correct?

If so, what I have noticed is that i. I send unlock command. "lock" : false. ii. The Lockstate updates to Unlocked. Which is good. However, the "lock" attribute remains at true. iii. I send another unlock command, even though the door is already unlocked. iv. This time lockstate stays unlocked, as expected. In addition, "lock" attribute also changes to false. v. The same was observed when locking. Essentially, I need to send two patch requests for lock attribute to refresh. Refer to my last 2 screenshots showing this.

Another question: What would happen if I lock/unlock the door manually by hand. Will deconz do a regular polling of the device so that it's status is not stale?

-------------------- reference test results Test 1. Unlock from API. image

GET: image

Test2: Lock from API. image GET first: Notice how LockState is refreshed. However Lock Attribute is still not updated to True. image

GET second after second patch. notice how the lock attribute is now updated and set to true. image

Smanar commented 3 years ago

Questions: What does lock attribute inside config mean? My understanding is that to lock we will send { "lock" : true} and to unlock we will send { "lock" : false}. Is my understanding correct?

Yep, was same in my mind.

And state/lockstate is the value send by the device itself.

If you take a look on your 2 last tests, you will see the value config/lock changing, but not the lastupdated and lastseen, so I think it s more an updating problem.

What would happen if I lock/unlock the door manually by hand. Will deconz do a regular polling of the device so that it's status is not stale?

You can try ^^, it s a good test, and no, if all is perfect, deconz don't make pool (there is too some setting for pooling), it s the device that use reporting. Setting are

        rq.minInterval = 1;
        rq.maxInterval = 300;
        //rq.reportableChange8bit = 1;

So the device send a notification with a delay 1 / 300 s, but every time the value change too. This part is realy important, so yes better to test it to be sure it s working.

I have updated the code for the config/lock. Tell me if it s better.

If all is fine on your side I will make the PR, but there is so much thing possible with this kind of device, for exemple Auto relock time, or Unlock with timer. This kind of setting are visible in deconz if you update the xml file. PIN gestion too need to be improved. There is too alarm, mode, ....

ashar38 commented 3 years ago

If you take a look on your 2 last tests, you will see the value config/lock changing, but not the lastupdated and lastseen, so I think it s more an updating problem.

It is possible. Would it help if I perform this test: i. Start with the lock in unlocked position. ii. Send a patch to lock it and check if the lockstate and config.lock are correct. Based on my observation, at this point, lockstate would say locked, but config.lock would still be stale/ not refreshed. iii. Do not send another patch like I did last time, instead I would just wait for 5-10 seconds. iv. Send a GET again to check if config.lock is now updated. Hopefully by now it reports correct value.

Let me know if this makes sense. I will also check and report back on the manual lock test.

I used to use this lock with Smartthings before I moved to using Conbee. And yes, you are correct, you can do things like create and reset PINs, and a lot more.

But I would say it might be a good idea to start with basic functionality in first release (like lock/unlock etc), and then explore more in future releases. I now have a decent Virtual Machine setup and I can help you with running test cases pretty quickly. So feel free to ask me whenever you want new code to be tested. Cheers.

ashar38 commented 3 years ago

I am back with new set of tests and results, all done on latest code you just checked-in Test 1: Unlock with API and then run a GET on the lock. Results: Passed LockState : unlocked LastUpdated: Correct time stamp Config.Lock : false

Test 3: Lock with API and then run a GET on the lock. Results: Passed LockState : locked LastUpdated: Correct time stamp Config.Lock : true

Test 3: Unlock by Hand and then run a GET on the lock. Results: Passed LockState : unlocked LastUpdated: Correct time stamp Config.Lock : false

Test 4: Lock by Hand and then run a GET on the lock. Results: Passed LockState : locked LastUpdated: Correct time stamp Config.Lock : true

Test 5: Unlock with API/Hand, wait for Autolock (I have setup autolock after 30 seconds), then run GET. Results: Passed LockState : locked LastUpdated: Correct time stamp Config.Lock : true

Smanar commented 3 years ago

Yeah ^^.

Thx a lot, will make the PR today.

But I would say it might be a good idea to start with basic functionality in first release (like lock/unlock etc), and then explore more in future releases. I now have a decent Virtual Machine setup and I can help you with running test cases pretty quickly. So feel free to ask me whenever you want new code to be tested. Cheers.

Sure, tell want you think is the more usefull ?

For me it s the alarm, but I realy have no clues how it is working, I have added some debug in log for that, but was realy old.

Edit: I have updated the code with the last official master, and clean it for the PR. Can you share a JSON in text format ? To show it for third app can integrate it.

Smanar commented 3 years ago

PR done https://github.com/dresden-elektronik/deconz-rest-plugin/pull/4540

ashar38 commented 3 years ago

Hi @Smanar thank you very much for this. Apologies I have been busy over the weekend so could not respond earlier.

Regarding important features, I do not believe alarm is that important. To understand exactly what the alarm setting is, I did this: The lock basically has two major pieces, one gets installed on the outside of the door, and one inside. The piece on the outside connects to the circuitry inside by a cable. So if an intruder beaks the outside piece, the cable would snap, and that would trigger a loud audible alarm. I replicated it by unplugging the cable while the lock was still powered, and got in to raise a siren.

I do not think it is that important to have as a feature inside deconz/phoscan. I believe a rather useful feature would be ability to create PIN codes from the app, but it can be done in a future release. Another important feature could be to read the battery percentage inside the app, not sure if you included this already.

ashar38 commented 3 years ago

Here is the Json as you requested.

"config": {
    "battery": 31,
    "lock": true,
    "on": true,
    "reachable": true
},
"ep": 1,
"etag": "debe9e2638af1004aae3ab2f802eee10",
"lastseen": "2021-03-08T18:26Z",
"manufacturername": "Yale",
"modelid": "YRD220/240 TSDB",
"name": "YRD220/240 TSDB",
"state": {
    "lastupdated": "2021-03-05T22:58:52.951",
    "lockstate": "locked"
},
"type": "ZHADoorLock",
"uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx-xxxx"

}

Smanar commented 3 years ago
"config": {
    "battery": 31,

I think the battery will be ok

I believe a rather useful feature would be ability to create PIN codes from the app, but it can be done in a future release.

Will start that using deconz already (on another branch), but yes I think i will be easier than understand how work notification.

Smanar commented 3 years ago

Ok so have started to take a look for PIN code.

I have some problem to understand how work the xml file. If you can replace your (/usr/share/deCONZ/zcl) with this one ? https://github.com/Smanar/deconz-rest-plugin/commit/ba9765dc61433919b7614b0af65ce2fda444b579

2 Things to try

Those 2 command make the same thing but are not coded same, so idk if they will work.

github-actions[bot] commented 3 years ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] commented 3 years ago

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

AntiqS commented 3 years ago

Hi @Smanar ,

I see that your work is already merged with the current release, this gave us possibility to unlock the door remotely via Deconz, which is already amazing :) Thank you!

Is there a way to make the lock appearing in Phoscon as well?

Smanar commented 3 years ago

It s something realy new, so need some time, but can ask to phoscon github https://github.com/dresden-elektronik/phoscon-app-beta/issues

zeiphon commented 3 years ago

Amazing! I am looking forward to trying this out.

@Smanar is it worth re-opening this issue to keep it going for the PIN code / log request commands?

Smanar commented 3 years ago

ATM I m using this issue to continu https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4253 To don't have 10 openend issue, as all doorlock are working same

To test pin/code, can you make this test pls ? https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3750#issuecomment-795796432

brientim commented 3 years ago

Ok so have started to take a look for PIN code.

I have some problem to understand how work the xml file. If you can replace your (/usr/share/deCONZ/zcl) with this one ? Smanar@ba9765d

2 Things to try

  • request the log record
  • Get PIN id

Those 2 command make the same thing but are not coded same, so idk if they will work.

Just coming into this and so far, I acknowledge the good work that has been done and the new general.xml cover the core functions, unlock/;lock and retrieve the event logs.

The API is only exposing the Lock Status/functionality and battery status and what assistance is required to assist in development.

  • request the log record(s)
  • Get PIN id
  • Get Schedule(s)
  • Post User Pin
  • Post Schedule

Currently the API has the lock as a Sensor and this only presents limited data and what is the planned changed to the API to incorporate or expose other functionality?

Smanar commented 3 years ago

There is already a new filed, the notification

"state": {
"lastupdated": "2021-04-01T19:00:56.250",
"lockstate": "unlocked",
"notification": "source:rfid,code:Unlock,pin:0"
},

I think the next part will be the PIN management, but for that I need to make working usng the GUI first to test command.