Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Konke Kit Pro Multi Function Button #3339

Closed
Doreinie opened this issue Oct 1, 2020 · 32 comments
Closed

Konke Kit Pro Multi Function Button #3339

Doreinie opened this issue Oct 1, 2020 · 32 comments

Comments

@Doreinie
Copy link

Doreinie commented Oct 1, 2020

Konke Kit Pro Multi Function Button

  • Product name: Kit Pro Multi Function Button IC 23777-KPKEY
  • Manufacturer: Konke.
  • Model identifier: 3AFE280100510001
  • Device type : - Switch

Screenshots

image
image
image
image
image
image

I hope this request is now accepbtable. Not that easy for a newbie to get this done. but Yeah! got so far and hope to have the buttons added some time soon.
Thanks

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 1, 2020

@SwoopX Can you check if this is correct?

@Doreinie
Copy link
Author

@Mimiix what is the netx step? Are you taking this item on as a candidate into deconz / Phoscon?

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 11, 2020

Info should be complete from what I can tell. I can't take care of that since I got tons of local PRs waiting with significant dependencies.

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 12, 2020

@Doreinie We need people like Swoop to integrate it. Or you have to do it yourself. They do this in their spare time so i really can't obligate them to do it.

@Doreinie
Copy link
Author

@Mimiix is there any sample on what is needed to do to integrate the Konke item by myself. Then I can try it

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 12, 2020

@SwoopX Is best to explain that.

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 13, 2020

What makes you think that?

Erik made a nice short overview on this #2061 (comment)
However, point 2 and 3 are not necessary and more and got simplified by the entries in button_maps.json.

@stale
Copy link

stale bot commented Nov 7, 2020

As there hasn't 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.

@stale stale bot added the stale label Nov 7, 2020
@stale
Copy link

stale bot commented Nov 24, 2020

As there hasn't 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 isn't solved, request to get this opened again.

@stale stale bot closed this as completed Nov 24, 2020
@itairaz1
Copy link

itairaz1 commented Jan 5, 2021

+1
Is there any thing new about that?
@SwoopX / @Mimiix can you please re-open this?
If need any assistant, I can try help

@opechunka
Copy link

Any updates? It seems like it's not supported yet by the latest deconz.

@rfilmyer
Copy link

This button is supported by Zigbee2MQTT, which may be useful to deconz as a possible reference implementation for the protocol. One complication to note is that Konke devices only operate on channels 15, 20, and 25.

@Doreinie
Copy link
Author

Doreinie commented Apr 22, 2023

Hi guys, did not follow up my issue here as I was busy with other projects.
I still have 2 of these switches and would like to revisit the topic to get them work with deconz.
Maybe someone can help me or guide me how to do this?
thanks!

@Mimiix
Copy link
Collaborator

Mimiix commented Apr 22, 2023

Hi guys, did not follow up my issue here as I was busy with other projects. I still have 2 of these switches and would like to revisit the topic to get them work with deconz. Maybe someone can help me or guide me how to do this? thanks!

It's been 3 years.

@Smanar can you help out ?

@Doreinie
Copy link
Author

yes
@Mimiix, it has been a while. Those days back, I was not able to figure out how to do this by myself, finally ran out of time.
Maybe, now it is a bit easier? I´m a bit more patient with myself in learning how to get the switches integrated.
With some help and guidance from @Smanar ?

@Smanar
Copy link
Collaborator

Smanar commented Apr 25, 2023

Can try this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": "Konke",
  "modelid": "3AFE280100510001",
  "product": "Konke Kit Pro Multi Function Button",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0006"
      ],
      "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",
          "refresh.interval": 86400,
          "awake": true,
          "parse": {
            "at": "0x0020",
            "cl": "0x0001",
            "ep": 1,
            "eval": "const vmin = 20; const vmax = 30; var 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;",
            "fn": "zcl"
          }
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0020",
          "dt": "0x20",
          "min": 3600,
          "max": 3600
        }
      ]
    }
  ]
}

