PySwitchbot 0.55.1__tar.gz → 0.55.3__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.55.1 → pyswitchbot-0.55.3}/PKG-INFO +1 -1
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/PySwitchbot.egg-info/PKG-INFO +1 -1
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/setup.py +1 -1
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parser.py +1 -1
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/device.py +2 -2
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/discovery.py +4 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/tests/test_adv_parser.py +37 -5
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/LICENSE +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/MANIFEST.in +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/PySwitchbot.egg-info/SOURCES.txt +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/PySwitchbot.egg-info/dependency_links.txt +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/PySwitchbot.egg-info/requires.txt +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/PySwitchbot.egg-info/top_level.txt +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/README.md +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/setup.cfg +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/__init__.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/__init__.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/blind_tilt.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/bot.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/bulb.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/ceiling_light.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/contact.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/curtain.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/hub2.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/humidifier.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/keypad.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/leak.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/light_strip.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/lock.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/meter.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/motion.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/plug.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/adv_parsers/relay_switch.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/api_config.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/const.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/__init__.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/base_cover.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/base_light.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/blind_tilt.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/bot.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/bulb.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/ceiling_light.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/contact.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/curtain.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/humidifier.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/keypad.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/light_strip.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/lock.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/meter.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/motion.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/plug.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/devices/relay_switch.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/enum.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/switchbot/models.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/tests/test_base_cover.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/tests/test_blind_tilt.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/tests/test_curtain.py +0 -0
- {pyswitchbot-0.55.1 → pyswitchbot-0.55.3}/tests/test_relay_switch.py +0 -0
|
@@ -815,13 +815,13 @@ class SwitchbotEncryptedDevice(SwitchbotDevice):
|
|
|
815
815
|
**kwargs: Any,
|
|
816
816
|
) -> bool:
|
|
817
817
|
try:
|
|
818
|
-
|
|
818
|
+
switchbot_device = cls(
|
|
819
819
|
device, key_id=key_id, encryption_key=encryption_key, model=model
|
|
820
820
|
)
|
|
821
821
|
except ValueError:
|
|
822
822
|
return False
|
|
823
823
|
try:
|
|
824
|
-
info = await
|
|
824
|
+
info = await switchbot_device.get_basic_info()
|
|
825
825
|
except SwitchbotOperationError:
|
|
826
826
|
return False
|
|
827
827
|
|
|
@@ -118,6 +118,10 @@ class GetSwitchbotDevices:
|
|
|
118
118
|
"""Return all WoContact/Contact sensor devices with services data."""
|
|
119
119
|
return await self._get_devices_by_model("d")
|
|
120
120
|
|
|
121
|
+
async def get_leakdetectors(self) -> dict[str, SwitchBotAdvertisement]:
|
|
122
|
+
"""Return all Leak Detectors with services data."""
|
|
123
|
+
return await self._get_devices_by_model("&")
|
|
124
|
+
|
|
121
125
|
async def get_locks(self) -> dict[str, SwitchBotAdvertisement]:
|
|
122
126
|
"""Return all WoLock/Locks devices with services data."""
|
|
123
127
|
locks = await self._get_devices_by_model("o")
|
|
@@ -1758,7 +1758,7 @@ def test_leak_active():
|
|
|
1758
1758
|
"low_battery": False,
|
|
1759
1759
|
},
|
|
1760
1760
|
"isEncrypted": False,
|
|
1761
|
-
"model": "
|
|
1761
|
+
"model": "&",
|
|
1762
1762
|
"modelFriendlyName": "Leak Detector",
|
|
1763
1763
|
"modelName": SwitchbotModel.LEAK,
|
|
1764
1764
|
"rawAdvData": b"&\x00N",
|
|
@@ -1782,7 +1782,7 @@ def test_leak_passive():
|
|
|
1782
1782
|
data={
|
|
1783
1783
|
"data": {},
|
|
1784
1784
|
"isEncrypted": False,
|
|
1785
|
-
"model": "
|
|
1785
|
+
"model": "&",
|
|
1786
1786
|
"rawAdvData": None,
|
|
1787
1787
|
},
|
|
1788
1788
|
device=ble_device,
|
|
@@ -1812,7 +1812,7 @@ def test_leak_no_leak_detected():
|
|
|
1812
1812
|
"low_battery": False,
|
|
1813
1813
|
},
|
|
1814
1814
|
"isEncrypted": False,
|
|
1815
|
-
"model": "
|
|
1815
|
+
"model": "&",
|
|
1816
1816
|
"modelFriendlyName": "Leak Detector",
|
|
1817
1817
|
"modelName": SwitchbotModel.LEAK,
|
|
1818
1818
|
"rawAdvData": b"&\x00d",
|
|
@@ -1844,7 +1844,7 @@ def test_leak_leak_detected():
|
|
|
1844
1844
|
"low_battery": False,
|
|
1845
1845
|
},
|
|
1846
1846
|
"isEncrypted": False,
|
|
1847
|
-
"model": "
|
|
1847
|
+
"model": "&",
|
|
1848
1848
|
"modelFriendlyName": "Leak Detector",
|
|
1849
1849
|
"modelName": SwitchbotModel.LEAK,
|
|
1850
1850
|
"rawAdvData": b"&\x00d",
|
|
@@ -1876,7 +1876,7 @@ def test_leak_low_battery():
|
|
|
1876
1876
|
"low_battery": False,
|
|
1877
1877
|
},
|
|
1878
1878
|
"isEncrypted": False,
|
|
1879
|
-
"model": "
|
|
1879
|
+
"model": "&",
|
|
1880
1880
|
"modelFriendlyName": "Leak Detector",
|
|
1881
1881
|
"modelName": SwitchbotModel.LEAK,
|
|
1882
1882
|
"rawAdvData": b"&\x00d",
|
|
@@ -1885,3 +1885,35 @@ def test_leak_low_battery():
|
|
|
1885
1885
|
rssi=-73,
|
|
1886
1886
|
active=True,
|
|
1887
1887
|
)
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
def test_leak_real_data_from_ha():
|
|
1891
|
+
"""Test parse_advertisement_data for the leak detector."""
|
|
1892
|
+
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "Any")
|
|
1893
|
+
adv_data = generate_advertisement_data(
|
|
1894
|
+
manufacturer_data={
|
|
1895
|
+
2409: b"\\xd6407D1\\x02V\\x90\\x00\\x00\\x00\\x00\\x1e\\x05\\x00\\x00\\x00\\x00"
|
|
1896
|
+
}, # no leak, low battery
|
|
1897
|
+
service_data={"0000fd3d-0000-1000-8000-00805f9b34fb": b"&\\x00V"},
|
|
1898
|
+
rssi=-73,
|
|
1899
|
+
)
|
|
1900
|
+
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.LEAK)
|
|
1901
|
+
assert result == SwitchBotAdvertisement(
|
|
1902
|
+
address="aa:bb:cc:dd:ee:ff",
|
|
1903
|
+
data={
|
|
1904
|
+
"data": {
|
|
1905
|
+
"leak": True,
|
|
1906
|
+
"tampered": False,
|
|
1907
|
+
"battery": 68,
|
|
1908
|
+
"low_battery": False,
|
|
1909
|
+
},
|
|
1910
|
+
"isEncrypted": False,
|
|
1911
|
+
"model": "&",
|
|
1912
|
+
"modelFriendlyName": "Leak Detector",
|
|
1913
|
+
"modelName": SwitchbotModel.LEAK,
|
|
1914
|
+
"rawAdvData": b"&\\x00V",
|
|
1915
|
+
},
|
|
1916
|
+
device=ble_device,
|
|
1917
|
+
rssi=-73,
|
|
1918
|
+
active=True,
|
|
1919
|
+
)
|
|
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
|
|
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
|