Skip to content

Commit b0cdca8

Browse files
committed
Re-enable type select
1 parent c231997 commit b0cdca8

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"[python]": {
33
"editor.defaultFormatter": "ms-python.black-formatter"
44
},
5-
"python.formatting.provider": "none"
5+
"python.formatting.provider": "none",
6+
"files.associations": {
7+
"*.yaml": "home-assistant"
8+
}
69
}

custom_components/uniled/lib/ble_banlanx2.py

+2
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ def async_decode_notifications(
332332
# 00 00 5e 02 38 06 48 ff 00 00 00 10 09 04 0b 14 1a 32 37 50 53 73 00 -> more can follow
333333
# 01 00 be 02 ff 0a 48 00 00 ff 00 10 09 04 0b 14 1a 32 37 50 53 73 00 - SP611E
334334
# 00 00 c9 12 0c 0a 4a 00 00 ff 00 10 09 04 0b 14 1a 32 37 50 53 73 00 1a 1a
335+
# 01 00 0e 02 61 0a 1e ff 00 00 01 10 09 04 0b 14 1a 32 37 50 53 73 00 - SP621E
336+
335337
# ---------------------------------------------------------------------------------------
336338
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 -> more can follow
337339
#

custom_components/uniled/lib/ble_ledhue.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""UniLED BLE Devices - SP110E from SPLED (LedHue)"""
22
from __future__ import annotations
3-
43
import functools
54
import operator
65

custom_components/uniled/select.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ def async_update_channels(
6969
channel = coordinator.device.channels[channel_id]
7070
except IndexError:
7171
continue
72+
if channel.mode is not None and channel.mode_list is not None:
73+
new_entities.append(UNILEDModeSelect(coordinator, channel_id))
74+
if channel.input is not None and channel.input_list is not None:
75+
new_entities.append(UNILEDInputSelect(coordinator, channel_id))
7276
if channel.chip_order is not None and channel.chip_order_list is not None:
7377
new_entities.append(UNILEDChipOrderSelect(coordinator, channel_id))
7478
if channel.chip_type is not None and channel.chip_type_list is not None:
7579
new_entities.append(UNILEDChipTypeSelect(coordinator, channel_id))
76-
if channel.input is not None and channel.input_list is not None:
77-
new_entities.append(UNILEDInputSelect(coordinator, channel_id))
78-
if channel.mode is not None and channel.mode_list is not None:
79-
new_entities.append(UNILEDModeSelect(coordinator, channel_id))
8080

8181
async_add_entities(new_entities)
8282

@@ -147,7 +147,6 @@ def __init__(self, coordinator: UNILEDUpdateCoordinator, channel_id: int) -> Non
147147

148148
@property
149149
def available(self) -> bool:
150-
#return False ## For now disable chip type selection!
151150
return super().available
152151

153152
@callback
@@ -164,6 +163,8 @@ async def async_select_option(self, option: str) -> None:
164163
if self.channel.needs_type_reload:
165164
await self.channel.device.stop()
166165
await _async_delayed_reload(self.hass, self.coordinator.entry)
166+
else:
167+
await self.coordinator.async_refresh()
167168

168169
class UNILEDChipOrderSelect(
169170
UNILEDEntity, CoordinatorEntity[UNILEDUpdateCoordinator], SelectEntity

0 commit comments

Comments
 (0)