Deconz-rest-plugin: Add support for Danalock v3

Created on 4 Apr 2018  ·  146Comments  ·  Source: dresden-elektronik/deconz-rest-plugin

Smart locks are the future, so let's support the Zigbee version of the Danalock v3.

https://danalock.com/danalock-v3.html

Device Request

Most helpful comment

Please add support for this lock. That would be much appreciated.

All 146 comments

I agree!

Hey,

i tried to integrate my Danalock V3-Zigbee.

But the problem is, that the cluster for changing the lock state is shown as "unknown cluster". Attached you can see the information I can see.

Also I have attached to official zigbee documentation for the danalock.

Additional info: Danalock uses new ZHA V3 and is currently supported only by amazon echo plus (with zigbee)

May someone help?

Best regards
TD003 Zigbee manual.pdf

danalock_1
danalock_2

You’ll need to add the 0x0101 cluster (attributes and commands) to general.xml for it to show in the deCONZ GUI. Typically this involves manually translating the text from the ZCL or ZHA specification into XML.

Next step would be figuring out how the lock responds to the various commands, how its state is reflected in the attributes, and whether it supports attribute reporting.

Then, we need to figure out what /lights and/or /sensors resources to create for the lock. This will be ugly: we cannot PUT a /sensors state, so controlling the lock will likely be through a /lights resource (cf. what we did for the siren, window covering, and vent). Additionally, there’s no config.battery for a /lights resource, so we’d need an additional /sensors resource to expose the battery level.

I'm very new to zigbee "coding". May someone is willing to help me :) I guess it would also help others AND! i think when the raspbee supports smartlocks in general it will be a great advantage for the product.

So I now added the following cluster:

<cluster id="0x0101" name="Door Lock">
    <description>Provides a mechanism for the controlling a Smart Lock.</description>
    <client>
    </client>
    <server>
        <attribute id="0x00" name="Lock state" type="u32" access="rw" required="o"></attribute>
        <attribute id="0x01" name="Lock type" type="u32" default="0x00" access="rw" required="o"></attribute>
        <attribute id="0x02" name="Actuator enabled" type="u32" default="0x00" access="rw" required="o"></attribute>
        <attribute id="0x10" name="Num lock records supported" type="u32" default="17918" access="rw" required="o"></attribute>
        <attribute id="0x11" name="Num total users Supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x12" name="Num PIN users supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x13" name="Num FRID users supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x14" name="Num weekday schedules supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x15" name="Num yearday schedules supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x16" name="Num holiday schedules supported" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x20" name="Enable logging" type="u32" default="1" access="rw" required="o"></attribute>
        <attribute id="0x34" name="Zigbee security level" type="u32" default="0" access="rw" required="o"></attribute>
        <attribute id="0x40" name="Alarm mask" type="u32" default="0xFFFF" access="rw" required="o"></attribute>
        <attribute id="0x42" name="RF operation event mask" type="u32" default="0xFFFF" access="rw" required="o"></attribute>
        <attribute id="0x43" name="Manual operation event mask" type="u32" default="0xFFFF" access="rw" required="o"></attribute>
        <attribute id="0xFFFD" name="Cluster revision" type="u32" default="0x01" access="rw" required="o"></attribute>
        <command id="0x00" dir="send" name="LockDoorResponse" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x01" dir="send" name="UnlockDoorResponse" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x00" dir="recv" name="LockDoor" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x00" dir="recv" name="UnlockDoor" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x01" dir="recv" name="GetLogRecord" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x04" dir="send" name="GetLogRecordResponse" required="o">
            <description></description>
            <payload></payload>
        </command>
        <command id="0x20" dir="send" name="Operationg Event Notification" required="o">
            <description></description>
            <payload></payload>
        </command>
    </server>
</cluster>

Its adopted from danalocks zigbee documentation (mentioned above).

But with this code, every cluster in deconz is now showing as "unknown". I cannot see any syntax errors.

May someone has more know how then me? :)

Best regards

If all the clusters show unknown, there’s something wrong with the general.xml. Typically a syntax error, but maybe also a logical error. The command IDs seem to have duplicates. Did you put this in the _Closures_ domain, just before the _Windows covering_ cluster? If you could attach the zipped general.xml, I’ll have a look.

EDIT The Danalock Zigbee manual is very brief. Looking at the ZCL spec, the attributes aren’t all uint32 nor read/write. Also, the response commands have a mandatory payload, and the set commands take the PIN as optional payload. Not sure if the Danalock supports a PIN though.

More information is not submitted by danalock ...

Attached you can find the requested zip file containing general.xml

deconz.zip

Best regards

Anyone already reviewed my case?

Thank you very much 😘

Okay. I just had some tries...
As I see, even if I remove my smart lock cluster from general.xml the unknown of every cluster remains.

I compared my general.xml with the "original" one, here from github.

The problem still appears. Every cluster is now unknown. Thefuck is wrong?

Looks like you placed the new entries in the wrong domain.

Did you put this in the _Closures_ domain, just before the _Windows_ covering cluster?

Hi

Yes i did. but as i mentioned, i additionaly removed the cluster and compared it with the original. And still everything is unknown. I also let deconz reread the config

I also let deconz reread the config

I never got that to work. Best quit and restart deCONZ to reload general.xml.

Could you try the general.xml from my commit mentioned above?

Dang! This works out of the box!

Now let's just make looks "apiable".

Why we don't disguise it as a switch? Like 1 is locked and 0 is unlocked.

Could you please post a screenshot of the _Door Lock_ cluster (after reading all the attributes)?

Could you check if you can setup attribute reporting for the _Lock State_ attribute? I would hope/expect that this attribute will reflect the current lock state automatically when you issue a _Lock Door_ or _Unlock Door_ command, and when you control the lock manually.

bildschirmfoto von 2018-08-10 20-09-05
bildschirmfoto von 2018-08-10 20-09-12
Attached the screenshots.

I dont have to setup anything. The state updates out of the box, after updating.

I currently try to modify the rest api plugin source, by just "copying" the window-covering parts.

EDIT: Hmm, lock won't appear. :/

I currently try to modify the rest api plugin source, by just "copying" the window-covering parts.

