Commit 1a9e273
committed
Fix missing color_mode initialization in MQTT JSON light schema
Initialize `_fixed_color_mode` and `_attr_color_mode` before the
color mode branching logic in `_setup_from_config`, matching the
pattern already used in `schema_template.py` (added in #162715).
Without this, `_attr_color_mode` can remain `None` (the new default
from #162715) in edge cases during entity (re)setup, causing
"does not report a color mode" errors when the light is on.
Also use `_fixed_color_mode` in `_update_color()` to skip color
mode changes for single-mode lights, preventing the fixed mode
from being overwritten by state updates. This matches the guard
pattern used in `schema_template.py`.1 parent b5480da commit 1a9e273
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
196 | | - | |
| 198 | + | |
| 199 | + | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
| |||
206 | 209 | | |
207 | 210 | | |
208 | 211 | | |
| 212 | + | |
| 213 | + | |
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
| |||
0 commit comments