IKEA lights stop mid-transition when ZHA sends a redundant color command after the level command

Aperta
#1,097 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
embedded-iot

Direzione di ricerca

Start in zha/application/platforms/light/init.py, where new_color_provided_while_off is computed and async_handle_color_commands sends the color command after the level command. Reproducing needs IKEA bulbs and a Zigbee coordinator, so trace the command ordering in the logs instead. Done means the redundant color command is skipped when the color matches the current one in the same mode, with the level transition reaching target on all bulbs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Setup

  • Home Assistant 2026.11.2, ZHA (zigpy-znp), coordinator CC2674P10 (SLZB-MR4U)
  • 3× IKEA TRÅDFRI bulb GU10 CWS 345lm, switched individually (unicast)
  • ZHA options: default light transition = 1 s, "Enhanced light transition from an off-state" = on

What happens

Turning the lights on from off with brightness: 204 and color_temp_kelvin: 3000, while all three bulbs are already at 333 mireds (color temperature mode), ZHA sends:

19:18:46.872  move_to_level_with_on_off(level=204, transition_time=10)
19:18:47.044  move_to_color_temp(color_temp_mireds=333, transition_time=10)   ← 0.15–0.5 s later

All commands are acknowledged with SUCCESS. But the bulbs abort the level transition when the color command arrives, and stay at an intermediate level. Reported current_level after the transition (target 204):

switch-on bulb A bulb B bulb C
19:18:46 41 41 82
19:19:00 102 41 41
19:19:13 143 61 122

With transition 0, all bulbs reach 204 every time.

What works

  • Color actually changes (e.g. it was set to an XY color before): the enhanced off-state path kicks in. ZHA turns on at minimum level, sets the color, then moves to the level. All bulbs reach 204.
  • Only the level is sent (we stopped sending the unchanged color from our side): move_to_level_with_on_off(204, 10) alone. All bulbs fade cleanly to 204.

Why

In zha/application/platforms/light/__init__.py, new_color_provided_while_off is only true if the color differs from the current one. So with an unchanged color, the enhanced path is skipped. async_handle_color_commands then still sends the color command right after the level command, with the same transition, while the level transition is still running.

IKEA WS/CWS bulbs are known to freeze for the duration of a transition after a color command and to drop or abort other commands during that time. Zigbee2MQTT works around this for all IKEA WS/CWS lights: zigbee-herdsman-converters src/lib/ikea.ts, trackFreezing / unfreeze_support (on by default), which sends genLevelCtrl stop before the next command while a light is marked as frozen (Koenkk/zigbee2mqtt#18574). Related reports: home-assistant/core#117604, and several community threads ("Light transition not working. IKEA Tradfri", "simultaneous brightness + color transition workaround").

Suggestions

  1. Don't send the color command when the requested color equals the current one in the same color mode. That alone fixed the common switch-on case for us.
  2. Optionally, port the Z2M IKEA unfreeze handling (track frozenUntil per light or group, send stop before the next command).

Debug logs (redacted) are available on request.

Lingua principale
Python
Stelle
96
Fork
84
Merge medio
2g 4h
PR unite (30g)
30

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zigpy/zha

Tutte le issue di zigpy/zha

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.