Indeed, best expose it as a light, with state.on mapped to the lock state. However, there's a little more to it. Change addLightNode() in de_web_plugin.cpp:

  • The vendor ID (0x115c) needs to defined and whitelisted, as it's battery operated (if (node->nodeDescriptor().manufacturerCode() == VENDOR_...)`;
  • The cluster needs to be defined and whitelisted by setting hasServerOnOff (if (i->inClusters()[c].id() == DOOR_LOCK_CLUSTER_ID);
  • The device id (0x000a) needs to be defined and whitelisted (case DEV_ID_DOOR_LOCK under case DEV_ID_HA_WINDOW_COVERING_DEVICE).

In light_node.cpp:

  • Add the vendor to setManufacturerCode();
  • Add the device id to setHAEndPoint() to set the type to "Door lock".

That should be enough for the resource to be created (I hope). Best search for DEV_ID_HA_WINDOW_COVERING_DEVICE and WINDOW_COVERING_CLUSTER_ID to make sure they're not whitelisted elsewhere.

Note to self: the device id 0x000a for _Door Lock_ is still missing from general.xml.

Next, you need to map state.on to the _Lock State_ attribute (so that changes to the lock state get reflected in state.on). In nodeEvent() in de_web_plugin.cpp, whitelist DOOR_LOCK_CLUSTER_ID to call updateLightNode(). In updateLightNode(), whitelist the same cluster and add a handler for ic->id() == DOOR_LOCK_CLUSTER_ID, similar to _ONOFF_CLUSTER_ID_, but obviously checking for attribute 0x0101/0x0000.

To control the lock from the REST API, you need to create a new routine addTaskDoorLock() in zcl_tasks.cpp, cf. the addTaskWarning() I created to control the Siren. Based on a lock state parameter, add a task with a _Lock Door_ or _Unlock Door_ command. In rest_lights.cpp, you need to call this routine from setLightState() under if (hasOn). You need to check for taskRef.lightNode->type() == QLatin1String("Door lock"), similar to what I've done under hasAlert for the Siren.

I currently try to modify the rest api plugin source, by just "copying" the window-covering parts.

How does it work? Where can I do this?

Follow the steps in the README to get a local copy of the source of the REST API plugin and compile and install it. Then edit your local source and recompile the plugin.

Then edit your local source

I am a beginner in these things. Is it possible that you upload the changed files?
Your instructions above are certainly good, but unfortunately I can not do it without help.

Thanks in advance!!!

So guys. I published my plugin changes here: https://github.com/pascal1337/deconz-rest-plugin/

I did many modifications according window_covering and Warnings.

I am now at a point, where I'm not able to get further. Compilation still shows a "undeclared"-error and the API won't bring up my lock.

Maybe someone can have a closer lo(o/c)k :P

VENDOR_DANALOCK should be the _Manufacturer code_ from the _Node info_ panel.

What is the compile error?

The following error appears:

g++ -c -pipe -Wno-attributes -Wall -Wno-attributes -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DDECONZ_DLLSPEC=Q_DECL_IMPORT -DARCH_ARM -DARCH_ARMV7 -DUSE_WEBSOCKETS -DHAS_SQLITE3 -DGW_SW_VERSION=\"2.05.34\" -DGW_API_VERSION=\"1.0.9\" -DGIT_COMMMIT=\"0e7156dc2109aabd38d10146d6e0d3393b48574a\" -DGW_AUTO_UPDATE_FW_VERSION=0x260b0500 -DGW_MIN_RPI_FW_VERSION=0x261f0500 -DGW_MIN_DERFUSB23E0X_FW_VERSION=0x22030300 -DGW_DEFAULT_NAME=\"Phoscon-GW\" -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../.. -I../../common -isystem /usr/include/arm-linux-gnueabihf/qt5 -isystem /usr/include/arm-linux-gnueabihf/qt5/QtWidgets -isystem /usr/include/arm-linux-gnueabihf/qt5/QtGui -isystem /usr/include/arm-linux-gnueabihf/qt5/QtSerialPort -isystem /usr/include/arm-linux-gnueabihf/qt5/QtWebSockets -isystem /usr/include/arm-linux-gnueabihf/qt5/QtNetwork -isystem /usr/include/arm-linux-gnueabihf/qt5/QtCore -Irelease -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o release/websocket_server.o websocket_server.cpp zcl_tasks.cpp: In member function ‘bool DeRestPluginPrivate::addTaskDoorLock(TaskItem&)’: zcl_tasks.cpp:922:21: error: ‘TaskDoorLock’ was not declared in this scope task.taskType = TaskDoorLock; ^~~~~~~~~~~~ zcl_tasks.cpp: In member function ‘bool DeRestPluginPrivate::addTaskDoorUnlock(TaskItem&)’: zcl_tasks.cpp:957:21: error: ‘TaskDoorUnlock’ was not declared in this scope task.taskType = TaskDoorUnlock; ^~~~~~~~~~~~~~ Makefile.Release:1037: recipe for target 'release/zcl_tasks.o' failed make[1]: *** [release/zcl_tasks.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/home/pi/deconz/test/deconz-rest-plugin' Makefile:38: recipe for target 'release' failed make: *** [release] Error 2

Yes. This is the point where I currently stand.

Did you declare the lock and unlock functions in de_web_plugin_private.h?

Yes I did. Row 1072, 1073

So I did some changes and compiled the plugin, copied it to /usr/share/deCONZ/plugins, rebooted and:
img_2049

When I am at home, I will test the functionality.

Sooo guys. When I make an API request

It shows the light correctly with all its details:

{
 "etag": "010881e2e4974327caa7b3eb871a1e34",
 "hascolor": false,
 "manufacturername": "Danalock",
 "modelid": "V3-BTZB",
 "name": "Danalock",
  "state": {
   "alert": "none",
   "on": true,
   "reachable": true
  },
"swversion": "0000000E",
"type": "Door Lock",
"uniqueid": "00:0b:57:ff:fe:59:e0:4b-01"
}

When I try to change steht state

PUT http://192.168.178.100/api/CD5466EA30/lights/7/state
{"on":true}

The response is

{
"error":{
 "address":"/lights/7",
 "description":"resource, /lights/7, not available",
 "type":3
 }
}

@pascal1337 : Please, coud you update your repository? I warnt to test your changes. Thx!

EDIT:
Vielleicht geht es auch auf Deutsch ;-)
Ich hab das Verzeichnis von Dir neu runter geladen und nun Compiler (ohne Fehler). Danach hab ich das neue plugin „rüber kopiert“ und einen reboot gemacht. Danach eine Suche in Phoscon gestartet. Leider taucht das Danalock dort nicht auf. Mache ich was falsch?

Danke im Voraus!

Grüße

@tomac01 Hallo :) Das Repo ist jetzt aktuell. Ich bin mir nicht sicher, ob die Suche über Phoscon erfolgreich ist. Ich habe das Danalock direkt über die deCONZ Gui auf meinem Raspberry aufgenommen. Du musst hierfür mit einer Büroklammer, Zahnstocher o.ä. ein mal kurz auf das Loch im Danalock drücken. Das Danalock beginnt dann grün zu leuchten / blinken. In diesem Zeitraum muss das Netzwerk für neue Geräte geöffnet werden.

Vielen Dank!
Werde ich nachher sofort ausprobieren.

@pascal1337 : Ich hab mir das Repro nochmal mit „gibt clone“ neu runtergeladen und dann compiliert. Das war auch erfolgreich, denn es wurde das PlugIn erzeugt. Danach hab ich es in das bekannte PlugIn-Verzeichnis kopiert (das alte File wurde ersetzt).

Das Danalock hab ich (was es vorher zwar schon war) nochmal neu eingebunden. Über die deConz-Oberfläche (Netzwerk) kann ich das Schloss auch korrekt per ZigBee bedienen. Danach reboot des Raspi durchgeführt.

Leider zeigt mir das Phoscon das Schloss nicht als Lampe an. Auch nicht, wenn danach suchen lasse.

Hast Du noch eine Idee? Wie gesagt: Im Netzwerk über den Desktop des Raspi (per VNC) kann ich das Schloss steuern. Eingebunden ist es damit. Nur Phoscon zeigt nix an.

Vielen Dank im Voraus!

@pascal1337 Ich hab nochmal meine Anzeige in DeCONZ mit Deinen Bildern oben verglichen. Die general.xml von ebaauw zeigt anstatt „000a“ „Door Lock“ an. Aber das dürfte doch nur die Übersetzung für die 000a sein, oder?

