Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Zigpy uses pyserial-asyncio-fast if it is installed. This fork of pyserial-asyncio fixes a bug where writes are buffered unnecessarily, essentially introducing unnecessary delays to serial writes (@pipiche38 you may want to add this as a dependency to benefit from it).
The purpose of the UART thread was to allow bellows to instantly respond to packets with an ACK and avoid timing problems caused by a busy main asyncio event loop. This problem is fixed by pyserial-asyncio-fast, as
protocol.data_received
synchronously parses any incoming data and immediately callstransport.write
, without invoking the event loop at all.In my local tests, 4608/4608
transport.write
calls immediately resulted in a successfulwrite
syscall, meaning the protocol's write buffer was never filled at all.