Then include the device, go in deconz logs (help/Debug view) enable flag "info" + "info_l2', and press button, you will have error message about missing button map, I just need them with the pressed button.

@Mimiix
Copy link
Collaborator

Mimiix commented Apr 26, 2023

Can you remove this logs and please use pastebin for these large logs?

@Doreinie
Copy link
Author

Added the DDF:
Debug.txt in
https://pastebin.com/QPHVpwL4

@Smanar
Copy link
Collaborator

Smanar commented Apr 27, 2023

18:44:12:172 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001080, zclSeq: 102
18:44:48:553 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001082, zclSeq: 106
18:45:05:767 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001081, zclSeq: 107

Now the hard part, will be not possible if you have HA.

Need to add in the button_maps.json file.

        "konkeMap": {
            "vendor": "Konke",
            "modelids": "3AFE280100510001",
            "map": [
                [1, "0x01", "ONOFF", "ATTRIBUTE_REPORT", "0x80", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "Normal press 1"],
                [1, "0x01", "ONOFF", "ATTRIBUTE_REPORT", "0x81", "S_BUTTON_2", "S_BUTTON_ACTION_SHORT_RELEASED", "Normal press 2"],
                [1, "0x01", "ONOFF", "ATTRIBUTE_REPORT", "0x82", "S_BUTTON_3", "S_BUTTON_ACTION_SHORT_RELEASED", "Normal press 3"]
            ]
        },

But I have a doubt on the payload, I think I need the full one and not just 0x08

Can you try this DDF, your device is simple, I think it's possible without buttonmap

{
  "schema": "devcap1.schema.json",
  "manufacturername": "Konke",
  "modelid": "3AFE280100510001",
  "product": "Konke Kit Pro Multi Function Button",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0006"
      ],
      "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",
          "refresh.interval": 86400,
          "awake": true,
          "parse": {
            "at": "0x0020",
            "cl": "0x0001",
            "ep": 1,
            "eval": "const vmin = 20; const vmax = 30; var 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;",
            "fn": "zcl"
          }
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent",
          "awake": true,
          "parse": {
            "cl": "0x0006",
            "cmd": "0x0A",
            "eval": "Item.val=(ZclFrame.at(4)-121)*1000+2"
          }
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0020",
          "dt": "0x20",
          "min": 3600,
          "max": 3600
        }
      ]
    }
  ]
}

payload: 00001081
"eval": "Item.val=(ZclFrame.at(4)-121)*1000+2"

I m trying to convert the 81 to "1002" value

@Doreinie
Copy link
Author

Thank you for the guidance I hope I did this all correctly.
a) replaced the DDF with recent provided
b) added info to the button_maps.json file
image
c) I was not sure if I have to add the payload info anywhere,
I do not see any status change e.g. in iobroker when pression a button.
image
d) what do you mean with HA which would be bad?
Do you need another log?
thanks

@Smanar
Copy link
Collaborator

Smanar commented May 1, 2023

what do you mean with HA which would be bad?

It's realy hard to edit the buttonmap file on HA because of the docker use.
How have you done that ? You have direclty edited the file on the docker ?
And with the last DDF you don't need to edit the buttonamp file ^^

Can you just enable log "info" "info_l2" "DDF" and press device button with the new DDF ?

@Doreinie
Copy link
Author

Doreinie commented May 1, 2023

I´m not using docker. I have installed this directly on rasp pi 4b.
now I think that with "HA" you mean "home assistant". I´m not using that. I use ioBroker.
So I edit the file using "nano" or file editor.
I did edit the DDF and the button_map file. This is how I understood the instructions.
Is that wrong, only to change the DDF an not the button map file?
log pastebin here: https://pastebin.com/w7fLRQX6
thank you
Interesting is that the battery of the switches moved from green to red over night.

image

@Smanar
Copy link
Collaborator

Smanar commented May 1, 2023

Ha nice ^^.
So yes it's easy on your OS, but this device use only 3 events and all on same command so easier using only DDF too

