Skip to content

Commit 74d720a

Browse files
committed
Merge branch 'master' into kagithd-agent/fix-config-entry-migration
2 parents 27052bb + 0eebd30 commit 74d720a

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

custom_components/loxone/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class LoxoneEntityDescription(SensorEntityDescription, frozen_or_thawed=True):
115115
),
116116
LoxoneEntityDescription(
117117
key="illuminance",
118-
loxone_format_strings=(LIGHT_LUX, "lx", "lux"),
118+
loxone_format_strings=(LIGHT_LUX, "Lx", "lx", "lux"),
119119
state_class=SensorStateClass.MEASUREMENT,
120120
device_class=SensorDeviceClass.ILLUMINANCE,
121121
),

tests/test_select_mapping.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class TestBuildOptionMaps:
2424
"""Test build_option_maps — the pure Radio-to-select mapping function."""
2525

2626
def test_outputs_become_options(self):
27-
options, _, _ = build_option_maps(VENTILATIE_DETAILS)
27+
options, _, _, _ = build_option_maps(VENTILATIE_DETAILS)
2828
assert "Stand 1" in options
2929
assert "Stand 4" in options
3030

3131
def test_options_are_sorted_by_output_number(self):
32-
options, _, _ = build_option_maps(VENTILATIE_DETAILS)
32+
options, _, _, _ = build_option_maps(VENTILATIE_DETAILS)
3333
# The "all off" entry is first, followed by outputs in numeric order.
3434
assert options == [
3535
ALL_OFF_DEFAULT_LABEL,
@@ -40,44 +40,49 @@ def test_options_are_sorted_by_output_number(self):
4040
]
4141

4242
def test_empty_all_off_uses_default_label(self):
43-
options, num_to_opt, opt_to_num = build_option_maps(VENTILATIE_DETAILS)
43+
options, num_to_opt, opt_to_num, all_off_num = build_option_maps(
44+
VENTILATIE_DETAILS
45+
)
4446
assert ALL_OFF_DEFAULT_LABEL in options
4547
assert num_to_opt[ALL_OFF_VALUE] == ALL_OFF_DEFAULT_LABEL
4648
assert opt_to_num[ALL_OFF_DEFAULT_LABEL] == ALL_OFF_VALUE
49+
assert all_off_num == ALL_OFF_VALUE
4750

4851
def test_custom_all_off_label(self):
4952
details = {"allOff": "Uit", "outputs": {"1": "Stand 1"}}
50-
options, num_to_opt, opt_to_num = build_option_maps(details)
53+
options, num_to_opt, opt_to_num, all_off_num = build_option_maps(details)
5154
assert options == ["Uit", "Stand 1"]
5255
assert num_to_opt[ALL_OFF_VALUE] == "Uit"
5356
assert opt_to_num["Uit"] == ALL_OFF_VALUE
57+
assert all_off_num == ALL_OFF_VALUE
5458

5559
def test_no_all_off_when_detail_absent(self):
5660
details = {"outputs": {"1": "Stand 1", "2": "Stand 2"}}
57-
options, num_to_opt, opt_to_num = build_option_maps(details)
61+
options, num_to_opt, opt_to_num, all_off_num = build_option_maps(details)
5862
assert options == ["Stand 1", "Stand 2"]
5963
assert ALL_OFF_VALUE not in num_to_opt
64+
assert all_off_num is None
6065

6166
def test_number_to_option_mapping(self):
62-
_, num_to_opt, _ = build_option_maps(VENTILATIE_DETAILS)
67+
_, num_to_opt, _, _ = build_option_maps(VENTILATIE_DETAILS)
6368
assert num_to_opt[1] == "Stand 1"
6469
assert num_to_opt[2] == "Stand 2"
6570
assert num_to_opt[3] == "Stand 3"
6671
assert num_to_opt[4] == "Stand 4"
6772

6873
def test_option_to_number_mapping(self):
69-
_, _, opt_to_num = build_option_maps(VENTILATIE_DETAILS)
74+
_, _, opt_to_num, _ = build_option_maps(VENTILATIE_DETAILS)
7075
assert opt_to_num["Stand 1"] == 1
7176
assert opt_to_num["Stand 4"] == 4
7277

7378
def test_round_trip_number_option_number(self):
74-
_, num_to_opt, opt_to_num = build_option_maps(VENTILATIE_DETAILS)
79+
_, num_to_opt, opt_to_num, _ = build_option_maps(VENTILATIE_DETAILS)
7580
for number in (0, 1, 2, 3, 4):
7681
assert opt_to_num[num_to_opt[number]] == number
7782

7883
def test_duplicate_output_names_are_deduplicated(self):
7984
details = {"outputs": {"1": "Stand", "2": "Stand", "3": "Stand"}}
80-
options, _, opt_to_num = build_option_maps(details)
85+
options, _, opt_to_num, _ = build_option_maps(details)
8186
# All labels remain unique as required by Home Assistant.
8287
assert len(options) == len(set(options))
8388
assert options == ["Stand", "Stand (2)", "Stand (3)"]
@@ -86,7 +91,8 @@ def test_duplicate_output_names_are_deduplicated(self):
8691
assert opt_to_num["Stand (3)"] == 3
8792

8893
def test_missing_outputs_key(self):
89-
options, num_to_opt, opt_to_num = build_option_maps({})
94+
options, num_to_opt, opt_to_num, all_off_num = build_option_maps({})
9095
assert options == []
9196
assert num_to_opt == {}
9297
assert opt_to_num == {}
98+
assert all_off_num is None

0 commit comments

Comments
 (0)