2b703cea-87a4-4e22-a4f2-20eda9fc8d00

Indeed, afaik the device type is used only in the GUI display.

Battery-operated devices are a bitch to pair. If the lock already displays in the GUI, but the REST resources aren’t created:

  • Open the network from the old web app, or search for lights from the Phoscon app;
  • Read the _Basic_ cluster’s attributes from the GUI.
  • Do something with the lock, to make sure it’s awake (briefly press the reset button, or control the lock manually).
  • The REST API plugin should create the resource when it receives the _Basic_ attributes from the lock.

If that doesn’t work, double-check your lock has the same:

  • Mac address prefix,
  • Manufacturer ID (in the _Node info_ panel),
  • Model ID and _Manufacturer name_ (in the _Basic_ cluster)

I checked

  • Mac adress prefix: 000b57 -> ok
  • Manufacturer Code: 0x115c -> ok
  • Model ID: V3-BTZB (it's the same ID as by pascal1337) -> think it's ok
  • Manufacturer Name: Danalock -> ok

I have followed the instructions of you exactly. But the lock is only recognized in the deCONZ GUI. Neither the old web-app nor phoscon will recognize the lock.

Here is a picture of the Node Info from the lock:
unbenannt

Do you have another idea?
Is it possible to search for errors somewhere?

Thx a lot!

@pascal1337 Könntest Du mir Deine compilierte libde_rest_plugin.so zum Test zur Verfügung stellen? Wenn die nicht geht, liegt es vielleicht an etwas anderem... danke im Voraus!

Some long shots:

  • Are you sure you installed the plugin correctly? You need to overwrite the stock library or move it out of the /usr/share/deCONZ/plugins directory; simply renaming it (to .old or something) is not enough.
  • Are running the latest version of the deCONZ core program?
  • Run deCONZ with --debug-info=2 and double check that the RaspBee receives messages from the lock. If, after restarting deCONZ, the _Basic_ cluster attributes are read and populated in the GUI you’re good.
  • Double-check the lock’s battery.

@ebaauw:

  • The plugin is installed (overwritten) as described in the readme file.
  • I've downloaded the deb package again and reinstalled. It should be the last version (see picture below).
    e9ab6eca-902d-4b20-aa87-986483cf7e5c
  • According to the app, the betteries are ok.
  • the Basic cluster atttributes are read and populated in the deCONZ-GUI. I can also control the lock via the GUI (open / close).

This afternoon I will start deCONZ with the debug settings and have a look ....

Hi,

my compiled plugin: http://dinge.xyz/libde_rest_plugin.so

@ebaauw you have another tip for me regarding my api, which isn't doing anything?

@pascal1337 Great! After I copied your file into the directory and did a restart on Phoscon, the Danalock was immediately recognized as light.
unbenannt

I do not know what I did wrong when compiling. But there must be the problem. There was no error compiling and the file was created. That was actually a good sign for me, but does not seem so ... ;-(

Many Thx!

you have another tip for me regarding my api, which isn't doing anything?

I wouldn’t necessarily trust the error message (that the resource cannot be found), but read it to mean that something failed while handling the PUT, like no _OnOff_ cluster. Can you still update other light states? Looking at your repo, you didn’t yet change rest_lights.cpp?

Hello, no other lights are still updatable via phoscon.

So you can not switch the lock on phoscon? the same for me

No, unfortunately not. Although Phoscon shows that the "lamp" is on, the lock does not react. In the deConz GUI, I also see no activities. As I said, I can open and close the lock via the GUI. Not with Phoscon.

@pascal1337 : Gibt es schon was Neues? Ich kann hier leider nicht helfen. Ich bekomme ja nicht mal das compilieren hin :-(. Hattest Du schon die Zuordnung des Clusters 101 kontrolliert? Es kann doch eigentlich nur noch etwas Kleines sein...
Viele Grüße

Hi, hab leider nicht so viel Zeit aktuell...

Hab leider keinen weiteren Lösungsansatz.

@pascal1337, in rest_lights.cpp you need to change setLightState(). Where handling the on key in the json body (if (hasOn)), you need to check whether the device is a lock and, if so, issue a _Lock Door_ or _Unlock Door_ command, instead of an _On_ or _Off_ command. You need to create the corresponding taks(s) in zcl_task,cpp, or create a new file, as was done for Window covering devices. See PR https://github.com/dresden-elektronik/deconz-rest-plugin/pull/746.

I dont get the fucking logic out of rest_lights.cpp. It calls hasOn() and then addTaskSetOnOff(). But nowhere is said if it should turn the light on or off. I dont know, where to put my addTaskDoorLock respectively addTaskDoorUnlock. I also dont want to fuck with the API, why can we not integrate a correct lock-device into the API?

Best regards,
Pascal

addTaskSetOnOff takes the ON/OFF as a parameter:
addTaskSetOnOff(task, isOn ? ONOFF_COMMAND_ON : ONOFF_COMMAND_OFF, 0))
So it depends on isOn, which is set earlier.

I'm totally new to this topic and can't help yet. I have a brand new Danalock V3 w/Zigbee in my house.
What I have also here is a Raspberry 3B and a Raspberry Zero W and some programming experience. What would I need additionally to get as far as you did in controlling the Danalock? I assume a Zigbee stick, raspBee or conBee. Or can it be any Zigbee stick, like Qivicon/Telekom/whatever?

Hi
I dont know if deconz supports other sticks than raspbee / conbee. But in addition you need nothing more.

Is there any news on this matter?
I recently moved all my automation to zigbee protocol and I'm about to get a smart lock and I really want to stick with zigbee.
Danalock is the best lock supporting zigbee...
So... Is there nobody else (with programming skills... :-) ) looking into this? @manup? @ebaauw?

Hi, i want to look about that if i had enough time.
I got my danalock yesterday and work with Home Assistant and Node-Red.
So i use a bad quickfix. Im using https://github.com/ma-ca/deconz-cli-plugin this Plugin and the Telnet Node from Node-Red and send "zclcmd shortaddr 1 0x0101 1" to open the Lock and "zclcmd shortaddr 1 0x0101 0" to close it. (where shortadress is yout Locks shortadress in DeConz i.e 0xab12) In HomeAssistant i use a MQTT Lock Component. Work like a charm...but isn´t a real Solution for deconz.

I look forward to fix the code in the next weeks.

@katanapod Hey, much thanks for your good idea. I rebuilt your quick fix and it works, but not that reliable...

Have you any update on the code?

yes, the solution of katanapod works just fine!

For my home automation (iobroker) I have the netcast command built into a javascript.
My wish is now become true!

@katanapod : thx a lot!

My biggest problem is now, to get the status of the lock quick and reliable. My current code for this is:

#!/bin/bash

statusfile="/home/pi/workbench/mqtt-launcher/status.txt"

old_status=`cat $statusfile`

value=$(/bin/echo "zclattr 0x568e 1 0x0101 0x0000" | /bin/nc -w3 localhost 5008 2>&1 | /bin/grep "APS attr 0x000B57FFFE59E04B")

value=$(/bin/echo $value |/usr/bin/cut -d ' ' -f 8)

if [ "$value" == "02" ]; then
        /bin/echo "UNLOCK" > $statusfile
        new_status="UNLOCK"
elif [ "$value" == "01" ]; then
        /bin/echo "LOCK" > $statusfile
        new_status="LOCK"
fi

if [ "$old_status" != "$new_status" ]; then
        /usr/bin/mosquitto_pub -h 192.168.178.55 -t home/danalock/state -m "$new_status"
fi

With a cronjob, which runs every minute
* * * * * root /home/pi/workbench/mqtt-launcher/check_state.sh

May anyone is willing to import a lock function to the deconz rest api, I'll be happy to help...

I have a Nuki Smart Lock 2.0 that will support ZigBee _Door Lock Cluster_ in a firmware update in Q1/2019.

The above discussion suggests to add the lock to /lights but I believe @manup is not happy with that.

I have not actually started to implement the Door Lock into the rest-api, so there is still time to change this to /sensors or wait for a new /devices resource.

I guess before working around with a door lock as light, it would be rational to implement a /locks resource also in view that more and more smart locks become zigbee compatible (Danalock, Yale, Nuki, Aqara, ...)

@manup @ebaauw @katanapod

Many thanks for your support.

I'm looking to buy the Zigbee version of this lock. I have deConz/Conbee. Aside from the issue with it being seen as a light, will it work out of the box or do I need to do some tweaking with the Zigbee deConz/Conbee set up? Thanks. Elliott

@pascal1337:

Ich bekomme bei dem Befehl "value=$(/bin/echo "zclattr 0xe05a 1 0x0101 0x0000" | /bin/nc -w3 192.168.178.13 5008 2>&1 | /bin/grep "APS attr 0x000B57FFFE46F1A1")" aus Deinem Shell-Skript kein Ergebnis bzw. das Skript scheint nicht zum Ende zu kommen. Wenn ich das Ganze ohne Variablenspeicherung per Promt ausführe, bekomme ich zwar das grep-Ergbenis, jedoch bleibt er im nc-Modus.

Die Eingabe ohne grep-Befehl gibt mir neben dem APS-Ergebnis dauerhat die LQIs wieder (Endlosschleife).

Was mache ich falsch?
Danke im Voraus!

@manup @ebaauw @katanapod

Is there a mechanism to sponsor\support the hardware, if that would help with your development?

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.

Shoudn’t this be an active issue? Smart locks are hugely popular and I see this wanted supported with conbee/Deconz/phoscon several places online.

It’s almost sold out in Norway. They even provide full zigbee documentation for third parties. This seems like a good and impressive thing for deconz/phoscon and Homebridge-Hue to support. i’ll test all the way!

@pascal1337 @tomac01 @katanapod Will Phoscon (as the updated general.xml was merged) be able to just let the Danalock join my network and expose it as a light (I'm not expecting any functionality in Phoscon, but only simplest way to try the Deconz REST CLI plugin). Are you just starting a search for new lights and clicking the Danalock pinhole once ? Or are you somehow opening the network from Deconz GUI and then clicking Danalock pinhole ? I can't get it into the network any way.

I was also wondering if this issue is still active, smart locks support (and Dana Lock in specific) would help me a lot and really seems like a good direction to go to with DeConz.

Please add support for this lock. That would be much appreciated.

@manup Could you please consider supporting this now according to screenshots and code provided above ? I know REST API v2 is in the works but this has been requested for a long time and would make many users happy. If not in the Phoscon web GUI at least in the REST API.

TD003 Zigbee manualV0.0.15.pdf

@manup @ebaauw After a lot of nagging I didn't get loaner devices for you developers, but I got their latest expanded Zigbee 3.0 documentation for the lock, and a promise of "further support in Q2 or Q3 in 2020" from Danalock. I would think it would be possible to make it work with DeCONZ (as in Zigbee2MQTT) before then. I´ll eagerly do the physical testing!

@ebaauw

I have made some progress with this lock. It responds to Rest API request, i.e. it locks and unlocks perfectly fine, but it does not report/update its state. Do you have any suggestion what can be wrong?

Is this handled by handleWindowCoveringClusterIndication for Window Covers, i.e. I need to write a similar for door lock?

Did you expose it as a /sensors resource? In that case you need to handle the attribute values in updateSensorNode() in de_web_plugin.cpp. There's already a branch for DOOR_LOCK_CLUSTER_ID as that's used by the lumi.vibration sensor (don't ask me why). Best add an else branch to if testing for that sensor (the Danalock seems to follow the standard well enough). Otherwise you need to handle the cluster attributes in updateLightNode(). Make sure to whitelist the device type.

Did you setup bindings from the lock's clusters to the coordinator (cf. chapter 5 of the manual)?

Thanks!

I expose it as a light. I had forgotten about the binding. Now it works perfectly! Since I have an old door where the inside also turns when i use the key from outside I have a reliable status message from the lock also.

In order to make this work, I struggled a bit:
1) Replace the general.xml with the updated as from previous post by pascal1337
2) Replace the modified rest api plugin link (If it matters, I use deCONZ v. 2.05.67, and running a Raspberry Pi3b+ with Raspbian. I started my modification with the latest from the deconz-rest-plugin as of yesterday.)
3) Let the lock join the network by setting the lock in pairing mode
3) For me, Phoscon would only recognize the lock after I had pressed the "Read Node Descriptor" in deCONZ GUI of the door lock node.

