PySwitchbot 0.52.0__tar.gz → 0.53.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.
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PKG-INFO +1 -1
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PySwitchbot.egg-info/PKG-INFO +1 -1
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PySwitchbot.egg-info/SOURCES.txt +2 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/setup.py +1 -1
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parser.py +9 -2
- pyswitchbot-0.53.0/switchbot/adv_parsers/keypad.py +22 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/const.py +4 -2
- pyswitchbot-0.53.0/switchbot/devices/motion.py +1 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/relay_switch.py +1 -1
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/discovery.py +4 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/tests/test_adv_parser.py +25 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/LICENSE +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/MANIFEST.in +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PySwitchbot.egg-info/dependency_links.txt +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PySwitchbot.egg-info/requires.txt +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/PySwitchbot.egg-info/top_level.txt +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/README.md +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/setup.cfg +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/__init__.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/__init__.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/blind_tilt.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/bot.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/bulb.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/ceiling_light.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/contact.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/curtain.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/hub2.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/humidifier.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/light_strip.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/lock.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/meter.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/motion.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/plug.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/adv_parsers/relay_switch.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/api_config.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/__init__.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/base_cover.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/base_light.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/blind_tilt.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/bot.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/bulb.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/ceiling_light.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/contact.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/curtain.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/device.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/humidifier.py +0 -0
- /pyswitchbot-0.52.0/switchbot/devices/meter.py → /pyswitchbot-0.53.0/switchbot/devices/keypad.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/light_strip.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/lock.py +0 -0
- /pyswitchbot-0.52.0/switchbot/devices/motion.py → /pyswitchbot-0.53.0/switchbot/devices/meter.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/devices/plug.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/enum.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/switchbot/models.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/tests/test_base_cover.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/tests/test_blind_tilt.py +0 -0
- {pyswitchbot-0.52.0 → pyswitchbot-0.53.0}/tests/test_curtain.py +0 -0
|
@@ -23,6 +23,7 @@ switchbot/adv_parsers/contact.py
|
|
|
23
23
|
switchbot/adv_parsers/curtain.py
|
|
24
24
|
switchbot/adv_parsers/hub2.py
|
|
25
25
|
switchbot/adv_parsers/humidifier.py
|
|
26
|
+
switchbot/adv_parsers/keypad.py
|
|
26
27
|
switchbot/adv_parsers/light_strip.py
|
|
27
28
|
switchbot/adv_parsers/lock.py
|
|
28
29
|
switchbot/adv_parsers/meter.py
|
|
@@ -40,6 +41,7 @@ switchbot/devices/contact.py
|
|
|
40
41
|
switchbot/devices/curtain.py
|
|
41
42
|
switchbot/devices/device.py
|
|
42
43
|
switchbot/devices/humidifier.py
|
|
44
|
+
switchbot/devices/keypad.py
|
|
43
45
|
switchbot/devices/light_strip.py
|
|
44
46
|
switchbot/devices/lock.py
|
|
45
47
|
switchbot/devices/meter.py
|
|
@@ -18,6 +18,7 @@ from .adv_parsers.contact import process_wocontact
|
|
|
18
18
|
from .adv_parsers.curtain import process_wocurtain
|
|
19
19
|
from .adv_parsers.hub2 import process_wohub2
|
|
20
20
|
from .adv_parsers.humidifier import process_wohumidifier
|
|
21
|
+
from .adv_parsers.keypad import process_wokeypad
|
|
21
22
|
from .adv_parsers.light_strip import process_wostrip
|
|
22
23
|
from .adv_parsers.lock import process_wolock, process_wolock_pro
|
|
23
24
|
from .adv_parsers.meter import process_wosensorth, process_wosensorth_c
|
|
@@ -177,14 +178,20 @@ SUPPORTED_TYPES: dict[str, SwitchbotSupportedType] = {
|
|
|
177
178
|
"func": process_woblindtilt,
|
|
178
179
|
"manufacturer_id": 2409,
|
|
179
180
|
},
|
|
181
|
+
"y": {
|
|
182
|
+
"modelName": SwitchbotModel.KEYPAD,
|
|
183
|
+
"modelFriendlyName": "Keypad",
|
|
184
|
+
"func": process_wokeypad,
|
|
185
|
+
"manufacturer_id": 2409,
|
|
186
|
+
},
|
|
180
187
|
"<": {
|
|
181
|
-
"modelName": SwitchbotModel.
|
|
188
|
+
"modelName": SwitchbotModel.RELAY_SWITCH_1PM,
|
|
182
189
|
"modelFriendlyName": "Relay Switch 1PM",
|
|
183
190
|
"func": process_worelay_switch_1pm,
|
|
184
191
|
"manufacturer_id": 2409,
|
|
185
192
|
},
|
|
186
193
|
";": {
|
|
187
|
-
"modelName": SwitchbotModel.
|
|
194
|
+
"modelName": SwitchbotModel.RELAY_SWITCH_1_PLUS,
|
|
188
195
|
"modelFriendlyName": "Relay Switch 1",
|
|
189
196
|
"func": process_worelay_switch_1plus,
|
|
190
197
|
"manufacturer_id": 2409,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Keypad parser."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
_LOGGER = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def process_wokeypad(
|
|
11
|
+
data: bytes | None,
|
|
12
|
+
mfr_data: bytes | None,
|
|
13
|
+
) -> dict[str, bool | int | None]:
|
|
14
|
+
"""Process woKeypad services data."""
|
|
15
|
+
if data is None or mfr_data is None:
|
|
16
|
+
return {"battery": None, "attempt_state": None}
|
|
17
|
+
|
|
18
|
+
_LOGGER.debug("mfr_data: %s", mfr_data.hex())
|
|
19
|
+
if data:
|
|
20
|
+
_LOGGER.debug("data: %s", data.hex())
|
|
21
|
+
|
|
22
|
+
return {"battery": data[2] & 0b01111111, "attempt_state": mfr_data[6]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Library to handle connection with Switchbot."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
from enum import Enum
|
|
@@ -52,8 +53,9 @@ class SwitchbotModel(StrEnum):
|
|
|
52
53
|
LOCK_PRO = "WoLockPro"
|
|
53
54
|
BLIND_TILT = "WoBlindTilt"
|
|
54
55
|
HUB2 = "WoHub2"
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
KEYPAD = "WoKeypad"
|
|
57
|
+
RELAY_SWITCH_1PM = "Relay Switch 1PM"
|
|
58
|
+
RELAY_SWITCH_1_PLUS = "Relay Switch 1"
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
class LockStatus(Enum):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
@@ -25,7 +25,7 @@ class SwitchbotRelaySwitch(SwitchbotSequenceDevice):
|
|
|
25
25
|
key_id: str,
|
|
26
26
|
encryption_key: str,
|
|
27
27
|
interface: int = 0,
|
|
28
|
-
model: SwitchbotModel = SwitchbotModel.
|
|
28
|
+
model: SwitchbotModel = SwitchbotModel.RELAY_SWITCH_1PM,
|
|
29
29
|
**kwargs: Any,
|
|
30
30
|
) -> None:
|
|
31
31
|
if len(key_id) == 0:
|
|
@@ -124,6 +124,10 @@ class GetSwitchbotDevices:
|
|
|
124
124
|
lock_pros = await self._get_devices_by_model("$")
|
|
125
125
|
return {**locks, **lock_pros}
|
|
126
126
|
|
|
127
|
+
async def get_keypads(self) -> dict[str, SwitchBotAdvertisement]:
|
|
128
|
+
"""Return all WoKeypad/Keypad devices with services data."""
|
|
129
|
+
return await self._get_devices_by_model("y")
|
|
130
|
+
|
|
127
131
|
async def get_device_data(
|
|
128
132
|
self, address: str
|
|
129
133
|
) -> dict[str, SwitchBotAdvertisement] | None:
|
|
@@ -1647,3 +1647,28 @@ def test_meter_pro_c_passive() -> None:
|
|
|
1647
1647
|
rssi=-67,
|
|
1648
1648
|
active=False,
|
|
1649
1649
|
)
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
def test_parse_advertisement_data_keypad():
|
|
1653
|
+
"""Test parse_advertisement_data for the keypad."""
|
|
1654
|
+
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
1655
|
+
adv_data = generate_advertisement_data(
|
|
1656
|
+
manufacturer_data={2409: b"\xeb\x13\x02\xe6#\x0f\x8fd\x00\x00\x00\x00"},
|
|
1657
|
+
service_data={"0000fd3d-0000-1000-8000-00805f9b34fb": b"y\x00d"},
|
|
1658
|
+
rssi=-67,
|
|
1659
|
+
)
|
|
1660
|
+
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.KEYPAD)
|
|
1661
|
+
assert result == SwitchBotAdvertisement(
|
|
1662
|
+
address="aa:bb:cc:dd:ee:ff",
|
|
1663
|
+
data={
|
|
1664
|
+
"data": {"attempt_state": 143, "battery": 100},
|
|
1665
|
+
"isEncrypted": False,
|
|
1666
|
+
"model": "y",
|
|
1667
|
+
"modelFriendlyName": "Keypad",
|
|
1668
|
+
"modelName": SwitchbotModel.KEYPAD,
|
|
1669
|
+
"rawAdvData": b"y\x00d",
|
|
1670
|
+
},
|
|
1671
|
+
device=ble_device,
|
|
1672
|
+
rssi=-67,
|
|
1673
|
+
active=True,
|
|
1674
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/pyswitchbot-0.52.0/switchbot/devices/meter.py → /pyswitchbot-0.53.0/switchbot/devices/keypad.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/pyswitchbot-0.52.0/switchbot/devices/motion.py → /pyswitchbot-0.53.0/switchbot/devices/meter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|