Skip to content

Commit c231997

Browse files
committed
Intro of SP630E, SP648E, SP613E & SP614E
1 parent 931b522 commit c231997

26 files changed

+2576
-384
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ UniLED Currently supports the following range of cheap BLE addressable LED contr
1515
- [SP611E][SP61xE]
1616
- [SP617E][SP61xE]
1717
- [SP620E][SP620E]
18+
- [SP630E][SP630E]
19+
- [SP648E][SP648E]
1820

1921
---
2022

@@ -69,6 +71,8 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
6971
[SP601E]: docs/sp601e.md
7072
[SP61xE]: docs/sp61Xe.md
7173
[SP620E]: docs/sp620e.md
74+
[SP630E]: docs/sp630e.md
75+
[SP648E]: docs/sp648e.md
7276
[Info]: info.md
7377
[user_profile]: https://github.com/monty68
7478
[maintenance-shield]: https://img.shields.io/badge/maintainer-Monty-blue.svg?style=for-the-badge

custom_components/uniled/__init__.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
_LOGGER = logging.getLogger(__name__)
3333

3434
PLATFORMS: list[Platform] = [
35-
Platform.SELECT,
35+
Platform.LIGHT,
3636
Platform.NUMBER,
37-
Platform.SWITCH,
37+
Platform.SELECT,
3838
Platform.SENSOR,
39-
Platform.LIGHT,
39+
Platform.SWITCH,
4040
]
4141

4242

@@ -77,10 +77,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
7777
uniled = UNILEDBLE(ble_device, service_info.advertisement, model_name)
7878

7979
if not uniled.model:
80-
_LOGGER.debug("*** Resolve Model: %s (%s)", uniled.name, uniled.model)
80+
_LOGGER.debug("*** Resolve BLE Model: %s (%s)", uniled.name, uniled.model)
8181
model = await uniled.resolve_model()
8282
if model is None:
83-
_LOGGER.error("%s: Cannot resolve device model", uniled.name)
8483
raise ConfigEntryNotReady(
8584
f"Could not resolve model for BLE device with address {address}"
8685
)
@@ -106,6 +105,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
106105
cancel_first_update = uniled.register_callback(lambda *_: startup_event.set())
107106
coordinator = UNILEDUpdateCoordinator(hass, uniled, entry)
108107

108+
_LOGGER.debug("*** Awaiting UniLED Device: %s, response", uniled.name)
109+
109110
try:
110111
await coordinator.async_config_entry_first_refresh()
111112
except ConfigEntryNotReady:
@@ -115,8 +116,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
115116
bluetooth.async_rediscover_address(hass, address)
116117
raise
117118

118-
_LOGGER.debug("*** Awaiting UniLED Device: %s, response", uniled.name)
119-
120119
try:
121120
async with async_timeout.timeout(DEVICE_TIMEOUT):
122121
await startup_event.wait()

custom_components/uniled/config_flow.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
29-
"""Handle a config flow for BTF Bluetooth Controller."""
29+
"""Handle a config flow for Bluetooth Controller."""
3030

3131
VERSION = 1
3232

custom_components/uniled/const.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
UPDATE_SECONDS: Final = 30
88
REFRESH_DELAY: Final = 2.0
99
COMMAND_SETTLE_DELAY: Final = 0.3
10+
STATE_CHANGE_LATENCY: Final = 2
11+
STATE_CHANGE_INTERVAL: Final = 120
1012

1113
ATTR_POWER = "power"
1214
ATTR_MODE = "mode"
1315
ATTR_RGB2_COLOR = "rgb2_color"
1416
ATTR_EFFECT_NUMBER = "effect_number"
17+
ATTR_EFFECT_LOOP = "effect_loop"
18+
ATTR_EFFECT_PLAY = "effect_play"
1519
ATTR_EFFECT_TYPE = "effect_type"
1620
ATTR_EFFECT_SPEED = "effect_speed"
1721
ATTR_EFFECT_LENGTH = "effect_length"

custom_components/uniled/coordinator.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ async def _async_update(self) -> None:
8686

8787
if self.entry.state in valid_states:
8888
if not await self.device.update():
89-
raise UpdateFailed(f"{self.device.name}: Data Update failed")
89+
raise UpdateFailed("Update failed")
9090
return
9191
if self.device.available:
9292
_LOGGER.debug("%s: Forcing stop", self.device.name)
9393
await self.device.stop()
9494
raise UpdateFailed(f"{self.device.name}: Invalid entry state!")
9595
except BLEAK_EXCEPTIONS as ex:
9696
raise UpdateFailed(str(ex)) from ex
97+

custom_components/uniled/entity.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(
5656
if key is not None:
5757
self._attr_unique_id = f"_{self._attr_unique_id}_{key}"
5858
self._attr_device_info = _async_device_info(self._device, coordinator.entry)
59-
59+
6060
@property
6161
def available(self) -> bool:
6262
if not self.channel.is_available:
@@ -112,7 +112,7 @@ def _async_device_info(
112112
ATTR_MODEL: device.model_name,
113113
ATTR_NAME: device.name, # entry.data.get(CONF_NAME, entry.title),
114114
ATTR_HW_VERSION: device.description,
115-
# ATTR_SW_VERSION: hex(device.version),
115+
ATTR_SW_VERSION: device.firmware,
116116
}
117117

118118
if device.transport == UNILED_TRANSPORT_BLE:

0 commit comments

Comments
 (0)