dresden-elektronik / deconz-rest-plugin

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

Support for ZGP proxy #436

Closed posixx closed 3 years ago

posixx commented 6 years ago

When does deCONZ support ZGP proxy messages so our Hue TAP devices are working more reliably? Could someone pick up the development / implementation for this?

stale[bot] commented 5 years ago

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.

stale[bot] commented 5 years ago

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.

posixx commented 5 years ago

This is still an active problem.. If a tap is far away from the controller it doesn't work, even if it is surrounded with lights. It should mesh through the network.

posixx commented 5 years ago

Is this still unresolved? Having trouble with a TRADFRI remote i want to use a TAP in my garden but before i'm going to buy one i want to make sure proxying is supported..

manup commented 5 years ago

The proxy support is still in active development, there is unfortunately no ETA but we made some progress in the past weeks in figuring out the needed crypto details.

posixx commented 5 years ago

@manup great news, my wife is keeping me reminded of this issue:-) Hope to hear some progress soon!

rendgeor commented 5 years ago

@manup 1) Is there any basic support for ZGP coming withing the next two months? 2) or is there any other ZGP proxy available?

UltraSub commented 5 years ago

Also very interested in this. Have a switch surrounded by lights, but it can’t reach the controller. Since it doesn’t mesh/route I’m stuck and can’t use the switch. Ordered a Conbee II since that should have a bit better range and will try to extend the location of the Conbee stick further away from the server. But there’s only so much I can do there. Really hope you guys can get this fixed! 👍

posixx commented 4 years ago

Yes keep this thread alive so they don't forget:-) Having to turn on/off my garden shed lights every weekend with the ipad instead of a tap becomes more and more anoying..

rendgeor commented 4 years ago

@manup Dear Manuel, is it possible to get some kind of feedback that the users know when more or less a feature will be supported. Short feedback within the threads would be great!!!

Not beeing able to use the switched is annoying...

posixx commented 4 years ago

@manup any updates on this?

remcotjeerdsma commented 4 years ago

Hue tap devices are very usable to 'tweak' and integrate in normal-looking switches that fit in busch-jeager and gira switches. Thus, we have them throughout the entire house. I would love to use them with Deconz. Please prioritize ZGP-Proxy-support!

Koenkk commented 4 years ago

The proxy support is still in active development, there is unfortunately no ETA but we made some progress in the past weeks in figuring out the needed crypto details.

@manup would you mind sharing these crypto details? I'm working on the green power implementation in zigbee-herdsman and managed to successfully setup a ZGP proxy on a Hue bulb for a Hue tap switch. However currently uses the key which I sniffed with my Hue hub, this key is probably specific for my Hue tap switch (https://github.com/Koenkk/zigbee-herdsman/blob/feature/greenpower/src/controller/greenPower.ts#L19). Once it's implemented in herdsman I think it can be easily ported to Deconz.

manup commented 4 years ago

@Koenkk unfortunately the decryption part hasn't progressed much. I looked into the ZGP related sources of the stack but haven't figured out yet how exactly it's done. So current situation is what can be found in the deCONZ REST-API plugin main ZGP handler for incoming commands:

https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/de_web_plugin.cpp#L1124

Do you have access to the ZGP specification? The security aspects are described there, I can send you the PDF if that would be any help.

Koenkk commented 4 years ago

@manup I don't have access to it, however some contact of me mentioned that Hue uses a proprietary key (not sure if that's true though).

Koenkk commented 4 years ago

@manup could you share the pdf with me? (koenkanters94@gmail.com)

Koenkk commented 4 years ago

@manup with some help I've managed to figure out to crypto details. Javascript implementation can be found here: https://github.com/Koenkk/zigbee-herdsman/blob/feature/greenpower/src/controller/greenPower.ts#L20 . I also have a C# implementation, in case you are interested feel free to contact me.

posixx commented 4 years ago

Nice work @Koenkk! Hopefully this will spped up ZGP Proxy implementation..

stale[bot] commented 4 years ago

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.

ebaauw commented 4 years ago

Bump

SwoopX commented 4 years ago

Smanar has already finished the C++ implementation. Should be included at the appropriate place

Smanar commented 4 years ago

But it works ouside deconz ^^. It need some convertion, and I haven't this kind of device to make test.

ebaauw commented 4 years ago

@Smanar, I have a couple of Hue taps and am eager to try this. Happy to take over and integrate your code into the REST API plugin.

Smanar commented 4 years ago

Nice :) > https://github.com/Smanar/Zigbee_firmware/blob/master/Encryption.cpp

posixx commented 4 years ago

@ebaauw any progress on implementing this? I'm also eager to try!

ebaauw commented 4 years ago

Not yet. Crazy times at work. Hopefully find some time this weekend, but no promises.

stale[bot] commented 4 years ago

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.

ebaauw commented 4 years ago

Bump

jaxer commented 4 years ago

Let me know if i can help testing as well. Looking forward for this one

stale[bot] commented 4 years ago

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.

macpo commented 3 years ago

If another tester is needed, I will gladly help.

