Skip to content

Commit 64ba437

Browse files
authored
Fix KNX Light - individual color initialisation from UI config (home-assistant#151815)
1 parent 1d214ae commit 64ba437

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

homeassistant/components/knx/light.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,19 @@ def _create_ui_light(xknx: XKNX, knx_config: ConfigType, name: str) -> XknxLight
285285
group_address_switch_green_state=conf.get_state_and_passive(
286286
CONF_COLOR, CONF_GA_GREEN_SWITCH
287287
),
288-
group_address_brightness_green=conf.get_write(CONF_GA_GREEN_BRIGHTNESS),
288+
group_address_brightness_green=conf.get_write(
289+
CONF_COLOR, CONF_GA_GREEN_BRIGHTNESS
290+
),
289291
group_address_brightness_green_state=conf.get_state_and_passive(
290292
CONF_COLOR, CONF_GA_GREEN_BRIGHTNESS
291293
),
292-
group_address_switch_blue=conf.get_write(CONF_GA_BLUE_SWITCH),
293-
group_address_switch_blue_state=conf.get_state_and_passive(CONF_GA_BLUE_SWITCH),
294-
group_address_brightness_blue=conf.get_write(CONF_GA_BLUE_BRIGHTNESS),
294+
group_address_switch_blue=conf.get_write(CONF_COLOR, CONF_GA_BLUE_SWITCH),
295+
group_address_switch_blue_state=conf.get_state_and_passive(
296+
CONF_COLOR, CONF_GA_BLUE_SWITCH
297+
),
298+
group_address_brightness_blue=conf.get_write(
299+
CONF_COLOR, CONF_GA_BLUE_BRIGHTNESS
300+
),
295301
group_address_brightness_blue_state=conf.get_state_and_passive(
296302
CONF_COLOR, CONF_GA_BLUE_BRIGHTNESS
297303
),

homeassistant/components/knx/storage/entity_store_schema.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,19 @@ class LightColorMode(StrEnum):
240240
write_required=True, valid_dpt="5.001"
241241
),
242242
"section_blue": KNXSectionFlat(),
243-
vol.Required(CONF_GA_BLUE_BRIGHTNESS): GASelector(
244-
write_required=True, valid_dpt="5.001"
245-
),
246243
vol.Optional(CONF_GA_BLUE_SWITCH): GASelector(
247244
write_required=False, valid_dpt="1"
248245
),
249-
"section_white": KNXSectionFlat(),
250-
vol.Optional(CONF_GA_WHITE_BRIGHTNESS): GASelector(
246+
vol.Required(CONF_GA_BLUE_BRIGHTNESS): GASelector(
251247
write_required=True, valid_dpt="5.001"
252248
),
249+
"section_white": KNXSectionFlat(),
253250
vol.Optional(CONF_GA_WHITE_SWITCH): GASelector(
254251
write_required=False, valid_dpt="1"
255252
),
253+
vol.Optional(CONF_GA_WHITE_BRIGHTNESS): GASelector(
254+
write_required=True, valid_dpt="5.001"
255+
),
256256
},
257257
),
258258
GroupSelectOption(

tests/components/knx/snapshots/test_websocket.ambr

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -575,44 +575,44 @@
575575
'type': 'knx_section_flat',
576576
}),
577577
dict({
578-
'name': 'ga_blue_brightness',
578+
'name': 'ga_blue_switch',
579+
'optional': True,
579580
'options': dict({
580581
'passive': True,
581582
'state': dict({
582583
'required': False,
583584
}),
584585
'validDPTs': list([
585586
dict({
586-
'main': 5,
587-
'sub': 1,
587+
'main': 1,
588+
'sub': None,
588589
}),
589590
]),
590591
'write': dict({
591-
'required': True,
592+
'required': False,
592593
}),
593594
}),
594-
'required': True,
595+
'required': False,
595596
'type': 'knx_group_address',
596597
}),
597598
dict({
598-
'name': 'ga_blue_switch',
599-
'optional': True,
599+
'name': 'ga_blue_brightness',
600600
'options': dict({
601601
'passive': True,
602602
'state': dict({
603603
'required': False,
604604
}),
605605
'validDPTs': list([
606606
dict({
607-
'main': 1,
608-
'sub': None,
607+
'main': 5,
608+
'sub': 1,
609609
}),
610610
]),
611611
'write': dict({
612-
'required': False,
612+
'required': True,
613613
}),
614614
}),
615-
'required': False,
615+
'required': True,
616616
'type': 'knx_group_address',
617617
}),
618618
dict({
@@ -622,7 +622,7 @@
622622
'type': 'knx_section_flat',
623623
}),
624624
dict({
625-
'name': 'ga_white_brightness',
625+
'name': 'ga_white_switch',
626626
'optional': True,
627627
'options': dict({
628628
'passive': True,
@@ -631,19 +631,19 @@
631631
}),
632632
'validDPTs': list([
633633
dict({
634-
'main': 5,
635-
'sub': 1,
634+
'main': 1,
635+
'sub': None,
636636
}),
637637
]),
638638
'write': dict({
639-
'required': True,
639+
'required': False,
640640
}),
641641
}),
642642
'required': False,
643643
'type': 'knx_group_address',
644644
}),
645645
dict({
646-
'name': 'ga_white_switch',
646+
'name': 'ga_white_brightness',
647647
'optional': True,
648648
'options': dict({
649649
'passive': True,
@@ -652,12 +652,12 @@
652652
}),
653653
'validDPTs': list([
654654
dict({
655-
'main': 1,
656-
'sub': None,
655+
'main': 5,
656+
'sub': 1,
657657
}),
658658
]),
659659
'write': dict({
660-
'required': False,
660+
'required': True,
661661
}),
662662
}),
663663
'required': False,

0 commit comments

Comments
 (0)