dresden-elektronik / deconz-rest-plugin

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

Frient intelligente KeyPad #5352

Closed Maxcrouz73 closed 9 months ago

Maxcrouz73 commented 3 years ago

Hello there, this is my first contribution to this great software, hope i do this correctly.

Device

Clusters of the node

Node info panel

Basic Clusters

Basic

Basic Clusters

Identify

Identify

Poll Contro

Poll Control l

IAS Zone

IAS Zone

Power Configuration

Power configuration

Gw3n4 commented 11 months ago

Hello,

I have been using this device with PR #5918 from @Smanar since July 2022. I used to perform, after each deConz update, the following

1st time: sudo apt install deconz-dev git clone --branch keypad_rfid https://github.com/Smanar/deconz-rest-plugin.git cd deconz-rest-plugin sudo apt-get install qtcreator qmake && make -j2 sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

after the 1st time: cd deconz-rest-plugin git pull qmake && make -j2 sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

and then have the alarmsystem learn the codes I needed with:

It allowed me to add my RFID tags as additional codes and it was working really well (thanks again @Smanar ). But now it does not work any more with the last deConz update.

I do not know why it does not work anymore, and why it has never been merged in the deConz rest plugin, but it would be really nice if it could be :)

Smanar commented 11 months ago

I have updated the "keypad_rfid " branch, so it's now based on last official version. You can make a new try but

But now it does not work any more with the last deConz update.

You have an error message or it's just no more working ?

Gw3n4 commented 10 months ago

Thank you @Smanar . I finally had time to test it but I get the following when compiling:

root@raspberrypi:/home/pi/deconz-rest-plugin# qmake && make -j2 Info: creating stash file /home/pi/deconz-rest-plugin/.qmake.stash make -f Makefile.Release make[1]: Entering directory '/home/pi/deconz-rest-plugin' /usr/lib/qt5/bin/uic de_web_widget.ui -o ui_de_web_widget.h /usr/lib/qt5/bin/uic ui/ddf_editor.ui -o ui_ddf_editor.h /usr/lib/qt5/bin/uic ui/device_widget.ui -o ui_device_widget.h g++ -c -pipe -Wno-attributes -Wno-psabi -Wall -O2 -std=gnu++1y -Wall -Wextra -D_REENTRANT -fPIC -DUSE_ULIB_SHARED=1 -DUSE_DUKTAPE_JS_ENGINE -DSKIP_EMPTY_PARTS=Qt::SkipEmptyParts -DUSE_WEBSOCKETS -DHAS_SQLITE3 -DHAS_OPENSSL -DGW_SW_VERSION=\"2.24.01\" -DGW_SW_DATE=1701100471 -DGW_API_VERSION=\"1.16.0\" -DGIT_COMMMIT=\"181d49634ccf64c15c334c1427814e72754d0379\" -DGW_AUTO_UPDATE_AVR_FW_VERSION=0x260b0500 -DGW_AUTO_UPDATE_R21_FW_VERSION=0x26420700 -DGW_MIN_AVR_FW_VERSION=0x26400500 -DGW_MIN_R21_FW_VERSION=0x26720700 -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../../lib -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtSerialPort -I/usr/include/arm-linux-gnueabihf/qt5/QtWebSockets -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -Irelease -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o release/air_quality.o air_quality.cpp g++ -c -pipe -Wno-attributes -Wno-psabi -Wall -O2 -std=gnu++1y -Wall -Wextra -D_REENTRANT -fPIC -DUSE_ULIB_SHARED=1 -DUSE_DUKTAPE_JS_ENGINE -DSKIP_EMPTY_PARTS=Qt::SkipEmptyParts -DUSE_WEBSOCKETS -DHAS_SQLITE3 -DHAS_OPENSSL -DGW_SW_VERSION=\"2.24.01\" -DGW_SW_DATE=1701100471 -DGW_API_VERSION=\"1.16.0\" -DGIT_COMMMIT=\"181d49634ccf64c15c334c1427814e72754d0379\" -DGW_AUTO_UPDATE_AVR_FW_VERSION=0x260b0500 -DGW_AUTO_UPDATE_R21_FW_VERSION=0x26420700 -DGW_MIN_AVR_FW_VERSION=0x26400500 -DGW_MIN_R21_FW_VERSION=0x26720700 -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../../lib -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtSerialPort -I/usr/include/arm-linux-gnueabihf/qt5/QtWebSockets -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -Irelease -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -o release/alarm_system.o alarm_system.cpp In file included from /usr/include/deconz.h:24, from de_web_plugin_private.h:25, from air_quality.cpp:2: air_quality.cpp: In member function ‘void DeRestPluginPrivate::handleAirQualityClusterIndication(const deCONZ::ApsDataIndication&, deCONZ::ZclFrame&)’: air_quality.cpp:17:97: error: ‘FMT_MAC_CAST’ was not declared in this scope 17 | DBG_Printf(DBG_INFO, "No air quality sensor found for " FMT_MAC ", endpoint: 0x%02X\n", FMT_MAC_CAST(ind.srcAddress().ext()), ind.srcEndpoint()); | ^~~~~~~~~~~~ make[1]: *** [Makefile.Release:913: release/air_quality.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/home/pi/deconz-rest-plugin' make: *** [Makefile:42: release] Error 2

Smanar commented 10 months ago

Ha yes, another bad news, the compilation procedure have changed on recent version.

You have the procedure here https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md

sudo apt-get update && sudo apt-get install --no-install-recommends -y qt5-default lsb-release ca-certificates build-essential pkg-config git libqt5serialport5-dev libqt5websockets5-dev qtdeclarative5-dev sqlite3 libsqlite3-dev libgpiod-dev libssl-dev curl cmake ninja-build
git clone --branch keypad_rfid https://github.com/dresden-elektronik/deconz-rest-plugin.git
cd deconz-rest-plugin
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -B build
cmake --build build
cmake --install build --prefix tmp
sudo cp tmp/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/plugins

It don't impact your zigbee database, but can use a lot the CPU (at least the first time, compilation will be faster after). To rollback fastly you can make a backup of the file /usr/share/deCONZ/plugins/libde_rest_plugin.so in another folder

Gw3n4 commented 10 months ago

It is working now. Thank you ! I could re add the 3 RFID tags my family uses :)

My best guess for why it was not working previously is because I still had the libde_rest_plugin.so file generated by the last time i compiled successfully and when I copied it to /usr/share/deCONZ/plugins, the deconz daemon could not start.

Idaho947 commented 10 months ago

Ah maybe a stable version soon 😋

github-actions[bot] commented 10 months 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 9 months 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.

gforums commented 9 months ago

Can I ask you some questions, especially to @Gw3n4?

I am trying to integrate the frient keypad into my openhab setup to be able to open my doors using the keypad.

I was finally sucessful in adding the keypad and creating the master code. Looking the at deconz webhooks arming/disarming now works well.

I also compiled the branch from @Smanar (the post from December 17th).

Now I have some remaining questions:

1.) How exactly does the teachment of RFID codes work? I tried PUT 192.168.xxx.xxx:8081/api/xxxxxxxxx/alarmsystems/1/learncode/2 to learn a code - without any body, but I don't get any response. Do I just need to hold the RFID card on the keypad or do I need to press specific keys before/after holding the RFID tag on the keypad?

Is there any response I should get when doing so and/or does the keypad confirm learning with a beep or so?

2.) I'd like to use maybe either the home- or the disarm key from the pad to open our main door. Can I somehow read via the API / webbhooks, that one of the keys were pressed plus the code was right? In my usecase, I don't want to use the pad to change the mode to arm/disarm, but would like deconz to recognize, what mode was selected (if the mode, e.g. "disarmed" already was active).

Or is there a way to automatically "arm" after a second or so? then I could use the disarm function always to open my doors.

3.) any chance to get view what RFID tag / pin code was used? That might be useful to trigger differen access e.g. to my neighbours (main door only..)

A lot of questions, but thanks a lot for your help!

If I suceed with those steps, I'll further investigate how Openhab can read/recognize Rest API / weebhook changes.

Thank you! Best, Christian

Smanar commented 9 months ago

1) If you have the GUI, you can take a look on logs with the flag "ACE". Else you have an anwser when you make the request, just an "success", but nothing after user the RFID. From the code I think the kypad react (return IAS_ACE_ARM_NOTF_NOT_READY_TO_ARM; )

2) the device is seen only the complete code, and for security reason this one is not visible, but you can see special key like the SOS. Else using the API you can see the device state, no ? (But I don't remember if you need to see it in the device json or the alarm system json). For automatism, keypad are lazy devices, they are sleeping. So they can send an "disarm" request, but you can't send it to the device, it's for that the keypad use is mixed with the alarm system. One can't work without the second one. The alarm state is managed by the alarm system, the keypad is just an interface.

3) Only in logs

Sorry the support is realy basic, but as it will be never merged ....

gforums commented 9 months ago

Thanks @Smanar !

Still struggling with getting RFID to work. No confirmation from the device, no success message after the PUT command, nothing in the logs. I hoped and still hope that one the users successfully using it with RFID could support me. Will give it a further try this weekend and report back. Any additional help is much appreciated :)

Thanks. Christian

Gw3n4 commented 9 months ago

Hello Christian,

I'll try my best to provide you with some answers.

1.) I think I remember just holding the RFID card on the keypad does not send anything --> you need to press the arm or disarm key after presenting the RFID card

