Skip to content

Commit 85004b6

Browse files
authored
Merge pull request #57 from kzosabe/develop
Release 0.3.2
2 parents d28fa0c + 109a9f9 commit 85004b6

14 files changed

Lines changed: 886 additions & 335 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
0.3.2, 2022-02-03
2+
-------------------------
3+
4+
- Add new devices
5+
- Plug Mini, Strip Light, Meter Plus, Lock
6+
- Add pseudo status for remote devices
7+
- Now you can call status() on remote devices
8+
- It returns the value specified in the last change operation,
9+
which may or may not match the true state of the device
10+
111
0.3.1, 2021-11-27
212
-------------------------
313

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ DeviceStatus(device_id='ABCDE', device_type='Meter', device_name='Meter 0', hub_
107107
```
108108

109109
This function allows you to get the status of a device.
110-
Note that only physical devices can be targeted, not virtual infrared remote devices.
110+
Note that only the physical device returns accurate results, while the virtual infrared remote device is inaccurate,
111+
storing the results of the most recent operation.
111112

112113
Please refer to the following official document to know what kind of information can be obtained from each device.
113114

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
project = "switchbot-client"
66
copyright = "2021, kzosabe"
77
author = "kzosabe"
8-
release = "0.3.1"
8+
release = "0.3.2"
99
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"]
1010
templates_path = ["_templates"]
1111
exclude_patterns = ["_build", ".DS_Store"]

poetry.lock

Lines changed: 114 additions & 191 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "switchbot-client"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "A Python client library for SwitchBot API."
55
license = "Apache-2.0 or MIT"
66
authors = [
@@ -29,13 +29,13 @@ typing-extensions = ">=3.10,<5.0"
2929
black = ">=20.8b1"
3030
flake8 = "^4.0.1"
3131
isort = "^5.9.3"
32-
mypy = "^0.910"
33-
pylint = "^2.12.1"
32+
mypy = "^0.931"
33+
pylint = "^2.12.2"
3434
pytest = "^6.2.5"
3535
pytest-cov = "^3.0.0"
36-
pytest-mock = "^3.6.1"
37-
tox = "^3.24.4"
38-
Sphinx = "^4.3.1"
36+
pytest-mock = "^3.7.0"
37+
tox = "^3.24.5"
38+
Sphinx = "^4.3.2"
3939

4040
[build-system]
4141
requires = ["poetry_core>=1.0.0"]

switchbot_client/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
class AppConstants:
2-
VERSION = "0.3.1"
2+
VERSION = "0.3.2"

switchbot_client/devices/base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
from __future__ import annotations
22

3-
from abc import ABC
3+
from abc import ABC, abstractmethod
44
from dataclasses import dataclass
55
from typing import TYPE_CHECKING, Optional
66

77
if TYPE_CHECKING:
88
from switchbot_client import SwitchBotClient
9+
from switchbot_client.devices import DeviceStatus
910

1011

1112
@dataclass()
12-
class SwitchBotDevice(ABC):
13+
class SwitchBotDeviceBase:
1314
client: SwitchBotClient
1415
device_id: str
1516
device_type: str
@@ -27,6 +28,8 @@ def __post_init__(self):
2728
if self.hub_device_id in ["FFFFFFFFFFFF", "000000000000"]:
2829
self.hub_device_id = None
2930

31+
32+
class SwitchBotDevice(ABC, SwitchBotDeviceBase):
3033
def command(
3134
self, command: str, parameter: str = None, command_type: str = None
3235
) -> SwitchBotCommandResult:
@@ -35,6 +38,10 @@ def command(
3538
)
3639
return SwitchBotCommandResult(response.status_code, response.message, response.body)
3740

41+
@abstractmethod
42+
def status(self) -> DeviceStatus:
43+
pass
44+
3845
def __repr__(self):
3946
data = {
4047
"device_id": self.device_id,

0 commit comments

Comments
 (0)