Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ariston/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ async def async_connect(
self.api = AristonAPI(username, password, api_url, user_agent)
return await self.api.async_connect()

async def async_discover(self) -> Optional[list[dict[str, Any]]]:
async def async_discover(self) -> list[dict[str, Any]]:
"""Retreive ariston devices from the cloud"""
if self.api is None:
_LOGGER.exception("Call async_connect first")
return None
return []
cloud_devices = await _async_discover(self.api)
self.cloud_devices = cloud_devices
return cloud_devices
Expand Down
4 changes: 2 additions & 2 deletions ariston/ariston_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ def __request(
case 404:
return None
case 429:
content = response.content.read_nowait()
raise Exception(response.status, content)
content = response.content.decode()
raise Exception(response.status_code, content)
case _:
if not is_retry:
time.sleep(5)
Expand Down
10 changes: 5 additions & 5 deletions ariston/base_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
self.consumptions_sequences: list[dict[str, Any]] = list()
self.data: dict[str, Any] = dict()
self.consumption_sequence_last_changed_utc: dt.datetime = (
dt.datetime.utcfromtimestamp(0).replace(tzinfo=dt.timezone.utc)
dt.datetime.fromtimestamp(0, dt.UTC).replace(tzinfo=dt.timezone.utc)
)
self.gw: str = self.attributes.get(DeviceAttribute.GW, "")
self.bus_errors_list: list[dict[str, Any]] = []
Expand Down Expand Up @@ -318,7 +318,7 @@ def _set_energy_features(self):

def are_device_features_available(
self,
device_features: Optional[list[DeviceFeatures | CustomDeviceFeatures | DeviceAttribute]],
device_features: Optional[list[str]],
system_types: Optional[list[SystemType]],
whe_types: Optional[list[WheType]],
) -> bool:
Expand All @@ -332,9 +332,9 @@ def are_device_features_available(
if device_features is not None:
for device_feature in device_features:
if (
self.features.get(str(device_feature)) is not True
and self.custom_features.get(str(device_feature)) is not True
and self.attributes.get(str(device_feature)) is not True
self.features.get(device_feature) is not True
and self.custom_features.get(device_feature) is not True
and self.attributes.get(device_feature) is not True
):
return False

Expand Down
Loading