From b830a26d5fecdbb2b464d9a3d008aa04c2ce1c07 Mon Sep 17 00:00:00 2001 From: Leyth <16468186+0xleyth@users.noreply.github.com> Date: Mon, 22 Apr 2024 02:57:32 -0700 Subject: [PATCH 1/4] Update switchbot_util.py My device settings: `{'battery': 94, 'firmware': 6.4, 'n_timers': 0, 'dual_state_mode': True, 'inverse_direction': True, 'hold_seconds': 0}` ` File "/usr/lib/python3.11/enum.py", line 717, in __call__ return cls.__new__(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/enum.py", line 1133, in __new__ raise ve_exc ValueError: 5 is not a valid ActionStatus` I did a little bit of research and came across: - 0x05 - Device does not support this Command --- switchbotpy/switchbot_util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/switchbotpy/switchbot_util.py b/switchbotpy/switchbot_util.py index 9ece639..9ea947b 100644 --- a/switchbotpy/switchbot_util.py +++ b/switchbotpy/switchbot_util.py @@ -13,6 +13,7 @@ def handle_notification(handle: int, value: bytes): class ActionStatus(Enum): complete = 1 device_busy = 3 + cmd_not_supported = 5 device_unreachable = 11 device_encrypted = 7 device_unencrypted = 8 @@ -26,6 +27,8 @@ def msg(self): msg = "action complete" elif self == ActionStatus.device_busy: msg = "switchbot is busy" + elif self == ActionStatus.cmd_not_supported: + msg = "Device does not support this Command" elif self == ActionStatus.device_unreachable: msg = "switchbot is unreachable" elif self == ActionStatus.device_encrypted: From c8098c41415a72343924d921143470ebdbca8588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=BCchler?= Date: Sun, 28 Jul 2024 23:25:29 +0200 Subject: [PATCH 2/4] switch to poetry --- pyproject.toml | 23 +++++++++++++++++++++++ setup.cfg | 2 -- setup.py | 29 ----------------------------- 3 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1739869 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ +[tool.poetry] +name = "switchbotpy" +version = "0.1.9" +description = "An API for Switchbots that allows to control actions, settings and timers (also password protected)" +authors = ["Nicolas Küchler "] +readme = "README.md" +license = {text = "MIT License"} +keywords = ["Switchbot", "Ble", "Button", "Actions", "Settings", "Timers"] +classifiers=[ + 'Development Status :: 3 - Alpha', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python', +], + +[tool.poetry.dependencies] +python = "^3.6" +pygatt = "^4.0.5" +pexpect = "^4.8.0" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 224a779..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -description-file = README.md \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 2320bfa..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -from setuptools import setup - -with open("README.md", "r") as fh: - long_description = fh.read() - -setup( - name='switchbotpy', - packages=['switchbotpy'], - version='0.1.7', - license='MIT', - description='An API for Switchbots that allows to control actions, settings and timers (also password protected)', - long_description=long_description, - long_description_content_type="text/markdown", - author='Nicolas Küchler', - author_email='nico.kuechler@protonmail.com', - url='https://github.com/RoButton/switchbotpy', - download_url='https://github.com/RoButton/switchbotpy/archive/v_017.tar.gz', - keywords=['Switchbot', 'Ble', 'Button', 'Actions', 'Settings', 'Timers'], - install_requires=['pygatt', 'pexpect'], - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Build Tools', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - ], -) From 5e3d459f93033cce7d19d099f5810217cabe1fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=BCchler?= Date: Sun, 28 Jul 2024 23:34:13 +0200 Subject: [PATCH 3/4] formatting fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1739869..07a7456 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ classifiers=[ 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', -], +] [tool.poetry.dependencies] python = "^3.6" From b3b03124604f11fc0b7d06eca38a723acfca8300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=BCchler?= Date: Sun, 28 Jul 2024 23:35:26 +0200 Subject: [PATCH 4/4] format fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 07a7456..dda7921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.9" description = "An API for Switchbots that allows to control actions, settings and timers (also password protected)" authors = ["Nicolas Küchler "] readme = "README.md" -license = {text = "MIT License"} +license = "MIT" keywords = ["Switchbot", "Ble", "Button", "Actions", "Settings", "Timers"] classifiers=[ 'Development Status :: 3 - Alpha',