Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus committed Oct 27, 2023
1 parent 73111fc commit 2bdb1dd
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions zhaquirks/danfoss/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


from datetime import datetime
from typing import Callable, Any
from typing import Any, Callable

import zigpy.profiles.zha as zha_p
from zigpy.quirks import CustomCluster, CustomDevice
Expand Down Expand Up @@ -101,13 +101,24 @@ def combine_results(*result_lists):

return response

async def split_command(self, records: list[Any], func: Callable[[list[Any], ...], Any], extract_attrid: Callable[[Any], int], *args, **kwargs):
async def split_command(
self,
records: list[Any],
func: Callable[[list[Any], ...], Any],
extract_attrid: Callable[[Any], int],
*args,
**kwargs,
):
"""Configure reporting ZCL foundation command."""
records_specific = [
e for e in records if self.attributes[extract_attrid(e)].is_manufacturer_specific
e
for e in records
if self.attributes[extract_attrid(e)].is_manufacturer_specific
]
records_standard = [
e for e in records if not self.attributes[extract_attrid(e)].is_manufacturer_specific
e
for e in records
if not self.attributes[extract_attrid(e)].is_manufacturer_specific
]

result_specific = []
Expand All @@ -126,11 +137,15 @@ async def split_command(self, records: list[Any], func: Callable[[list[Any], ...

async def _configure_reporting(self, records, *args, **kwargs):
"""Configure reporting ZCL foundation command."""
return await self.split_command(records, super()._configure_reporting, lambda x: x.attrid, *args, **kwargs)
return await self.split_command(
records, super()._configure_reporting, lambda x: x.attrid, *args, **kwargs
)

async def _read_attributes(self, attr_ids, *args, **kwargs):
"""Read attributes ZCL foundation command."""
return await self.split_command(attr_ids, super()._read_attributes, lambda x: x, *args, **kwargs)
return await self.split_command(
attr_ids, super()._read_attributes, lambda x: x, *args, **kwargs
)


class DanfossThermostatCluster(CustomizedStandardCluster, Thermostat):
Expand Down

0 comments on commit 2bdb1dd

Please sign in to comment.