switchbot-api 2.1.0__tar.gz → 2.2.0__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.1
2
2
  Name: switchbot_api
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: An asynchronous library to use Switchbot API
5
5
  Home-page: https://github.com/SeraphicCorp/py-switchbot-api
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "switchbot_api"
3
- version = "2.1.0"
3
+ version = "2.2.0"
4
4
  description = "An asynchronous library to use Switchbot API"
5
5
  authors = ["Ravaka Razafimanantsoa <contact@ravaka.dev>"]
6
6
  license = "MIT"
@@ -1,14 +1,14 @@
1
1
  """Tools to query the SwitchBot API."""
2
2
 
3
3
  import base64
4
- from dataclasses import dataclass
5
- from enum import Enum
6
4
  import hashlib
7
5
  import hmac
8
6
  import logging
9
7
  import time
10
- from typing import TypeVar
11
8
  import uuid
9
+ from dataclasses import dataclass
10
+ from enum import Enum
11
+ from typing import TypeVar
12
12
 
13
13
  from aiohttp import ClientSession
14
14
 
@@ -229,7 +229,7 @@ class SwitchBotAPI:
229
229
  _LOGGER.error("Error %s: %s", response.status, body)
230
230
  raise CannotConnect()
231
231
 
232
- async def list_devices(self):
232
+ async def list_devices(self) -> list[Device | Remote]:
233
233
  """List devices."""
234
234
  body = await self._request("devices")
235
235
  _LOGGER.debug("Devices: %s", body)
@@ -264,7 +264,7 @@ class SwitchBotAPI:
264
264
  async def send_command(
265
265
  self,
266
266
  device_id: str,
267
- command: T,
267
+ command: T | str,
268
268
  command_type: str = "command",
269
269
  parameters: dict | str = "default",
270
270
  ):
@@ -272,7 +272,7 @@ class SwitchBotAPI:
272
272
 
273
273
  Args:
274
274
  device_id (str): The ID of the device.
275
- command (extends CommonCommands): The command to be sent.
275
+ command (string | extends CommonCommands): The command to be sent.
276
276
  command_type (str, optional): The type of the command. Defaults to "command".
277
277
  parameters (dict | str, optional): The parameters for the command. Defaults to "default".
278
278
 
@@ -285,7 +285,7 @@ class SwitchBotAPI:
285
285
  """
286
286
  json = {
287
287
  "commandType": command_type,
288
- "command": command.value,
288
+ "command": command if isinstance(command, Commands) else command,
289
289
  "parameter": parameters,
290
290
  }
291
291
  await self._request(f"devices/{device_id}/commands", callback="post", json=json)
File without changes
File without changes