Skip to content

Implement request cancellation#45

Merged
puddly merged 1 commit into
devfrom
puddly/request-cancellation
Jul 14, 2026
Merged

Implement request cancellation#45
puddly merged 1 commit into
devfrom
puddly/request-cancellation

Conversation

@puddly

@puddly puddly commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This will require a lot more plumbing for zigpy and ZHA to take advantage of properly and to actually be tested.

This PR provides a way to cancel requests that are still in a pending state and will (theoretically) avoid wasting airtime. A few caveats:

  • Route discovery for all routing modes is a broadcast and cannot be cancelled. We can stop relaying our own copies of a broadcast but this likely won't do much once other routers on the network pick it up.
  • Group commands are also broadcasts and cannot be cancelled.
  • If we know a route to a device, cancellation would only help if Ziggurat is in a retry state. Otherwise, we send out the request instantly.

My eventual goal is to explore something like interaction_id for ZHA, where we track (in software) commands that affect an entity and cancel/replace pending ones that have been enqueued for set amount of time. For example, OnOff:off() enqueued after OnOff:on() should replace the on command. A more visible application would be dragging a slider to set the color of a bulb: instead of buffering a hundred lighting commands, we rate limit to one per second.

@puddly
puddly marked this pull request as ready for review July 13, 2026 23:48
@puddly
puddly merged commit 191b3af into dev Jul 14, 2026
1 check passed
@puddly
puddly deleted the puddly/request-cancellation branch July 14, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant