dresden-elektronik / deconz-rest-plugin

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

Frient intelligente KeyPad #5352

Closed Maxcrouz73 closed 7 months ago

Maxcrouz73 commented 2 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

Smanar commented 2 years ago

Hello. Yes it's fine ^^. But BTW keypad are something new in deconz, do you know how to use them ? There is a new feature in the HA plugin, but the HA OS is realy not a good OS for compilation.

And have you a linux machine with full OS to test code modification ?

Maxcrouz73 commented 2 years ago

Hello,

I allready use it with zigpee library in jeedom a Home automation software, there are 3 state info

1: code 2: alarm mode 3: Sos

To use it you should type a code then push one of the 4 modes night, home, armed alarme and disarm alarm othewise the code is not write in the code variable. Sos in this variable you should press at least 2 seconds the sos button and it write 7 in the variable. I guess i must send you the GUI when i push the buttons on the keypad?

I have a linux os bullseye yes Envoyé de mon iPhone

Le 6 oct. 2021 à 19:33, Smanar @.***> a écrit :

 Hello. Yes it's fine ^^. But BTW keypad are something new in deconz, do you know how to use them ? There is a new feature in the HA plugin, but the HA OS is realy not a good OS for compilation.

And have you a linux machine with full OS to test code modification ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Smanar commented 2 years ago

In deconz It s not exactly the same working mode, there is a stand alone mode and a more complex one https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/

I guess i must send you the GUI when i push the buttons on the keypad?

I don't think, will use standard code to start, give me 1/2 days

Maxcrouz73 commented 2 years ago

Great!

Ask me if i can help, gonna have a look on the link than you share to me.

Thanks a lot

Envoyé de mon iPhone

Le 6 oct. 2021 à 21:03, Smanar @.***> a écrit :

 In deconz It s not exactly the same working mode, there is a stand alone mode and a more complex one https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/

I guess i must send you the GUI when i push the buttons on the keypad?

I don't think, will use standard code to start, give me 1/2 days

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Smanar commented 2 years ago

Ok so first try

You have the procedure here https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing So for you, after having installed deconz :

sudo apt install deconz-dev
git clone --branch frient_keypad 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