I don´t use any lights with deCONZ setup, so I may have broken some functionality.

I’m not sure I am able to, or even if it would be accepted, but this in a pull request would be awesome.

@ebaauw I tried to read the manual (ch 9 Bindings) but I still don’t think I got it.

I’ve followed @arnerek ‘s recipe and can reliably now control the lock through the Deconz REST API, but the status is always unlocked.

Tried to drag from the lock’s Door Luck cluster to source in the Bind Dropbox and from both the Configuration Tool and Level Control endpoints from the coordinator to destination and click bind but no change.

After creating the binding, you need to setup reporting for the attributes you want to be updated automatically. Open the _Cluster Info_ panel in the GUI, select the cluster, scroll down and double-click on the attribute. In the popup window enter the settings (typically min: 1, max: 300) and press the _Write Config_ button.

Thank you!! I get invalid_data_type unfortunately as in screenshot. Any idea why?
Skjermbilde 2019-10-13 kl  12 50 04

EDIT: Disregard that. I had to wait and read attributes once first. Works perfectly!

The only problem now is that I stopped the DeCONZ (minimal) service and started the GUI with the same user to do this, and when turning back to the minimal service it doesn't seem to hold. Status is not reported again..

(Apart from not related error of home.app seemingly always showing the Door Lock type to "unlocked" any time the app is opened, resulting in the door lock staying at status "Locking..." when it is currently locked. But that's another problem.)

EDIT2: @ebaauw Could the headless Deconz have limitations in this regard? Some things done in the GUI is not taken into regard? How can I run the GUI instead of the headless as a service when the rpi is headless and I occasionally only stop the minimal Deconz service and run the GUI with X-forwarding to the Mac?

Some things done in the GUI is not taken into regard?

Bindings and attribute reporting are stored on the ZigBee device, in non-volatile memory.

Could the headless Deconz have limitations in this regard?

No, there’s only one deCONZ binary with a command-line option to suppress the GUI. Both services start the same binary.

I run my Raspberries headless, but still with the graphical environment enabled, using VNC server and MacOS screen sharing client to interact with the GUI.

I'm going nuts! When the GUI is running from the command line the status is now accurately and immediately reported. When I close that and restart the deconz.service it is updated but the 'on' state is always 'false'. I can however still lock and unlock. Sorry for troubling you, @ebaauw

EDIT: I think I've narrowed it down. When I stop the minimal and start the GUI I always mess around with the Door Lock and check cluster 0101 and click Read on the Attributes. It is then it has worked while the GUI has run! When I revert to the minimal deconz.service I of course don't/can't Read Attributes and it doesn't work. Not even after a long while or manually manipulating the lock.

Also the Door Lock was flashing red in the GUI prior to reading the attributes.

Can you tell why the status is not updated from this log, @ebaauw ? I use @arnerek 's plugin which he is still improving, but I'm wondering if I have messed something up in my DeCONZ.

Here I unlock it (while minimal deconz.service is running):

okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:02:708 <-LQI 0x0B04   012 9 3 0x000B57FFFEC4FA38 0xE8A8 1 1 2 02 0F 36
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Endrer tilstand
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her2!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her3!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her4!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her, 1!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Has on!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:05:951 Er her5!
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:06:054 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:06:054 APS Ind 71, 0xFD8A: 0C 00 0D 00 03 F6 2C 02 FF FF 2E 21 00 F6 2C 02 FF FF 2E 21 00 00 00 24 02 00 73 F6 2C 02 FF FF 2E 21 00 6D 64 C3 FE FF 57 0B 00 4F 03 25 02 0F D9 F6 2C 02 FF FF 2E 21 00 04 7A 77 FE FF 9F FD 90 04 0B 25 02 0F 29
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:06:054 <-LQI 0xFD8A   013 0 3 0x00212EFFFF022CF6 0x0000 0 1 2 02 00 73
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:06:519 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:30:06 LillePi deCONZ[22034]: 21:30:06:519 APS Ind 71, 0xFD8A: 0D 00 0D 03 03 F6 2C 02 FF FF 2E 21 00 12 7C 70 FE FF 57 0B 00 E0 3D 25 02 0F 71 F6 2C 02 FF FF 2E 21 00 B7 BB D6 FE FF 57 0B 00 26 46 25 02 0F 3A F6 2C 02 FF FF 2E 21 00 6A 06 C2 FE FF 57 0B 00 48 4C 25 02 0F D6
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:06:519 <-LQI 0xFD8A   013 3 3 0x000B57FFFE707C12 0x3DE0 1 1 2 02 0F 71
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:015 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:015 APS Ind 71, 0xFD8A: 0E 00 0D 06 03 F6 2C 02 FF FF 2E 21 00 86 C4 C7 FE FF 6F 0D 00 18 5E 25 02 0F 81 F6 2C 02 FF FF 2E 21 00 0F ED EE FE FF 57 0B 00 A7 67 25 02 0F 35 F6 2C 02 FF FF 2E 21 00 5B 9B AF FE FF 6F 0D 00 C8 A8 25 02 0F 8A
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:015 <-LQI 0xFD8A   013 6 3 0x000D6FFFFEC7C486 0x5E18 1 1 2 02 0F 81
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:479 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:479 APS Ind 71, 0xFD8A: 10 00 0D 09 03 F6 2C 02 FF FF 2E 21 00 8E 9C 88 FE FF 9F FD 90 D3 BE 25 02 0F 69 F6 2C 02 FF FF 2E 21 00 88 DC C7 FE FF 6F 0D 00 93 CB 25 02 0F 70 F6 2C 02 FF FF 2E 21 00 38 FA C4 FE FF 57 0B 00 A8 E8 25 02 0F FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:479 <-LQI 0xFD8A   013 9 3 0x90FD9FFFFE889C8E 0xBED3 1 1 2 02 0F 69
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:944 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:944 APS Ind 27, 0xFD8A: 13 00 0D 0C 01 F6 2C 02 FF FF 2E 21 00 57 5F F3 FE FF 6F 0D 00 D1 F4 25 02 0F 5B
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:07:944 <-LQI 0xFD8A   013 12 1 0x000D6FFFFEF35F57 0xF4D1 1 1 2 02 0F 5B
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:369 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:369 APS Ind 4, 0xABF9: 19 76 01 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:369 <-ZCL serverToClient 0xABF9 1 for cluster 0x0101 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:416 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:416 APS Ind 4, 0xABF9: 19 76 01 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:416 <-ZCL serverToClient 0xABF9 1 for cluster 0x0101 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:817 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:817 APS Ind 13, 0xABF9: 09 5A 20 01 02 FF FF 00 FF FF FF FF 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:817 <-ZCL serverToClient 0xABF9 1 for cluster 0x0101 01 02 FF FF 00 FF FF FF FF 00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:848 Node data 0x000b57fffe59e55a profileId: 0x0104, clusterId: 0x0101
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:848 Start. UddateLight
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 updateLights!
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 Status dørlås: 0
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 ZCL attribute report 0x000B57FFFE59E55A for cluster 0x0101, ep 0x01
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 APS Ind 7, 0xABF9: 08 5B 0A 00 00 30 02
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 <-ZCL attribute report 0xABF9 0x0101 1 00 00 30 02
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:849 ->ZCL default response seq id 0x5B command id 0x0A, status 0x00
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:09:944 APS-DATA.confirm status 0x00, id = 0x9F, srcEp = 0x01, dstcEp = 0x01, dstAddr = 0xABF9
okt. 14 21:30:13 LillePi deCONZ[22034]: 21:30:11:818 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF

Here I lock it again (which doesn't change the On-state to true):

okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:35:753 <-LQI 0x0000   014 13 1 0x000B57FFFEC4FA38 0xE8A8 1 1 3 01 00 B3
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Endrer tilstand
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her2!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her3!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her4!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her, 1!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Has on!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:37:313 Er her5!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:379 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:379 APS Ind 4, 0xABF9: 19 77 00 00
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:379 <-ZCL serverToClient 0xABF9 1 for cluster 0x0101 00
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:811 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:811 APS Ind 13, 0xABF9: 09 5D 20 01 01 FF FF 00 FF FF FF FF 00
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:811 <-ZCL serverToClient 0xABF9 1 for cluster 0x0101 01 01 FF FF 00 FF FF FF FF 00
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:842 Node data 0x000b57fffe59e55a profileId: 0x0104, clusterId: 0x0101
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:842 Start. UddateLight
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 updateLights!
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 Status dørlås: 0
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 ZCL attribute report 0x000B57FFFE59E55A for cluster 0x0101, ep 0x01
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 profileid 0104, clusterid 0101, srcEndpoint 01, dstEndpoint 01, status 0x00, securityStatus FF
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 APS Ind 7, 0xABF9: 08 5E 0A 00 00 30 01
okt. 14 21:33:38 LillePi deCONZ[22034]: 21:33:38:843 <-ZCL attribute report 0xABF9 0x0101 1 00 00 30 01
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:38:843 ->ZCL default response seq id 0x5E command id 0x0A, status 0x00
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:38:990 APS-DATA.confirm status 0x00, id = 0x09, srcEp = 0x01, dstcEp = 0x01, dstAddr = 0xABF9
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:179 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:179 APS Ind 71, 0x67A7: 69 00 0D 00 03 F6 2C 02 FF FF 2E 21 00 F6 2C 02 FF FF 2E 21 00 00 00 24 02 00 63 F6 2C 02 FF FF 2E 21 00 6D 64 C3 FE FF 57 0B 00 4F 03 25 02 0F 28 F6 2C 02 FF FF 2E 21 00 04 7A 77 FE FF 9F FD 90 04 0B 25 02 0F 82
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:179 <-LQI 0x67A7   013 0 3 0x00212EFFFF022CF6 0x0000 0 1 2 02 00 63
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:660 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:660 APS Ind 71, 0x67A7: 6C 00 0D 03 03 F6 2C 02 FF FF 2E 21 00 12 7C 70 FE FF 57 0B 00 E0 3D 25 02 0F 2E F6 2C 02 FF FF 2E 21 00 B7 BB D6 FE FF 57 0B 00 26 46 25 02 0F 34 F6 2C 02 FF FF 2E 21 00 6A 06 C2 FE FF 57 0B 00 48 4C 25 02 0F 1A
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:39:660 <-LQI 0x67A7   013 3 3 0x000B57FFFE707C12 0x3DE0 1 1 2 02 0F 2E
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:125 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:125 APS Ind 71, 0x67A7: 6F 00 0D 06 03 F6 2C 02 FF FF 2E 21 00 86 C4 C7 FE FF 6F 0D 00 18 5E 25 02 0F 1E F6 2C 02 FF FF 2E 21 00 5B 9B AF FE FF 6F 0D 00 C8 A8 25 02 0F 2C F6 2C 02 FF FF 2E 21 00 8E 9C 88 FE FF 9F FD 90 D3 BE 25 02 0F 3E
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:125 <-LQI 0x67A7   013 6 3 0x000D6FFFFEC7C486 0x5E18 1 1 2 02 0F 1E
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:621 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:621 APS Ind 71, 0x67A7: 72 00 0D 09 03 F6 2C 02 FF FF 2E 21 00 88 DC C7 FE FF 6F 0D 00 93 CB 25 02 0F 41 F6 2C 02 FF FF 2E 21 00 38 FA C4 FE FF 57 0B 00 A8 E8 25 02 0F 36 F6 2C 02 FF FF 2E 21 00 57 5F F3 FE FF 6F 0D 00 D1 F4 25 02 0F 64
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:40:621 <-LQI 0x67A7   013 9 3 0x000D6FFFFEC7DC88 0xCB93 1 1 2 02 0F 41
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:41:086 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:41:086 APS Ind 27, 0x67A7: 74 00 0D 0C 01 F6 2C 02 FF FF 2E 21 00 41 11 8A FE FF 9F FD 90 8A FD 25 02 0F 37
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:41:086 <-LQI 0x67A7   013 12 1 0x90FD9FFFFE8A1141 0xFD8A 1 1 2 02 0F 37
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:464 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:464 APS Ind 71, 0x4626: 7A 00 0D 00 03 F6 2C 02 FF FF 2E 21 00 F6 2C 02 FF FF 2E 21 00 00 00 24 02 00 22 F6 2C 02 FF FF 2E 21 00 6D 64 C3 FE FF 57 0B 00 4F 03 25 02 0F 0E F6 2C 02 FF FF 2E 21 00 04 7A 77 FE FF 9F FD 90 04 0B 25 02 0F 52
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:464 <-LQI 0x4626   013 0 3 0x00212EFFFF022CF6 0x0000 0 1 2 02 00 22
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:944 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:944 APS Ind 71, 0x4626: 7B 00 0D 03 03 F6 2C 02 FF FF 2E 21 00 6A 06 C2 FE FF 57 0B 00 48 4C 25 02 0F 13 F6 2C 02 FF FF 2E 21 00 86 C4 C7 FE FF 6F 0D 00 18 5E 25 02 0F 14 F6 2C 02 FF FF 2E 21 00 0F ED EE FE FF 57 0B 00 A7 67 25 02 0F 30
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:44:944 <-LQI 0x4626   013 3 3 0x000B57FFFEC2066A 0x4C48 1 1 2 02 0F 13
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:425 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:425 APS Ind 71, 0x4626: 7E 00 0D 06 03 F6 2C 02 FF FF 2E 21 00 5B 9B AF FE FF 6F 0D 00 C8 A8 25 02 0F 14 F6 2C 02 FF FF 2E 21 00 88 DC C7 FE FF 6F 0D 00 93 CB 25 02 0F 1C F6 2C 02 FF FF 2E 21 00 57 5F F3 FE FF 6F 0D 00 D1 F4 25 02 0F 80
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:426 <-LQI 0x4626   013 6 3 0x000D6FFFFEAF9B5B 0xA8C8 1 1 2 02 0F 14
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:922 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:922 APS Ind 71, 0x4626: 81 00 0D 09 03 F6 2C 02 FF FF 2E 21 00 41 11 8A FE FF 9F FD 90 8A FD 25 02 0F 37 F6 2C 02 FF FF 2E 21 00 7D CE 93 FE FF 57 0B 00 EE E8 12 00 02 FF F6 2C 02 FF FF 2E 21 00 A0 EF 36 02 00 8D 15 00 44 C5 12 00 02 FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:45:922 <-LQI 0x4626   013 9 3 0x90FD9FFFFE8A1141 0xFD8A 1 1 2 02 0F 37
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:46:370 profileid 0000, clusterid 8031, srcEndpoint 00, dstEndpoint 00, status 0x00, securityStatus FF
okt. 14 21:33:46 LillePi deCONZ[22034]: 21:33:46:370 APS Ind 27, 0x4626: 84 00 0D 0C 01 F6 2C 02 FF FF 2E 21 00 5A E5 59 FE FF 57 0B 00 F9 AB 12 00 02 FF
okt. 14 21:33:47 LillePi homebridge[269]: [2019-10-14 21:33:47] [Hue] lumi.remote.b286acn01 Stue: set homekit status fault from 1 to 0
okt. 14 21:33:53 LillePi node-red[950]: 14 Oct 21:33:53 - [info] [sectoralarm-site:34ecc6dc.1194e2] Received 'check' command
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:46:370 <-LQI 0x4626   013 12 1 0x000B57FFFE59E55A 0xABF9 2 0 1 00 02 FF
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491 Node data 0x00158d00027c069a profileId: 0x0104, clusterId: 0x0000
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491 Start. UddateLight
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491 no button map for: lumi.remote.b286acn01 ep: 0x01 cl: 0x0000 cmd: 0x0A pl[0]: 001
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491 ZCL attribute report 0x00158D00027C069A for cluster 0x0000, ep 0x01
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491 0x00158D00027C069A extract Xiaomi special attribute 0xFF01
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         01 battery 3005 (0x0BBD)
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         03 temperature 33 °C
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         04 unknown 17320 (0x43A8)
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         05 RSSI dB (?) 23 (0x0017)
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         06 LQI (?) 4294967296 (0x0100000000)
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         08 unknown 5129 (0x1409)
okt. 14 21:33:55 LillePi deCONZ[22034]: 21:33:47:491         0a unknown 62673 (0xF4D1)

Solved it temporarily by sending netcat "r 0xABF9 1 0x0101 0" (reading attribute 1 of Door Lock) to DeCONZ CLI plugin once (and every hour to be safe) after the start of my minimal deconz.service.

@ebaauw I now have terrible battery life on the lock. I would expect some but 10-20% down each day is a bit much. Do you think I can have “bound” it too many times in Deconz? So it’s reporting way too often in duplicates? Is there a table of all bindings somewhere?

I think there is a ZDP command to read the binding table; you could send it using the deconz-cli-plugin and sniff the response. I don't think the number of bindings will be the main factor reducing battery life; more likely it's the poll control and/or attribute reporting configuration, causing the device to wake up too often.

@ebaauw You are (of course) right and the ZDP command shows the 1 binding.

I did go over my automation logic and find an unnecessary loop in zigbee messaging (polling) too.

But I see it also reports its status every 5 minutes or so after I set up reporting of the attribute in Cluster Info in Deconz (“max: 300”). I know I don’t quite yet understand everything zigbee and Deconz, but isn’t this unecessary as it’s not a passive sensor and will report status when the lock is changed anyway........?

EDIT: I see there's a Poll Control cluster to which seems to be set by default to 14400 as check-in interval...

Is this supported by default in the new software version, or do I need to follow all instructions above?

I am deciding between Danalock Zigbee or Zwave.

I am also interested to get it running. Can you share a step-by-step guide? im also totally new to deconz

Why is this issue stale/closed?
The Lock is fully detected by deConz:
Screenshot_20200115_160911

but not exposed through the restAPI (and never detected by Phoscon/sensors/add new sensor/other)

curl --tcp-nodelay --max-time 59 -H 'Content-Type: application/json' -X GET http://hassio:40850/api/mypass/
"devicename": "ConBee II",
"name": "Zigbee",
"name": "my application"
"name": "Phoscon#B1066x452"
"name": "Phoscon#B1290x655"
"name": "pydeconz"
"name": "my application"
"name": "Bed Lights",
"manufacturername": "Philips",
"name": "Color temperature light 1",
"manufacturername": "Philips",
"name": "Color temperature light 2",
"manufacturername": "Philips",
"name": "Daylight",
"manufacturername": "Eurotronic",
"name": "SPZB0001",
"manufacturername": "Eurotronic",
"name": "SPZB0001 (2)",

Do we need to open a new issue?

I've added @pascal1337's changes into a proper fork, https://github.com/fr34kyn01535/deconz-rest-plugin/commits/master, but couldn't get the lock to show up in the rest api...

Hallo Sven,

I wanted to avoid forking and maintaining my own code.
Dresden Elektronik asked to post new devices here, and all information is provided.
But this requests is 2 years old, where are the Dresden Elektronik people?

I am looking into zigbee2mqtt now. The codebase of this plugin is honestly a mess, and an architecture of hard-coded flags wont bring us to a bigger eco system of devices. It should be possible to add new behaviors and devices without rewriting that much of the core behavior.

I have been using my modified rest api plugin since October and it has been working flawlessly.

I exposed the lock as a light, but I am not sure if this solution would be accepted. I am not a coder, and not experienced with github. If someone are interested I can share the code. It would be great to have this lock supported in the official code.

@arnerek sharing it could surely help the one or another in here..

@arnerek I believe this will be accepted just fine, it is the same way it has been done for Smoke detectors etc. Can you please make a pull request to the main repository?

@arnerek: You read the comment above? I did not see the pull request today .. and still hope ;-)

I will try to make a pull request. Hopefully in the next days

I see @arnerek exposes the lock as a /lights resource. I’m not sure that’ll work out, as there’s typically some delay between setting the target lock state and the lock changing its current lock state. You might want different attributes for target vs current state to reflect that, cf. the thermostats. These are exposed as /sensors resources, with the target in state in config and the (read-only) current state in state.
Of course the same holds for window covering devices.

Looks like this lock doesn’t support _Groups_, so there’s no compelling reason to expose it as a /lights resource. Don’t know about other locks, though.

@ebaauw What is the alternative then?
Is it not only lights resources that can be tourned on and off? Then one need to make a few sensors reflecting the states you described?
Sorry, I do not know Deconz inside out yet.

As I mentioned above, a /sensors resource with the target state mapped to a config attribute and the current state mapped to a state attribute.

Hello!

I just bought a Danalock V3 Zigbee lock. I am trying to use the code that arnerek has written cause it would be nice to get it into Deconz. I'm new to github but do I understand it right if I am supposed to be able to compile a version of the plugin based on arnereks branch? Cause that's what Im trying to do, compiling goes on for quite a while but end with errors.

I did like this:
git clone -b Danalock https://github.com/arnerek/deconz-rest-plugin

cd deconz-rest-plugin

qmake && make -j2

Is this correct or do I have to read more about how git works. :)