15:09:08:041 APS-DATA.indication from child 0x01EC
15:09:08:051 failed to evaluate expression for 14:b4:57:ff:fe:09:7c:cf-01-0006/state/buttonevent: Item.val=(ZclFrame.at(4)-121)*1000+2, err: RangeError: index out of range
15:09:08:056 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001080, zclSeq: 13

So the buttonamp haven't worked, but I think we can avoid them
And the javascript expression have failed, I think it's because the first byte is 0 and not 1
payload: 00001080
0 > 00
1 > 00
2 > 10
3 > 80

So the code need to be

"eval": "Item.val=(ZclFrame.at(3)-121)*1000+2"

@Doreinie
Copy link
Author

Doreinie commented May 1, 2023

thanks, now I´m getting a button response.
in iobroker I see
single click response= 7002
double click response = 8002

this took a while until this was possible:
long click upon release = 9002, have to hold the switch min 5 seconds

Is there a possibility to capture as well the "buttonpressed"? the response in iobroker only comes upon release. with the same number as response 7002, 8002, 9002

little log: https://pastebin.com/tJNUbaWf

Will it actually be possible to use the switch in Phoscon? e.g. link in phoscon web interface to connect in switch editor? Currently this is not possible!

@Smanar
Copy link
Collaborator

Smanar commented May 2, 2023

I don't have impact on phoscon, so you need to ask phoscon devs.

Is there a possibility to capture as well the "buttonpressed"?

From that I m reading this device have only 3 events.
And I m using bad one ^^ https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Supported-Devices#events-legend

Need to have

single click response= 1002
double click response = 1004
long clic response = 1003

Can you try this eval code ?
"eval": "const t={'128':2,'129':4,'130':3};if(ZclFrame.at(3) in t){Item.val=1000+t[ZclFrame.at(3)]}"

@Doreinie
Copy link
Author

Doreinie commented May 2, 2023

This is working. Great!
single click response= 1002
double click response = 1004
long click response = 1003
I have tried to see if there is any other output for mutiple button presses, but there seems nothing. It goes that far that if I do 3 or more clicks the entire input is going to be ignored.

Do you know who to connect with to show in the web app the product info, switch status?

image

thank you!

@Smanar
Copy link
Collaborator

Smanar commented May 2, 2023

I have tried to see if there is any other output for mutiple button presses, but there seems nothing. It goes that far that if I do 3 or more clicks the entire input is going to be ignored.

Yeah the only zigbee request send by yur device are

18:44:12:172 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001080, zclSeq: 102
18:44:48:553 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001082, zclSeq: 106
18:45:05:767 [INFO] - No button map for: 3AFE280100510001, unicast to: 0x0000, endpoint: 0x01, cluster: ONOFF (0x0006), command: ATTRIBUTE_REPORT (0x0A), payload: 00001081, zclSeq: 1071

So only 3 actions.

Do you know who to connect with to show in the web app the product info, switch status?

I m not sure to understand, but you can see btton event in phoscon using help/API Information/event/sensor/ The device id.

But If I m right you can use them with ioBroker ? (better than Phoscon)

@Doreinie
Copy link
Author

Doreinie commented May 2, 2023

Yes, it seems we have max 3 actions and we got this working. Thank you!

To have it nice and neat it would be nice to have this more complete implemented in the phoscon web app and mobile app.
I thought that this is done through the DDF but seems not.

Functionality in iobroker is available and all other stuff in phoscon would just be a plus.

@Smanar
Copy link
Collaborator

Smanar commented May 3, 2023

Do you want to make the PR or want I make it to include this device officialy ?
And yes, I understand, but phoscon is a closed application and IDK what happen for them.

@Doreinie
Copy link
Author

Doreinie commented May 3, 2023

what is a PR? Yes, it would be great if the device would be included officially in the long run.

@Smanar
Copy link
Collaborator

Smanar commented May 4, 2023

You have it here #6946

@Doreinie
Copy link
Author

Doreinie commented May 7, 2023

Thank you for taking this forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants