Skip to content

Commit

Permalink
fix: correct LedState handling as bytes
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
  • Loading branch information
kaechele committed Dec 29, 2023
1 parent 135405c commit 31ec630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/bonaparte/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ class LedState(MultiValueEnum):

_init_ = "short long"

OFF = 0x00, "0x000000"
ON = 0xFF, 0xFFFFFF
OFF = 0x00, bytes([0, 0, 0])
ON = 0xFF, bytes([0xFF, 0xFF, 0xFF])


class LedMode(MultiValueEnum):
"""Enum encapsulating LED controller modes."""

_init_ = "short long setvalue"

CYCLE = 0x01, 0x010101, 0x20
HOLD = 0x02, 0x020202, 0x30
EMBER_BED = 0xFF, 0xFFFFFF, 0x10
CYCLE = 0x01, bytes([0x01, 0x01, 0x01]), 0x20
HOLD = 0x02, bytes([0x02, 0x02, 0x02]), 0x30
EMBER_BED = 0xFF, bytes([0xFF, 0xFF, 0xFF]), 0x10
2 changes: 1 addition & 1 deletion src/bonaparte/fireplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ async def update_led_controller_mode(self) -> None:
"""Update the mode of the LED colors."""
result = await self.execute_command(EfireCommand.GET_LED_MODE)

self._state.led_mode = LedMode(int.from_bytes(result, "big"))
self._state.led_mode = LedMode(bytes(result))

# E3
@needs_auth
Expand Down

0 comments on commit 31ec630

Please sign in to comment.