/Erik

I think it's correct and the easier way (you don't need to use git checkout with this method)
But you miss the command line to replace the files

sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

and don't forget

sudo apt install deconz-dev

what is your error ?

It actually worked now. I wrote make clean and then tried again.
Compiling finished. Then did the next step:

sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

and yes I did sudo apt install deconz-dev before.

Then restarted the service and tried to pair the lock in the Phoscon App but with no luck I'm afraid.

Don't really know what more to do. Anyone else that managed to get this to work?

@lillaeriika Just to check Did you replace the general.xml as in my previous post? This should make the lock visible in deCONZ, and you should be alle to Execute the commands lock and unlock.

@arnerek Hmm, I didn't find any post where you were talking about general.xml? But to be clear, should I take the general.xml from your branch and put it in folder: /usr/share/deCONZ/zcl?

That's is what I did. Rebooted. Still doesn't work. :(

This post: https://github.com/dresden-elektronik/deconz-rest-plugin/issues/520#issuecomment-538741388

I think that location is correct. Search for new light and use a paper clip in the pin hole of the Danalock to pair.

Also not working for me, i made everything u listed and can't get it to work.

Can you try to let the lock join the network from deCONZ? From deCONZ you should be able to lock and unlock.

yes i am able to lock and unlock from the cluster but i can't find it in the lights or in the api

Did you try this: “ For me, Phoscon would only recognize the lock after I had pressed the "Read Node Descriptor" in deCONZ GUI of the door lock node.”

You could also try turning the lock while searching for new light in phoscon

I could not lock and unlock it without pressing this Button, so yes i did it already.
Tried lock and unlocking it with a search but still nothing.

What is your version of the gateway (found in Phoscon)?

2.05.69 / 25.2.2020

even tried reading all attributes at the basic cluster etc.

Hello Everyone,

Devices:
Raspberry Pi 2 Model B
Conbee II (Version 2.05.69 / 2/14/2020)

I did the following:

  1. sudo apr-get update
  2. sudo apt install deconz-dev
  3. git clone -b Danalock https://github.com/arnerek/deconz-rest-plugin
  4. cd deconz-rest-plugin
  5. qmake && make -j2
  6. sudo mv /usr/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/libde_rest_plugin.so.bak
  7. sudo mv libde_rest_plugin.so /usr/share/deCONZ/plugins/libde_rest_plugin.so
  8. reopen deCONZ GUI

I can operate the lock from deCONZ GUI
I can use it as a lamp in HomeAssistant with OOTB plugins, but it doesn't save the state of the lamp.

What should I do to lamp save the state?
How can I turn lamp to switch (like Aqara Smart Plug) in deCONZ?

Thanks

Weird. Does the Danalock app give you a reliable door lock status?

I use the lock template in Home Assistant: https://www.home-assistant.io/integrations/lock.template/

@arnerek you know why my lock isn't showing up in lights?

No sorry. Maybe check the permission or ownership of the libde_rest_plugin.so file? Delete the lock on Deconz and add again?

The permissions are correct. How can i delete that item with the GUI? Pressing the del key will just "reconnect" it 5 seconds later

Weird. Does the Danalock app give you a reliable door lock status?

I use the lock template in Home Assistant: https://www.home-assistant.io/integrations/lock.template/

Thank you.
It is perfect now.

I don't know why but initially lock didn't keep the state. But now it works fine.

also got it working now after deleting the lock from GUI and resetting und reconnecting it over the Danalock App

I got a bit further as well. I've never used the GUI before but when I managed to start it the lock was actually there. I deleted it from Deconz GUI and then added it back via the Webapp. It then showed up in both the GUI and the Phoscon App. So now its in all the places.

Last problem: I can lock/unlock in GUI and Webapp but not the Phoscon App?

Actually it seems to work in Phoscon App also but a bit laggish. I got it in to Openhab and it seems to work very good from there so I think I'm happy. I will be doing some more testing tomorrow. Thanks for all the help. Finally a good nights sleep!

Thanks to share your thoughts. I think that I´ll also buy a DanaLock and Test it.
By the way: Did you know if the Dockerfile is available? I am running my DECONZ on Docker on a OrangePi Zero Plus :)

