Add missing device_type 105 (Direct Connect A21 Gen2) to Capabilities table - #166
Open
imwithsam wants to merge 1 commit into
Open
Add missing device_type 105 (Direct Connect A21 Gen2) to Capabilities table#166imwithsam wants to merge 1 commit into
imwithsam wants to merge 1 commit into
Conversation
Device type 105 (the "Direct Connect" A21 Gen2 full-color bulb, confirmed via cross-reference with pycync's own device table: 105 -> SingleChipFullColorBulbA21Gen2) was missing from every capability list (ONOFF, BRIGHTNESS, COLORTEMP, RGB, WIFICONTROL) in the hardcoded Capabilities dict -- there's a gap between 85 and 128 in each list where 105 should sit, alongside the other already- present Direct Connect codes (128-133). Since every derived capability flag is computed as `device_type in Capabilities[...]`, a device whose type isn't in the table gets False across the board. For an affected bulb this causes cascading failures: ONOFF/BRIGHTNESS/COLORTEMP/RGB all read as unsupported, and switchID_to_homeID/home_controllers never get populated for it (gated on WIFICONTROL), which can surface as KeyErrors elsewhere keyed on that switch_id.
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.
Summary
Device type 105 was missing from every capability list (
ONOFF,BRIGHTNESS,COLORTEMP,RGB,WIFICONTROL) in the hardcodedCapabilitiesdict — there's a gap between 85 and 128 in each list where it should sit, alongside the other already-present Direct Connect codes (128-133).Since every derived capability flag is computed as
device_type in Capabilities[...], a device whose type isn't in the table getsFalseacross the board. For an affected bulb this causes cascading failures:ONOFF/BRIGHTNESS/COLORTEMP/RGBall read as unsupported, andswitchID_to_homeID/home_controllersnever get populated for it (gated onWIFICONTROL), which can surface asKeyErrors elsewhere keyed on thatswitch_id.What device this is
Confirmed via a real account's device data plus cross-reference against
pycync's own device table:deviceType105 →SingleChipFullColorBulbA21Gen2, i.e. the "Direct Connect" A21 Gen2 full-color bulb (WiFi-direct, own independent radio — same category as the already-present 128-133 codes, this one code just got missed).Verification
Reproduced and fixed live against real affected bulbs. Before the fix, all three lamps on the account showed
ONOFF/BRIGHTNESS/COLORTEMP/RGB/WIFICONTROL: Falsedespite being real controllable Direct Connect bulbs, andswitchID_to_homeID/home_controllerswere missing entries for them entirely. After adding 105 to the five lists, a fresh config fetch showed all three lamps correctly reportingTruefor every capability, each withswitch_controllerset to its ownswitch_id(correctly reflecting that Direct Connect bulbs are independent nodes, not mesh-relayed), andswitchID_to_homeID/home_controllersgrew from 3 to 6 entries. Entities registered cleanly afterward with correct IDs andsupported_color_modes: ['color_temp', 'rgb'].