Conversation
The feature probe treated a property as unsupported when its value was
falsy. Devices report 0 for plenty of properties they do support -- a
stopped compressor, an unlocked child lock, a fault register with no
fault -- so the probe result depended on what the unit happened to be
doing when Home Assistant started. AntiDirectBlow, for example, reads 2
on one unit and 0 on another of the same model; only the first was
detected.
Decide instead on whether the device echoes the column back. The
firmware omits columns it does not implement from a status response, so
the returned column list is exactly the supported subset. GreeGetValues
discarded that list, so split the request out into GreeFetchStatus and
add GreeGetSupportedValues alongside it.
Probing is what keeps the poll list safe: SetAcOptions maps dat[i]
positionally onto the requested columns, so polling an unsupported key
would shift every following value and push a wrong mode or temperature
back to the unit on the next SendStateToAc.
Replace the five copy-pasted probe blocks with a table in const.py and
one loop. All pending keys go out in a single request -- the reply
already classifies them -- falling back to per-key probes if a device
rejects the longer column list.
Add the properties this makes reachable:
sensors CompressorFqy, CompressorTem, InEvaTem, EnvTem,
TemsSenOut, PM2P5, AllErr, JFErrorCode
binary sensors Dfltr, ReplaceHEPA (new platform)
switches ChildLock, Dazzling, UvcControl, AutoClean, NobodySave
Writable ones are appended to the SendStateToAc command list; values
left unset by an unsupported feature are dropped by the existing filter.
CompressorFqy is documented as a system-level reading: on a multi-split
every indoor unit reports the shared outdoor unit's frequency, so it
must not be summed across units.
Verified against four Gree units (fw V3.2.M, module V2.10, encryption
v2): all 20 probed keys echo back in one request.
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER is deprecated and Home Assistant logs a warning naming this integration; it goes away in core 2027.8. Import UnitOfDensity where available and fall back to the old constant so older cores keep working.
Contributor
|
The assumption of the device not returning values that it does not support is incorrect. The firmware will reply for things the physical unit does not support. Thus, using property probing to determine feature availability is impossible and a dead end. We either maintain a feature table based on device models and fw versions which is unfeasible for future maintenance, or we inquire the user for the features their devices actually support (the approach being used for the next version of the integration) |
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.
The bug this starts from
The optional-feature probe decides support from the value a property returns:
Plenty of supported properties legitimately read
0— a compressor that is notrunning, an unlocked child lock, a fault register with no fault. The probe runs
once and the result sticks, so whether a feature is detected depends on what the
unit happened to be doing when Home Assistant started.
This is observable across identical hardware: of four Gree units on one system,
AntiDirectBlowreads2on two of them and0on the other two. Only thefirst two were detected, permanently.
The fix
Decide on whether the device echoes the column back. The firmware omits columns
it does not implement from a status reply, so the returned column list is the
supported subset — an unambiguous signal that does not depend on runtime state.
GreeGetValuesthrew that list away, so this splits the request out intoGreeFetchStatusand addsGreeGetSupportedValuesnext to it. Existing callersare unchanged.
Probing is also what keeps polling safe, which is worth stating explicitly since
the new table makes it easy to add keys:
SetAcOptionsmapsdat[i]positionally onto the requested column list, so polling an unsupported key
shifts every value after it — and the shifted values are written straight back
to the unit by the next
SendStateToAc.Refactor
The five copy-pasted probe blocks (~85 lines) become a table in
const.pyandone loop. All pending keys go out in a single request, since the reply
already classifies every one of them; a device that rejects the longer column
list falls back to per-key probes.
New entities
Properties this makes reachable, each gated on its own probe:
CompressorFqy,CompressorTem,InEvaTem,EnvTem,TemsSenOut,PM2P5,AllErr,JFErrorCodeDfltr,ReplaceHEPAChildLock,Dazzling,UvcControl,AutoClean,NobodySaveWritable ones are appended to the
SendStateToAccommand list; properties leftunset because the device lacks the feature are dropped by the existing filter.
CompressorFqyis documented as a system-level reading: on a multi-split everyindoor unit reports the shared outdoor unit's frequency, so it must not be
summed across units. Verified — all four units reported 26 Hz while only one had
Pow=1.Secondary/duplicate sensors (
EnvTem,TemsSenOut,PM2P5,JFErrorCode,ReplaceHEPA) default to disabled to keep the entity list manageable.A second commit swaps the deprecated
CONCENTRATION_MICROGRAMS_PER_CUBIC_METERfor
UnitOfDensity, with a fallback for older cores.Testing
No test suite exists in the repo (per CLAUDE.md), so this was verified against
hardware: four Gree units, firmware
V3.2.M, WiFi moduleV2.10, encryption v2.Optional properties not supported: none.AntiDirectBlow, including the two reading0thatthe old probe missed.
frequency tracking the outdoor unit).
check_configclean.