aioamazondevices 6.4.5__tar.gz → 6.4.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aioamazondevices might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioamazondevices
3
- Version: 6.4.5
3
+ Version: 6.4.6
4
4
  Summary: Python library to control Amazon devices
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aioamazondevices"
3
- version = "6.4.5"
3
+ version = "6.4.6"
4
4
  requires-python = ">=3.12"
5
5
  description = "Python library to control Amazon devices"
6
6
  authors = [
@@ -1,6 +1,6 @@
1
1
  """aioamazondevices library."""
2
2
 
3
- __version__ = "6.4.5"
3
+ __version__ = "6.4.6"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
@@ -943,8 +943,13 @@ class AmazonEchoApi:
943
943
  await self._get_base_devices()
944
944
  self._last_devices_refresh = datetime.now(UTC)
945
945
 
946
+ # Only refresh endpoint data if we have no endpoints yet
946
947
  delta_endpoints = datetime.now(UTC) - self._last_endpoint_refresh
947
- if delta_endpoints >= timedelta(minutes=30):
948
+ endpoint_refresh_needed = delta_endpoints >= timedelta(days=1)
949
+ endpoints_recently_checked = delta_endpoints < timedelta(minutes=30)
950
+ if (
951
+ not self._endpoints and not endpoints_recently_checked
952
+ ) or endpoint_refresh_needed:
948
953
  _LOGGER.debug(
949
954
  "Refreshing endpoint data after %s",
950
955
  str(timedelta(minutes=round(delta_endpoints.total_seconds() / 60))),
@@ -972,6 +977,7 @@ class AmazonEchoApi:
972
977
  device.sensors["dnd"] = device_dnd
973
978
 
974
979
  async def _set_device_endpoints_data(self) -> None:
980
+ """Set device endpoint data."""
975
981
  devices_endpoints = await self._get_devices_endpoint_data()
976
982
  for serial_number in self._final_devices:
977
983
  device_endpoint = devices_endpoints.get(serial_number, {})