Conversation
Two problems made multi-split (VRF) gateways discover unreliably: 1. Sub-device (subList) fetching ran inline inside the UDP receive loop. The subList query has its own retries/timeouts, so it blocked the loop and ate the discovery time budget, causing other devices' broadcast replies to be dropped (e.g. finding 3 of 4 units). Gateways are now collected during the loop and queried afterwards, concurrently via asyncio.gather, keeping discovery fast and complete. 2. A gateway was only treated as such when subCnt > 1, so single-unit gateways were missed. Any subCnt > 0 is now handled as a gateway. get_subunits_list is rewritten to send subList unencrypted and handle both response shapes seen in the wild: the sub-unit list at the top level, or wrapped in a pack encrypted with the gateway's bound device key (bind first, then decrypt). A small self-contained _fetch_subunits_raw helper does the raw UDP exchange since the response has no pack to feed through FetchResult.
meirlo
marked this pull request as ready for review
September 18, 2026 10:53
p-monteiro
added a commit
to p-monteiro/HomeAssistant-GreeClimateComponent-Rewrite
that referenced
this pull request
Sep 18, 2026
Owner
|
I need some testers with VRF devices for this one! |
p-monteiro
added a commit
to p-monteiro/HomeAssistant-GreeClimateComponent-Rewrite
that referenced
this pull request
Sep 21, 2026
RobHofmann
pushed a commit
that referenced
this pull request
Sep 21, 2026
* Add integration code to python analysis so that autocomplete works for the new tools * Use VRF local discovery as in #507 * Remove unnecessary check for sub_devices lists length * Prevent one VRF gateway not connecting from breaking full discovery process Also properly use the discover timeout for getting the subdevices * Properly assign VRF subunits a name * Use the retireved key for sub-units * Reduce time waster discovering-subdevices when errors occur --------- Co-authored-by: Pedro Monteiro <p-monteiro@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On multi-split (VRF) setups — one WiFi gateway fronting several indoor units — discovery was unreliable:
subList) fetching ran inline inside the UDP receive loop. That query has its own retries/timeouts, so it blocked the loop and consumed the discovery time budget while other devices' broadcast replies were still arriving. Result: intermittently finding e.g. 3 of 4 units.subCnt > 1, so a gateway reporting exactly one indoor unit was never expanded.subListparsing was brittle. The old code always sent an encryptedpackwith the generic key and pushed the reply throughFetchResult, which assumes apackin the response. Several firmwares answersubListwith the unit list at the top level (no pack), or with a pack encrypted using the gateway's bound key rather than the generic key.Changes
asyncio.gather). Keeps discovery fast and stops it from dropping other devices' replies.subCnt > 0as a gateway.get_subunits_listto sendsubListunencrypted and handle both response shapes: list at the top level, or a pack encrypted with the gateway's bound device key (bind first, then decrypt; v1 ECB and v2 GCM)._fetch_subunits_rawhelper for the raw UDP exchange, since the response may have nopackto feed throughFetchResult.Scope
gree_protocol.pyonly. No behaviour change for standalone (non-VRF) devices — they never enter the gateway path.Related
Part of a small VRF series. Complements #454 (per-unit
device_info/unique_id), which makes each discovered sub-unit its own HA device. This PR is what makes all the sub-units reliably get discovered in the first place.Testing
Tested on my own setup:
subMAC@gatewayMACform).Before this change, re-running discovery intermittently returned only 3 of the 4 units. After it, all 4 indoor units are discovered consistently across repeated scans, and the encrypted-
packsubListpath decodes correctly with the gateway's bound key.