python-aidot 0.3.3__tar.gz → 0.3.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python-aidot
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: aidot control wifi lights
5
5
  Home-page: https://github.com/Aidot-Development-Team/python-aidot
6
6
  Author: aidotdev2024
@@ -1,5 +1,6 @@
1
1
  """The aidot integration."""
2
2
 
3
+ import asyncio
3
4
  import logging
4
5
  import base64
5
6
  import aiohttp
@@ -75,7 +76,6 @@ class AidotClient:
75
76
  self.country_name = country_name
76
77
  self.username = username
77
78
  self.password = password
78
- self.login_info = token.copy()
79
79
  self._device_clients = {}
80
80
  for item in SUPPORTED_COUNTRYS:
81
81
  if item["name"] == self.country_name:
@@ -83,6 +83,7 @@ class AidotClient:
83
83
  self._base_url = f"https://prod-{self._region}-api.arnoo.com/v17"
84
84
  break
85
85
  if token is not None:
86
+ self.login_info = token.copy()
86
87
  self.username = token[CONF_USERNAME]
87
88
  self.password = token[CONF_PASSWORD]
88
89
  self._region = token[CONF_REGION]
@@ -226,12 +227,13 @@ class AidotClient:
226
227
  if device_client is None:
227
228
  device_client = DeviceClient(device, self.login_info)
228
229
  self._device_clients[device_id] = device_client
230
+ asyncio.get_running_loop().create_task(device_client.ping_task())
229
231
  if self._discover is not None:
230
232
  ip = self._discover.discovered_device.get(device_id)
231
233
  device_client.update_ip_address(ip)
232
234
  return device_client
233
235
 
234
- async def start_discover(self) -> None:
236
+ def start_discover(self) -> None:
235
237
  if self._discover is not None:
236
238
  return
237
239
 
@@ -242,7 +244,7 @@ class AidotClient:
242
244
  device_client.update_ip_address(device_ip)
243
245
 
244
246
  self._discover = Discover(self.login_info, _discover_callback)
245
- await self._discover.repeat_broadcast()
247
+ asyncio.get_running_loop().create_task(self._discover.repeat_broadcast())
246
248
 
247
249
  def stop_discover(self) -> None:
248
250
  self._discover.close()
@@ -250,4 +252,6 @@ class AidotClient:
250
252
 
251
253
  def cleanup(self) -> None:
252
254
  self.stop_discover()
255
+ for client in self._device_clients.values():
256
+ asyncio.get_running_loop().create_task(client.close())
253
257
  self._device_clients.clear()
@@ -369,3 +369,4 @@ class DeviceClient(object):
369
369
  async def close(self):
370
370
  self._is_close = True
371
371
  await self.reset()
372
+ _LOGGER.info(f"{self.device_id} connect close by user")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python-aidot
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: aidot control wifi lights
5
5
  Home-page: https://github.com/Aidot-Development-Team/python-aidot
6
6
  Author: aidotdev2024
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="python-aidot",
8
- version="0.3.3",
8
+ version="0.3.4",
9
9
  author="aidotdev2024",
10
10
  url='https://github.com/Aidot-Development-Team/python-aidot',
11
11
  description="aidot control wifi lights",
File without changes
File without changes
File without changes