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

Could not QueryNodeDescription and QueryNodeEndpoints #14

Closed
MrEhbr opened this issue Sep 17, 2020 · 7 comments
Closed

Could not QueryNodeDescription and QueryNodeEndpoints #14

MrEhbr opened this issue Sep 17, 2020 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@MrEhbr
Copy link

MrEhbr commented Sep 17, 2020

Hello when I try to run example QueryNodeDescription and QueryNodeEndpoints always failed by timeout. I try to increase it but it doesn't help. Is example is working or I do something wrong?

@pwood
Copy link
Member

pwood commented Sep 17, 2020

Hello! Thanks for taking a look at this project - fair warning it's still not stable. I've had to take a short break from this - but I'll be back soon. But for now...

A couple of things:

  • You've managed to successfully join a device to your network? Did you get the node object from zigbee.NodeJoinEvent?
  • You are constantly reading events with z.ReadEvent()?
  • What is device you're trying to query? Does it act as a router or an end-device? I still have problems with the behaviour of some simplier end devices, like temperature sensors.

If you want to attach your test code, I'm happy to look over it.

@pwood pwood added the question Further information is requested label Sep 17, 2020
@pwood pwood self-assigned this Sep 17, 2020
@MrEhbr
Copy link
Author

MrEhbr commented Sep 17, 2020

Code was taken from example in README.

  1. Devices joined and Node object were looking normal
  2. z.ReadEvent() was always reading and there were regular NodeUpdateEvent events
  3. Devices were Xiaomi button and motion sensor
    I tried to look at frames that was send back after QueryNodeDescription but I don't found needed frames. But I don't sure that I was looking in right place.

If you don't have much time to deeply look at my problem it would be great if you show me from what place I can go to detect problem

@pwood
Copy link
Member

pwood commented Sep 18, 2020

Assuming the zstack is sending the ZdoNodeDescReq to the adapter (which given you've initialised, seen a join message, etc), I suspect your problem is actually the end devices. Sent at:

resp, err := z.nodeRequest(ctx, &request, &ZdoNodeDescReqReply{}, &ZdoNodeDescRsp{}, func(i interface{}) bool {

I have a pretty large array of the Xiaomi stuff (buttons, temp sensors, motion sensors), and they can all be a bit touchy about joining to networks. They quite aggressively sleep, so as soon as they've joined they sleep.

The "work around"/only way to make them queryable, is to do the pairing process, and as soon as they join, tap the reset button so the LED on the front of them flashes. This wakes them up, which allows the node that's routing for them to send the query packets.

See this page, basic pairing instructions, step 4:
https://community.hubitat.com/t/xiaomi-aqara-zigbee-device-drivers-possibly-may-no-longer-be-maintained/631

I swear that zigbee2mqtt used to have this in more detail on their pages, but it seems to have disappeared, so I don't know if there is some work around.

An example of shimmeringbee/zda - which uses shimmeringbee/zstack and shimmeringbee/zcl - but abstracts away zigbee... but it doesn't actually support temp/humidity yet.

https://imgur.com/a/kqycs0N <- Note the one long press to start pairing, and then continued clicking after the blue light has come on (couldn't actually see it because of the camera so guessed).
https://gist.github.com/pwood/70726f8a0f3bd5f61efc5dd7757c40fc <- output of zda enumeration

@MrEhbr
Copy link
Author

MrEhbr commented Sep 18, 2020

Thx for help, I managed to enumerate endpoints. For now I have failed to read product information: ZCL communicator waiting for reply, context expired error, and I also don't resave any messages from devices is it ok?
Code example: https://gist.github.com/MrEhbr/c77e606eb732c150a2ce48bcf95061a1

@pwood
Copy link
Member

pwood commented Sep 18, 2020

Ahh, moved to zda... you're enumerating every device every sixty seconds, so you would need keep pressing the reset button.

zda will automatically start an enumeration of a device when a new one joins, and enumerate the capabilities... a EnumerateDeviceSuccess would then be sent.

The idea of zda and da is to hide zigbee from a piece of controller software - hence standardised capabilities... as the da layer you wont be able to send custom ZCL messages, that's hidden.

da/zda is still in a state of flux, I need to drop the Device struct and move it to interfaces for behaviour. The API will be changing.

This is my own test driver for zda: https://gist.github.com/pwood/cd95044873a1f35ca0a76d9f185a6758 - looks somewhat similar.

The Xaiomi sensors just send ZCL messages to the controller (they dont even advertise the clusters on their endpoints) - which at the moment zda will be ignoring because I haven't got to supporting temp/humidity/pressure. The only capability I've completed is basic On/Off which I was using to prove all parts of the stack.

You've basically reached the end of what I've implemented so far. As I say - I've been taking a break from zigbee, mostly due to DIY work on the house that the wife needed doing ;) - but I'm going to come back to it soon. Probably this weekend.

@MrEhbr
Copy link
Author

MrEhbr commented Sep 18, 2020

One more time thx for your help. Now I'll know what to do next, first I'll try to add support for the devices I have

@pwood
Copy link
Member

pwood commented Sep 19, 2020

Good luck @MrEhbr, any follow up please feel free to raise a query in the zda project. I have just completed a semi large refactor in da and zda to do with da.Device now being an interface, rather than a struct. Also I see you are on the Discord, so feel free to grab me there too. Just @ me.

@pwood pwood closed this as completed Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants