From 5eef2a443a3bb4fdd3c6f13fa0080f976f313c35 Mon Sep 17 00:00:00 2001 From: SukramJ Date: Mon, 19 Aug 2024 16:09:22 +0200 Subject: [PATCH] Cleanup --- hahomematic/client/__init__.py | 31 +++++++++++++++---------------- hahomematic/platforms/device.py | 4 +++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/hahomematic/client/__init__.py b/hahomematic/client/__init__.py index d5c54cd5..31516f4c 100644 --- a/hahomematic/client/__init__.py +++ b/hahomematic/client/__init__.py @@ -607,20 +607,19 @@ async def get_paramset_descriptions( paramsets[address] = {} _LOGGER.debug("GET_PARAMSET_DESCRIPTIONS for %s", address) for paramset_key in device_description.get(Description.PARAMSETS, []): - channel_no = get_channel_no(address) - device_type = ( - device_description[Description.TYPE] - if channel_no is None - else device_description[Description.PARENT_TYPE] - ) - if not ( - self.central.config.load_all_paramset_descriptions or load_all - ) and not self.central.parameter_visibility.is_relevant_paramset( - device_type=device_type, - channel_no=channel_no, - paramset_key=paramset_key, - ): - continue + if not (self.central.config.load_all_paramset_descriptions or load_all): + channel_no = get_channel_no(address) + device_type = ( + device_description[Description.TYPE] + if channel_no is None + else device_description[Description.PARENT_TYPE] + ) + if not self.central.parameter_visibility.is_relevant_paramset( + device_type=device_type, + channel_no=channel_no, + paramset_key=paramset_key, + ): + continue if paramset_description := await self._get_paramset_description( address=address, paramset_key=paramset_key ): @@ -712,7 +711,7 @@ async def update_paramset_descriptions(self, device_address: str) -> None: ) return await self.fetch_paramset_descriptions( - self.central.device_descriptions.get_device( + device_description=self.central.device_descriptions.get_device( interface_id=self.interface_id, device_address=device_address ) ) @@ -783,7 +782,7 @@ async def check_connection_availability(self, handle_ping_pong: bool) -> bool: if handle_ping_pong and self.supports_ping_pong: self._ping_pong_cache.handle_send_ping(ping_ts=dt_now) calllerId = ( - f"{self.interface_id}#{dt_now.strftime(DATETIME_FORMAT_MILLIS)}" + f"{self.interface_id}#{dt_now.strftime(format=DATETIME_FORMAT_MILLIS)}" if handle_ping_pong else self.interface_id ) diff --git a/hahomematic/platforms/device.py b/hahomematic/platforms/device.py index f3802663..dbcc391c 100644 --- a/hahomematic/platforms/device.py +++ b/hahomematic/platforms/device.py @@ -801,7 +801,9 @@ async def export_data(self) -> None: ) paramset_descriptions: Mapping[ str, Any - ] = await self._client.get_all_paramset_descriptions(tuple(device_descriptions.values())) + ] = await self._client.get_all_paramset_descriptions( + device_descriptions=tuple(device_descriptions.values()) + ) device_type = device_descriptions[self._device_address][Description.TYPE] filename = f"{device_type}.json"