From 6d6dda0fc661c4e8e0d4776f6b353e882ae7b6f2 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Sun, 2 Aug 2026 19:55:46 +0200 Subject: [PATCH] Solve PLR0917 errors --- plugwise_usb/messages/requests.py | 2 ++ plugwise_usb/nodes/sed.py | 10 +++++----- plugwise_usb/nodes/sense.py | 16 ++++++++-------- tests/test_usb.py | 10 +++++----- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/plugwise_usb/messages/requests.py b/plugwise_usb/messages/requests.py index 26f5a37ae..0f8c92f77 100644 --- a/plugwise_usb/messages/requests.py +++ b/plugwise_usb/messages/requests.py @@ -1205,6 +1205,7 @@ def __init__( # noqa: PLR0913 self, send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]], mac: bytes, + *, awake_duration: int, maintenance_interval: int, sleep_duration: int, @@ -1430,6 +1431,7 @@ def __init__( # noqa: PLR0913 self, send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]], mac: bytes, + *, temp_hum: bool, lower_bound: int, upper_bound: int, diff --git a/plugwise_usb/nodes/sed.py b/plugwise_usb/nodes/sed.py index bb1040cc3..831c92f56 100644 --- a/plugwise_usb/nodes/sed.py +++ b/plugwise_usb/nodes/sed.py @@ -554,11 +554,11 @@ async def sed_configure(self) -> bool: request = NodeSleepConfigRequest( self._send, self._mac_in_bytes, - self._battery_config.awake_duration, - self._battery_config.maintenance_interval, - self._battery_config.sleep_duration, - self._battery_config.clock_sync, - self._battery_config.clock_interval, + awake_duration=self._battery_config.awake_duration, + maintenance_interval=self._battery_config.maintenance_interval, + sleep_duration=self._battery_config.sleep_duration, + sync_clock=self._battery_config.clock_sync, + clock_interval=self._battery_config.clock_interval, ) _LOGGER.debug( "sed_configure | Device %s | awake_duration=%s | clock_interval=%s | clock_sync=%s | maintenance_interval=%s | sleep_duration=%s", diff --git a/plugwise_usb/nodes/sense.py b/plugwise_usb/nodes/sense.py index 8fb2dd866..c7099957d 100644 --- a/plugwise_usb/nodes/sense.py +++ b/plugwise_usb/nodes/sense.py @@ -732,10 +732,10 @@ async def _configure_sense_humidity_task(self) -> bool: request = SenseConfigureHysteresisRequest( self._send, self._mac_in_bytes, - False, - humidity_lower_bound, - humidity_upper_bound, - self.humidity_direction, + temp_hum=False, + lower_bound=humidity_lower_bound, + upper_bound=humidity_upper_bound, + direction=self.humidity_direction, ) if (response := await request.send()) is None: self._log_configure_failed("humidity hysteresis") @@ -777,10 +777,10 @@ async def _configure_sense_temperature_task(self) -> bool: request = SenseConfigureHysteresisRequest( self._send, self._mac_in_bytes, - True, - temperature_lower_bound, - temperature_upper_bound, - self.temperature_direction, + temp_hum=True, + lower_bound=temperature_lower_bound, + upper_bound=temperature_upper_bound, + direction=self.temperature_direction, ) if (response := await request.send()) is None: _LOGGER.warning( diff --git a/tests/test_usb.py b/tests/test_usb.py index 59e62cd44..b7668ac38 100644 --- a/tests/test_usb.py +++ b/tests/test_usb.py @@ -1503,11 +1503,11 @@ async def test_creating_request_messages(self) -> None: node_sleep_config_request = pw_requests.NodeSleepConfigRequest( self.dummy_fn, b"1111222233334444", - 5, # Duration in seconds the SED will be awake for receiving commands - 360, # Duration in minutes the SED will be in sleeping mode and not able to respond any command - 1440, # Interval in minutes the node will wake up and able to receive commands - False, # Enable/disable clock sync - 0, # Duration in minutes the node synchronize its clock + awake_duration=5, # Duration in seconds the SED will be awake for receiving commands + maintenance_interval=360, # Duration in minutes the SED will be in sleeping mode and not able to respond any command + sleep_duration=1440, # Interval in minutes the node will wake up and able to receive commands + sync_clock=False, # Enable/disable clock sync + clock_interval=0, # Duration in minutes the node synchronize its clock ) assert ( node_sleep_config_request.serialize()