I have set all by defaut (and not enabled battery yet). To check the working mode I think the better way is using the logs with "info" "ias" and "info_l2" Not sure you will have all informations displayed on the device Json (visible here http://phoscon.de/pwabeta in help/api information)

ZeppDK commented 2 years ago

argh... im getting this error

billede

Smanar commented 2 years ago

Ha yes I have it too, try

sudo apt install qtdeclarative5-dev

github-actions[bot] commented 2 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.

Maxcrouz73 commented 2 years ago

Ha yes I have it too, try

sudo apt install qtdeclarative5-dev

Hello don't know if you see my reply i delete it, cause the probleme is solved. So, i want to display the armed_mode and witch keys are type on keyboard but i don't know where to find the json to add cmds on jeedom. On jeedom i have:

{
    "7": {
        "config": {
            "battery": null,
            "enrolled": 1,
            "on": true,
            "pending": [],
            "reachable": true
        },
        "ep": 44,
        "etag": "eeec8fa3ca94d2694759d1cba107bb7a",
        "lastannounced": null,
        "lastseen": "2021-11-05T13:30Z",
        "manufacturername": "frient A\/S",
        "modelid": "KEPZB-110",
        "name": "AncillaryControl 7",
        "state": {
            "action": "not_ready",
            "lastupdated": "2021-11-05T13:28:41.813",
            "lowbattery": false,
            "panel": null,
            "seconds_remaining": 0,
            "tampered": false
        },
        "swversion": "2021-05-21 14:59",
        "type": "ZHAAncillaryControl",
        "uniqueid": "00:15:bc:00:43:00:0d:16-2c-0501"
    }
}

Panel state stay null anyway it should display the code true? Action state stay not ready it should display de arm mode true?

Thanks

Smanar commented 2 years ago

Hello don't know if you see my reply i delete it, cause the probleme is solved.

He nope ^^, have missed it, and I haven't make the PR, waiting for return.

Keypad was added recently with a new alarm system https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/ But if I m right keypad can stil lworking in stand alone mode.

The read-only attribute state.action contains the last action a user invoked on the keypad.

The read-only attribute state.panel represents the state machine and mirrors the alarm system state.armstate attribute. It reflects what is shown on the panel (when activated by the keypad’s proximity sensor).

From my memory, no, the code is never displayed, for security reason.

I don't think you need to create an alarm system

This is only needed than more than one alarm system is needed. The “default” alarm system with id “1” is created automatically.

But try to set a "code0" with the id = 1

github-actions[bot] commented 2 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 2 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.

tpjanssen commented 2 years ago

Not quite sure what the current status is... Is the device currently supported? If not, will it be on the short term? And also, if it is not supported, can support be added by sending additional information?

Smanar commented 2 years ago

I don't have keypad to answer. I know some users have issue with the new alarm system, some other are using DDF https://github.com/dresden-elektronik/deconz-rest-plugin/issues/5520#issuecomment-1010928122

But yes If an user with a full working keypad can answer ....

tpjanssen commented 2 years ago

I don't have keypad to answer. I know some users have issue with the new alarm system, some other are using DDF #5520 (comment)

But yes If an user with a full working keypad can answer ....

OK. Thank you for your quick reply! I will purchase one.

How you prefer to tackle this? I'm using Home Assistant with the Deconz add-on.

ZeppDK commented 2 years ago

I have one… i managed to get it into deconz, but i cant get anything usefull over in HA, so right now i just have an expensive paperweight 😂

tpjanssen commented 2 years ago

@ZeppDK can you supply @Smanar with the information he needs?

ZeppDK commented 2 years ago

I have no idea what he needs, and as said, cant make it do anything 😅

tpjanssen commented 2 years ago

I have no idea what he needs, and as said, cant make it do anything

@Smanar I hope you can help us with this?

Smanar commented 2 years ago

@Smanar I hope you can help us with this?

Can try, but for the moment, I known some users have tried, but not sure they have succed.

@ZeppDK where are you with your device ATM ? He is reconized in the API or not ?

Edit:

No need, I have my answer, I have started the code myself and it was never finished, the device is not in whitelist. As now it s not possible to add device using code need to use DDF

I will ask a working DDF for keypad.

Edit: can you try this DDF ?

{
  "schema": "devcap1.schema.json",
  "manufacturername": "frient A/S",
  "modelid": "KEPZB-110",
  "product": "KEPZB-110",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/KEPZB-110.json",
  "subdevices": [
    {
      "type": "ZHAAncillaryControl",
      "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",
          "description": "The current device battery level in 0–100 %.",
          "parse": {
            "at": "0x0020",
            "cl": "0x0001",
            "cppsrc": "power_configuration.cpp:44",
            "ep": 44,
            "eval": "const vmin = 20.0; const vmax = 30.0; let bat = Attr.val; if (bat > vmax) { bat = vmax; } else if (bat < vmin) { bat = vmin; } bat = ((bat - vmin) / (vmax - vmin)) * 100; if (bat > 100) { bat = 100; } else if (bat <= 0)  { bat = 1; } Item.val = bat;"
          }
        },
        {
          "name": "config/enrolled",
          "public": false,
          "description": "State of IAS enrollment process."
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/pending",
          "description": "Pending tasks to configure the device."
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/action",
          "public": false
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/lowbattery",
          "description": "True when the device battery runs low."
        },
        {
          "name": "state/panel",
          "public": false
        },
        {
          "name": "state/seconds_remaining",
          "public": false
        },
        {
          "name": "state/tampered",
          "description": "True when the device tampered alarm was triggered."
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 44,
      "dst.ep": 1,
      "cl": "0x0500",
      "report": [
        {
          "at": "0x0002",
          "dt": "0x19",
          "min": 300,
          "max": 3600
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 44,
      "dst.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0020",
          "dt": "0x20",
          "min": 3600,
          "max": 3600
        }
      ]
    }
  ]
}
ZeppDK commented 2 years ago

Nope, KEYZB-110 is nowhere to find in the API

Smanar commented 2 years ago

Yep, this device is not yet in the API, need to use DDF.

ZeppDK commented 2 years ago

i have addet the DFF file and restartet, now i have the following if i search in the API...

image

tpjanssen commented 2 years ago

i have addet the DFF file and restartet, now i have the following if i search in the API...

image

So your paperweight is turning into something useful! 😅

ZeppDK commented 2 years ago

its a step in the right direction... i still only get this in HA image

Smanar commented 2 years ago

Yeah, now the "unknow part", the alarm system stuff. IDK if there is something in HA to help you to do that, so sorry to use the basic method https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/

Have you an alarm system ready ? GET /api//alarmsystems GET /api/<apikey>/alarmsystems

I think yes, it s by defaut

Set a pin0 code, else nothing can work https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/#set-alarm-system-configuration

I can give you curl request If you don't have a REST client ?

Edit: There is something bad in the json you have. Some fields are missing for the ZHAAncillaryControl

        "panel": "exit_delay",
        "seconds_remaining": 55,

On the DDF editor, can you make "hot reload" on the menu ? after having the node and "edit DDF"

ZeppDK commented 2 years ago

im in the deep end of the pool here, im a HA noob, and not a programmer :-) if you send som curl i will try running it, and ofcourse add thoose lines to ZHAAncillaryControl in the json file

ZeppDK commented 2 years ago

uuhh, and i also need to have a look at https://www.home-assistant.io/integrations/manual i see

Smanar commented 2 years ago

Nope ^^, it depend more of deconz than HA.

Here you have how to use the API https://dresden-elektronik.github.io/deconz-rest-doc/getting_started/ But I can give you curl command to type.

But ATM the json is not complete, and you can't edit it, it's deconz that need to make a better one. The missing line are in the DDF, so they need to be in the json, it's for that I think something have missed.

You have the DDF stuff here https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/DDF-cheat-sheet

