Skip to content

Add missing device_type 105 (Direct Connect A21 Gen2) to Capabilities table - #166

Open
imwithsam wants to merge 1 commit into
nikshriv:mainfrom
imwithsam:fix/missing-device-type-105-capabilities
Open

Add missing device_type 105 (Direct Connect A21 Gen2) to Capabilities table#166
imwithsam wants to merge 1 commit into
nikshriv:mainfrom
imwithsam:fix/missing-device-type-105-capabilities

Conversation

@imwithsam

Copy link
Copy Markdown

Summary

Device type 105 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 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 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.

What device this is

Confirmed via a real account's device data plus cross-reference against pycync's own device table: deviceType 105 → 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: False despite being real controllable Direct Connect bulbs, and switchID_to_homeID/home_controllers were missing entries for them entirely. After adding 105 to the five lists, a fresh config fetch showed all three lamps correctly reporting True for every capability, each with switch_controller set to its own switch_id (correctly reflecting that Direct Connect bulbs are independent nodes, not mesh-relayed), and switchID_to_homeID/home_controllers grew from 3 to 6 entries. Entities registered cleanly afterward with correct IDs and supported_color_modes: ['color_temp', 'rgb'].

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.
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