2.) when you enter a code or scan an RFID card, then you can press one of the 4 keys that will then trigger in deconz alarmsystem the "target arm mode" ("disarmed", "armed_stay", "armed_night", "armed_away").

everything is described here : https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/#parameters_2

if the RFID card is not registered or the code wrong, nothing is sent from the keypad to deconz.

I don't think there is a way to automatically change back the arm mode to armed after disarming it, except by running a specific scenario (I can do that with jeedom but don't know for openhab). For example:

3.) RFID tag or code is not visible in deconz

Hope it helps you.

gforums commented 9 months ago

Thanks again, but I think I'll give this one up.

Maybe one last question regarding the DDF. Could that cause RFID not working? I am using the official one from within deconz: (see below)

I tried again to get somehow RFID learned, I stored the RFID code manually, I checked the logs. Nothing that indicates that RFID tag is read. If with or without RFID tag, the DEBUG view from deconz shows the same messages, websocket shows "invalid code" with or without tag when trying to arm/disarm.

Everything else seem to work. I am able to arm/disam by PIN, I could learn more than just the code0, so a manual code 2 can be stored and used. I can change the arm/disarm delays...everything.

I'll give it a last chance and see if someone from you has that idea, that fixes it. But otherwise I'll try to send the unit back. Who knows, maybe rfid is broken at the hardware level?!

{ "schema":"devcap1.schema.json", "manufacturername": ["Develco Products A/S", "frient A/S"], "product":"KEPZB-110 Keypad", "vendor": "Develco Products", "modelid": ["KEPZB-110", "KEPZB-110"], "sleeper":false, "status":"Bronze", "subdevices":[ { "type":"$TYPE_ANCILLARY_CONTROL", "restapi":"/sensors", "uuid":[ "$address.ext", "0x2c", "0x0501" ], "fingerprint":{ "profile":"0x0104", "device":"0x0401", "endpoint":"0x2C", "in":[ "0x0000", "0x0001", "0x0500" ], "out":[ "0x0501" ] }, "items":[ { "name":"attr/id" }, { "name":"attr/lastannounced" }, { "name":"attr/lastseen" }, { "name":"attr/manufacturername" }, { "name":"attr/modelid" }, { "name":"attr/name" }, { "name":"attr/swversion" }, { "name":"attr/type" }, { "name":"attr/uniqueid" }, { "name":"config/battery" }, { "name":"config/enrolled", "public":false }, { "name":"config/on" }, { "name":"config/pending" }, { "name":"config/reachable" }, { "name":"state/action", "public":true }, { "name":"state/lastupdated" }, { "name":"state/lowbattery" }, { "name": "state/seconds_remaining" }, { "name":"state/panel", "default":"exit_delay" }, { "name":"state/tampered" } ] }, { "type":"$TYPE_PRESENCE_SENSOR", "restapi":"/sensors", "uuid":[ "$address.ext", "0x01", "0x0406" ], "items":[ { "name":"attr/id" }, { "name":"attr/lastannounced" }, { "name":"attr/lastseen" }, { "name":"attr/manufacturername" }, { "name":"attr/modelid" }, { "name":"attr/name" }, { "name":"attr/swversion" }, { "name":"attr/type" }, { "name":"attr/uniqueid" }, { "name":"config/duration" }, { "name":"config/on" }, { "name":"config/reachable" }, { "name":"state/lastupdated" }, { "name":"state/presence" } ] } ] }

Smanar commented 9 months ago

As log you need to have (with the compiled version)

DBG_Printf(DBG_INFO, "test %s\n",sec.uniqueId);

When the system check code

If you are in learning mode, but have take too much time

DBG_Printf(DBG_IAS, "[IAS ACE] Timer exceed to set new code\n");

else

DBG_Printf(DBG_IAS, "[IAS ACE] code added\n"); DBG_Printf(DBG_IAS, "[IAS ACE] adding code failed\n");

And when you set the learn mode

rsp.list.append(errInvalidValue(id, "Bad index used\n","x"));
DBG_Printf(DBG_INFO, "Enable learn mode for code\n");

RFID are working like code, the RFID just simulate a code (and just the code, so you still need to press "arm" after for exemple), it's the same thing on zigbee side.

gforums commented 9 months ago

Thanks @Smanar and sorry for not answering earlier.

I returned the keypad for now within the timeframe from purchase. I wrote to the manufacturer and was told, that only some RFID tags seems to work ("mifare"). Possible, that my RFID fobs just where wrong.

I might order the keypad again with keyfobs that should 100% be compatible. But as I can't read out the code entered/scanned, it might be not the right hardware for my usecase.

I am looking for a device that's able to differentiate the codes/fobs to control different locks in regard to which fob or key has been scanned/entered.

That said, I'll currenlty pause to work with the keypad but should it revert working with it, I'll let you know.

thanks! Christian