Skip to content

Commit

Permalink
Add support for 0x5b
Browse files Browse the repository at this point in the history
Fixes: #36
  • Loading branch information
8none1 committed Jan 16, 2025
1 parent 084efd1 commit aac93c7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions custom_components/lednetwf_ble/lednetwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ async def turn_off(self):
async def set_led_settings(self, options: dict):
led_settings_packet = self._model_interface.set_led_settings(options)
LOGGER.debug(f"LED settings packet: {' '.join([f'{byte:02X}' for byte in led_settings_packet])}")
if led_settings_packet is None:
LOGGER.error("LED settings packet is None")
return
await self._write(led_settings_packet)
await self._write(self._model_interface.GET_LED_SETTINGS_PACKET)
await self.turn_off()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/lednetwf_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"bleak>=0.17.0",
"bluetooth-sensor-state-data>=1.5.0"
],
"version": "0.0.14-beta.1"
"version": "0.0.14-beta.2"
}
2 changes: 1 addition & 1 deletion custom_components/lednetwf_ble/models/model_0x53.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Model0x53(DefaultModelAbstraction):
def __init__(self, manu_data):
LOGGER.debug("Model 0x53 init")
super().__init__(manu_data)
self.SUPPORTED_VERSIONS = [0x53, 0x00] # Why am I mixing case here? FIXME
self.SUPPORTED_VERSIONS = SUPPORTED_MODELS
self.supported_color_modes = {ColorMode.HS, ColorMode.COLOR_TEMP}
self.icon = "mdi:lightbulb"
self.effect_list = EFFECTS_LIST_0x53
Expand Down
10 changes: 5 additions & 5 deletions custom_components/lednetwf_ble/models/model_0x5b.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
EFFECT_OFF
)

SUPPORTED_MODELS = [0x5B]
SUPPORTED_MODELS = [0x5B]

class Model0x5B(DefaultModelAbstraction):
class Model0x5b(DefaultModelAbstraction):
# CCT only strip
def __init__(self, manu_data):
LOGGER.debug("Model 0x5B init")
Expand Down Expand Up @@ -50,9 +50,9 @@ def model_specific_manu_data(self, manu_data):
self.brightness = int(self.manu_data[17] * 255 // 100) # This one is in range 0-FF
self.color_mode = ColorMode.COLOR_TEMP
LOGGER.debug(f"From manu data white brightness: {self.brightness}")
else:
LOGGER.error(f"Unknown colour mode: {self.manu_data[16]}. Assuming RGB")
raise NotImplementedError("Unknown colour mode")
# else:
# LOGGER.error(f"Unknown colour mode: {self.manu_data[16]}. Assuming RGB")
# raise NotImplementedError("Unknown colour mode")
# elif self.manu_data[15] == 0x25:
# # Effect mode
# LOGGER.debug(f"Effect mode detected. self.manu_data: {self.manu_data}")
Expand Down
2 changes: 1 addition & 1 deletion custom_components/lednetwf_ble/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"ledcount": "Number of LEDs",
"name": "Name",
"ledtype": "LED type",
"colororder": "Color order"
"colororder": "Color order"
},
"title": "LEDnetWF"
}
Expand Down

0 comments on commit aac93c7

Please sign in to comment.