ZeppDK commented 2 years ago

i succeded in adding the 2 options. image

ZeppDK commented 2 years ago

and i can see that HA updated to this. image

Smanar commented 2 years ago

i succeded in adding the 2 options.

Ha nice, what you have done to have them ?

So to check alarm system, just use in a browser http://IP:PORT/api/KEY//alarmsystems

To add a pin code with curl curl -H 'Content-Type: application/json' -X PUT -d '{"code0": 1234}' http://IP/PORT/api/KEY/alarmsystems/0/config

For IP and PORT, they are the same you have used to access phosocn. For the API key, IDK if you can see it in HA else you can retreive one https://dresden-elektronik.github.io/deconz-rest-doc/getting_started/

ZeppDK commented 2 years ago

i added this to the KEPZB-110.json file

{ "name": "state/panel", "default": "exit_delay", "public": true },

ZeppDK commented 2 years ago

from the browser: billede

but this is from the curl: billede

Smanar commented 2 years ago

My bad, the ID is not 0 but 1 /alarmsystems/1/config (it s the one you have see on the browser)

ZeppDK commented 2 years ago

aahh, that makes sense [{"success":{"/alarmsystems/1/config/configured":true}}]

Smanar commented 2 years ago

Ok so next step (I m discovering the doc in same time than you ^^)

→ After pairing a keypad as sensor, it’s automatically added to the default alarm system with id “1”.

Keypads use the the alarm system PIN code (see Update alarm system configuration), which is verified each time the keypad arms or disarms the alarm system.
If a valid PIN code is entered on the keypad, the alarm system’s state changes according to the requested arm or disarm command.
Important: For REST-API clients a keypad is a read-only sensor. The alarm system automatically takes care of: controlling the keypad’s panel state, entry and exit delays, and state transitions.

So if there is not issue you can use the pin0 code "1234" and something need to change on http://IP:PORT/api/KEY/alarmsystems

But I will ask too Robban to know if there is some stuff in HA to manage alarm system.

Edit: So Robban give me link to the HA plugin code, we will be able to investigate.

But first thing to do is restarting the plugin (or resynchronise if it's possible), the "magic" happen when you include a keypad and when it was included to the alarm system. And we have not done the thing in the good order ^^. But yes you need to see something in HA for alarm system.

ZeppDK commented 2 years ago

i have restartet deconz, reloaded the HA plugin, and run deconz.device_refresh , nothings changed...

but i cant seem to find any key combination including the 1234 pin that does anything, there is no change in the http://IP:PORT/api/KEY/alarmsystems

ZeppDK commented 2 years ago

aaahh, after using this string the keypad is accepting the pin billede

ZeppDK commented 2 years ago

yatsy... it seems to work with HA now also, after reload of the plugin... now only thing im missing, is to find out how to se the ID of an rfid tag hold up to the panel, then everything works ad expected! :-)

billede

tpjanssen commented 2 years ago

Looks like serious progress has been made in the last three days!

@Smanar What is the next step now? To add the device officially? How can we add the device after this? Just add a new sensor in Phoscon?

Smanar commented 2 years ago

how to se the ID of an rfid tag hold up to the panel

I m not sure to understand (sorry have a basic english)

@Smanar What is the next step now? To add the device officially? How can we add the device after this? Just add a new sensor in Phoscon?

As all is working without editing code, will be easy, just give the DDF link to mimic. But it s strange you need to add the keypad manualy yourself ...

tpjanssen commented 2 years ago

What @ZeppDK probably means is that he doesn't know how to receive feedback when a RDIF tag is held against the terminal. The terminal has an integrated RFID reader.

Smanar commented 2 years ago

Haa .... You mean the keypad have a RFID reader ? IDK if this part it s ready in the code, can you catch logs (with info and aps) when using a RFID card/badge ?

From the doc, RFID or keypad generate same request. So will probably work same.

ZeppDK commented 2 years ago

Yes, it have an RFID reader inside :-)

What log files? i have lots of tags, so if i know where to look, i Can test

Smanar commented 2 years ago

Deconz one, using "info" and "IAS". But if I m right you have a RFID to arm and 1 RFID to disarm for exemple ? so you will have same result than when you type the code.

ZeppDK commented 2 years ago

cant seem to find til ID for the tags, but i get the following in the log when holding a tag to the keypad... billede

Smanar commented 2 years ago

Your forget the flag "ias" it s the flag used by keypad. But from the code the RFID device just ask for panel status (command 0x07) , and deconz need to send an aswer (just the panel state, so it need to make a sound, turn a LED, but don't change the keypas mode). But It's strange it's not a arm or disarm request ? You need to program the RFID ? or all have a different feature ?

BTW you have so many websocket client.

ZeppDK commented 2 years ago

RFID tags are just a "key", so they all have a unik ID, nothing else... normaly you code an alarm system to allow the tags to arm & disarm, so you dont have to have 1 tag for disarming, and another for arming

ZeppDK commented 2 years ago

with the flag "IAS" i only get this...

billede