manup commented 3 years ago

Spend the whole day on figuring out the ZGP specification, the code from @Smanar works for Zigbee test vectors but the generated value doesn't seem to be the desired GPDKey. I compared with Philips Hue bridge and their generated GPDkey looks different for the same input parameters.

Perhaps what we need is → A.1.5.3.3.2 Individual GPD key derivation

The HMAC is described in: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.198-1.pdf

Smanar commented 3 years ago

I have compared with zigbee2mqtt result (on windows hardare)

@manup do you have an exemple with correct values ? To change my code ?

manup commented 3 years ago

F+ck, correction, I called the function with the wrong sourceId.... it seems to work now. Will do some tests.

manup commented 3 years ago

All ZGP routers seem to forward the ZGP command, I wonder how well it scales and if it is troublesome when many ZGP end-devices get paired. Next step is to unwrap the ZGP notifications into our ZGP handlers.

image

lh14576 commented 3 years ago

does ZGP also work for adding new switches? I am trying to add a FOH Senic switch and it's only working when the switch is close to my raspbee2. I am on FW 26660700 and 2.05.86 Thanks

edit: I was able to pair the switch in the meantime (after countless tries). However the routing doesn't seem to work as the switch is only reacting sporadically

Mimiix commented 3 years ago

Created a internal ticket :)

manup commented 3 years ago

The code is fixed now in deCONZ core and available in the upcoming release. The problem is that the Green Power endpoint wasn't configured automatically.

As workaround prior to the release the endpoints can be configured manually via deCONZ > Edit > Network Settings > Endpoints And there the following configuration needs to be set:

image

Then press save, the endpoints for the coordinator should look like:

image

posixx commented 3 years ago

Ok i installed 2.05.88 on my HASS system, added a new Hue Tap, and moved to my gardenhouse, but it doesn't work; my lights in the gardenhouse are not triggered when using the Tap. As soon as i move back to my house the lights are triggered when using the Tap..

manup commented 3 years ago

What kind of routers are near the garden house? Can you please provide some logs during switch adding and when triggering the switch outside the house.

posixx commented 3 years ago

In the garden house i have 4 LCT001 lights (fw 5.23.1.13452) and a LCT015 (fw 1.19.0_r19755) about 10m from the gardenhouse. I'm sorry but i don't have the skills nor the tools to get you any logs..

manup commented 3 years ago

Ok these are all Hue lights and should support ZGP.

I think when pairing the switch it needs to be near the real destination so that lights create an entry for it in their local device table.

jaxer commented 3 years ago

i can second above. also have a bigger, flat, single floor house full of hue lights and i cannot control nor pair friends of hue switch if i am in the corner furthest from conbee II. running latest firmware.

idk if its wrong, but some lights have more than one Green Power thing: image

Although those are same lights (hue gu10 zb/ble color bulbs)

I can try to debug things if you explain what exactly needs to be done. I.e. i can paste contents of new debug panel? although i have around 84 nodes, so its pretty busy

manup commented 3 years ago

Note it's important to pair the switch near the real destination. The routing won't be automatically added by updating deCONZ.

Lights which have two ZGP clusters (blue = server and grey = client) is valid. The coordinator should also have ZGP endpoint i its list.

jaxer commented 3 years ago

I understood, and tried few times to pair it there. With no success.

Sorry, those two lights are actually different: the one on right is e26 hue bulb and the one on left is newer gu10 hue zigbee/bluetooth bulb. Does it mean that only those with blue Green Power endpoint can receive communication from friends of hue switches? I thought that gu10 should also be able to forward those packets?

here is coordinator, seems fine to me: image

manup commented 3 years ago

Hmm, I need to do some testing to see if there is a problem, have only testet it in near distance where it worked that devices did reroute the ZGP frame.

Does it mean that only those with blue Green Power endpoint can receive communication from friends of hue switches? I thought that gu10 should also be able to forward those packets?

Good question, I think they both should support it but I'm not 100% sure.

My IKEA and Philips (E27) lights all have both ZGP server and client clusters.

jaxer commented 3 years ago

tried it again: was able to pair it somewhere in the middle between the conbee and the furthest room. but it did not improve the performance: in target room i am able to control lights only occasionally. i.e. 50% of clicks do what i expect and other 50% do nothing.

jaxer commented 3 years ago

on the other hand, i have this same setup from a year or so (i have stable versions of deconz running on HASS). and i think few months ago performance was way worse. now i can with much smaller problems use frineds of hue switches in the middle of the house. i.e. maybe 80-90% of clicks work there. and it used to be like 50% (if not less) clicks only.

so i mean, maybe what you did actually works but range is still limited, i.e. number of hops is only 1 atm? i.e. if switch needs to pass green power packet through 2 proxies instead of one then it will not work?

lh14576 commented 3 years ago

.87 final ZGP seems to work fine for me now. All my Hue Lights have blue and grey ZGP.

posixx commented 3 years ago

All my Hue Lights have blue and grey ZGP as well, but my Tap isn't working on distance..