Edit:
Would be nice to Keep it running in Docker with DanaLock Support.

And:
Do you see the HTML-Form to add new devices to Deconz? Did anyone submit this solution that it will be integrated to future Versions?

I got in the same state as someone above. The lock wouldn't keep the state. And the commands only arrived sometimes. I removed it once again completely from Deconz. Added it with phoscon. Worked straight away and now it works perfectly. Controling it from Deconz works, phoscon, adding it to Openhab and also controling it from Openhab. So happy. Thank you all.

@ebaauw What's the status here, why is the issue closed? Does the devs need more info?

What's the status here

I’m sorry, I don’t know. I don’t have any smart lock myself and didn’t write any of the code supporting it. As mentioned above, unlike back in 2018, I now fear exposing the lock as a /lights resource might be a bad idea. It might lead to unresolvable issues (like needing to read the attributes in the GUI, before you can change the state over the API). The recent experiences with warning devices (sirens) caused me to change my view. The only compelling argument to support a device (function) as a /lights resource is when that function supports groups (as is the case with the window covering devices, and with the Heiman (standalone) siren, but not with the sirens of smoke detectors).

why is the issue closed?

To keep the stale bot happy?

Does the devs need more info?

I think there’s probably enough info here, especially since @bohtho managed to score the technical manual, see https://github.com/dresden-elektronik/deconz-rest-plugin/issues/520#issuecomment-537240173.

As mentioned above, the current code base for the REST API plugin is very complex, and adding support for a new device type involves a lot of hit and miss develop-test cycles. Because of this, I no longer try to add support for devices that I don’t have. I’m happy to work on REST API (and Homebridge Hue) support for the Danalock if I can get a loaner, or if people would like to sponsor me getting the device myself. Please note that I cannot add support to Phoscon, as it’s not open source.

Thanks @ebaauw. I’ve switched to native ZHA in Homeassistant now (using Conbee 1), with great success. The Danalock works out of the box.

Hello Everybody.
For the last few days I am trying to make my Danalock V3 to work with Conbee II (Version 2.05.69, Raspberry PI 4) and Home Assistant 0.109.6. After connecting process I see my lock as a light in Phoscon App and I can manage it through the deCONZ GUI. After this I am doing Authentication process in Phoscon App to connect it with HA (HA is installed on my NUC server and I make connection with Conbee II using integration in HA by IP of my PI4). It works except the state of the Danalock. After restart of my Danalock the integration fail to work! I still can manage it through the deCONZ GUI, exec commands to lock/unlock work perfect. Please help.

Any news on if this is going to be supported in Deconz?? I tried to get it working but I did not understand this thread and what I was supposed to do :) Can someone make a step by step thing ?

@helto4real, you can use my list of steps:
https://github.com/dresden-elektronik/deconz-rest-plugin/issues/520#issuecomment-612411637
then use arnerek's suggestion if you need lock UI element in Home Assistant
https://github.com/dresden-elektronik/deconz-rest-plugin/issues/520#issuecomment-612471028

Sometimes I have the following issues:

  • the lock doesn't keep state. In this case, I go to deCONZ GUI and read the state manually
  • unknown state of the lock, I this case, I go to deCONZ GUI and change the state manually

Gibt es mittlerweile eine "einfache" Anleitung für newbies, um das Danalock mit dem Conbee2 / Deconz zu verbinden?

Maybe it will be interesting for anyone, I merged changes for Danalock with deconz-rest-plugin-2_05_77_stable. With previous version I was unable to add Aqara opple.
Sources are in my github.

-- Edit by Mimiix > Removing URL until further clearance. If you wish to post a PR for Deconz, you can always do that here

Maybe it will be interesting for anyone, I merged changes for Danalock with deconz-rest-plugin-2_05_77_stable. With previous version I was unable to add Aqara opple.
Sources are in my github.

-- Edit by Mimiix > Removing URL until further clearance. If you wish to post a PR for Deconz, you can always do that here

It’s working perfect :-) but is there anyway to get the battery status through the api? :-)

No one can make a PR to this repo, to make it definitive ?

I updated my rest plugin now but the lock is now removed from the Phoscon app and i can't find it in the api either. Any suggestions for this problem? Already tried resetting and reconnecting.

@manup please merge this into the code :-)

I think we have asked them to include this in different ways and issues for 3 years now. I moved on to zigbee-herdsman. Works instantly.

I updated my rest plugin now but the lock is now removed from the Phoscon app and i can't find it in the api either. Any suggestions for this problem? Already tried resetting and reconnecting.

Then you have to downgrade the plugin or manually add the changes to make it work again :-)

@smulle48 It is getting merged prior the 15th. That's when a new version releases :)

He often merges in the week before :)

Btw. Is it just me or does the state of the lock (bulb) not change when you manually turn it?

My lock retain the last state initiated by the web app

My lock changes state when I turn the lock manually.

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.

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.

As it's treated as a light bulb, you got on/off (lock/unlock).

That Auto Unlock, you already got in the Danalock app, including the "hold on unlock".

As it's treated as a light bulb, you got on/off (lock/unlock).

That Auto Unlock, you already got in the Danalock app, including the "hold on unlock".

@smulle48
That means if you unlock through zigbee it uses the configured option set on the app?
So it's not possible to have unlock and hold on unlock separately?

As it's treated as a light bulb, you got on/off (lock/unlock).

That Auto Unlock, you already got in the Danalock app, including the "hold on unlock".

@smulle48
That means if you unlock through zigbee it uses the configured option set on the app?
So it's not possible to have unlock and hold on unlock separately?

So far, it's only possible to lock and unlock through zigbee. The rest you can do from the official Danalock app

As it's treated as a light bulb, you got on/off (lock/unlock).

That Auto Unlock, you already got in the Danalock app, including the "hold on unlock".

@smulle48
That means if you unlock through zigbee it uses the configured option set on the app?
So it's not possible to have unlock and hold on unlock separately?

So far, it's only possible to lock and unlock through zigbee. The rest you can do from the official Danalock app

Okay, thank you very much!

Closing this one as support has been provided with version .79.

Was this page helpful?
0 / 5 - 0 ratings