-
Notifications
You must be signed in to change notification settings - Fork 41
use DataRequest instead of DataRequestExt if possible #174
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
Conversation
The two commands actually lead to the exact same function ( case MT_AF_DATA_REQUEST:
case MT_AF_DATA_REQUEST_EXT:
MT_AfDataRequest(pBuf);
break; The sequential behavior you mention seems to be triggered when the length of the packet exceeds 230 bytes for Do you ever see packets larger than 230 bytes at runtime? I believe even with OTA running, the maximum packet length is never greater than 80 bytes. It may be better to guard against this codepath with an explicit |
True, they do 😮💨. Inside that function they do differetiate between the two requests, to be fair, but it seems to not make a noticable difference anyways. But while looking at the code I found something interesting. It seems like DataRequest can be sent as both, synchronous and asynchronous request which could greatly reduces time spent in the sync lock in api.py Do you have any thoughts about this? |
Interesting. My understanding of the request flow is that you queue up a request, Z-Stack responds with the |
Not sure if there is a callback later on. This is the end of the MT_AfDataRequest function:
I testet this with changing api.py (added to the beginning of async def request(...) ):
This right now ignores the response but I guess it would not be difficult to add a Callback to the firmware. I think its worth checking this out, toggling a bunch of lights gets really fast especially when using scenes that change not only the state but also color. I think it might be possible to get out even more when turn_on creates a task instead of running asynchronously (maybe HA waits for the first light to finish its state change before it starts with the second?) |
Hmm, not sure if this is the only relevant change atm. |
Not waiting for Setting the request concurrency to 9999 would have the same effect. If I remember correctly, Z-Stack's API reference notes that concurrency should be capped at one, hence the reason for Req/Rsp/Callback as opposed to just Req/Rsp. |
Do you know if the coordinator returns before or after transmitting the frame? Memory could be an issue at some point but that might be managed by reserving memory for n messages. Zigpy coulf load and use that number as max concurrent. |
There are two responses:
No. zigpy-znp has two concurrency limits:
Of course. Try setting |
Okay, thanks, so turning eg a light on will:
Now the controller should send the France OTA and receive an ACK from the light
Are only 1 and 2 in the sync lock? Or is 3 blocking it? |
No, 3 is not blocking it. The device can send
Just pretend |
Okay nice, I am starting to understand the bigger picture. |
According to Docs the DataRequestExt is sequential:
"And any AF_DATA_REQUEST_EXT with a huge data byte count must be completed (or timed-out) before another will be started"
This PR would use the normal data request instead of the extended data request if possible.