Skip to content

Commit

Permalink
Update bridge.py, tools.py, and test_device_parsing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
YogevBokobza committed Oct 6, 2024
1 parent 83bfa6e commit 0723ea7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/aioswitcher/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
ShutterDirection,
SwitcherBase,
SwitcherDualShutterSingleLight,
SwitcherLight,
SwitcherPowerPlug,
SwitcherShutter,
SwitcherSingleShutterDualLight,
SwitcherLight,
SwitcherThermostat,
SwitcherWaterHeater,
ThermostatFanLevel,
Expand Down Expand Up @@ -249,10 +249,7 @@ def _parse_device_from_datagram(
parser.get_thermostat_remote_id(),
)
)
elif (
device_type
and device_type.category == DeviceCategory.LIGHT
):
elif device_type and device_type.category == DeviceCategory.LIGHT:
logger.debug("discovered a Light SL01 switcher device")
device_callback(
SwitcherLight(
Expand Down
6 changes: 5 additions & 1 deletion src/aioswitcher/device/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ def get_light_discovery_packet_index(
if circuit_number not in [0, 1]:
raise ValueError("Invalid circuit number")
return circuit_number
if device_type in (DeviceType.RUNNER_S12, DeviceType.LIGHT_SL01, DeviceType.LIGHT_SL01_MINI):
if device_type in (
DeviceType.RUNNER_S12,
DeviceType.LIGHT_SL01,
DeviceType.LIGHT_SL01_MINI,
):
if circuit_number != 0:
raise ValueError("Invalid circuit number")
return 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_device_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from aioswitcher.device import (
DeviceState,
SwitcherDualShutterSingleLight,
SwitcherLight,
SwitcherPowerPlug,
SwitcherShutter,
SwitcherLight,
SwitcherSingleShutterDualLight,
SwitcherThermostat,
SwitcherWaterHeater,
Expand Down

0 comments on commit 0723ea7

Please sign in to comment.