Skip to content

ESPHome: fix TypeError when an RGBW light gets on/bri without a colour - #1167

Merged
mariusmotea merged 1 commit into
diyhue:masterfrom
Pharex38:esphome-rgbw-state
Oct 23, 2026
Merged

mariusmotea merged 1 commit into
diyhue:masterfrom
Pharex38:esphome-rgbw-state

Conversation

@Pharex38

Copy link
Copy Markdown
Contributor

For an ESPHome-RGBW light, getLightType picks the white or colour LED from the request. When the request has no colour (only on, bri, transitiontime...), it falls back to the light's current colour mode via light["state"]["colormode"]. Light isn't subscriptable, so that raises TypeError and Light.setV1State marks the light unreachable. In practice, turning an RGBW ESPHome light on or dimming it without touching the colour failed.

The fallback now reads light.state["colormode"].

Tests: tests/test_esphome_rgbw.py turns an RGBW light on in ct and xy mode and dims it in hs mode, and checks which LED endpoint is used (postRequest mocked). They fail on master with the TypeError; pytest tests passes.

@mariusmotea
mariusmotea merged commit d947faf into diyhue:master Oct 23, 2026
5 checks passed
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.

2 participants