PySwitchbot 0.48.1__tar.gz → 0.49.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.48.1 → pyswitchbot-0.49.0}/PKG-INFO +1 -1
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/PySwitchbot.egg-info/PKG-INFO +1 -1
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/setup.py +1 -1
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parser.py +6 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/lock.py +2 -1
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/const.py +1 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/tests/test_adv_parser.py +92 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/LICENSE +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/MANIFEST.in +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/PySwitchbot.egg-info/SOURCES.txt +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/PySwitchbot.egg-info/dependency_links.txt +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/PySwitchbot.egg-info/requires.txt +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/PySwitchbot.egg-info/top_level.txt +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/README.md +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/setup.cfg +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/__init__.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/__init__.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/blind_tilt.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/bot.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/bulb.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/ceiling_light.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/contact.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/curtain.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/hub2.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/humidifier.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/light_strip.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/meter.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/motion.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/adv_parsers/plug.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/api_config.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/__init__.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/base_cover.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/base_light.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/blind_tilt.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/bot.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/bulb.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/ceiling_light.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/contact.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/curtain.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/device.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/humidifier.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/light_strip.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/lock.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/meter.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/motion.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/devices/plug.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/discovery.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/enum.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/switchbot/models.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/tests/test_base_cover.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/tests/test_blind_tilt.py +0 -0
- {pyswitchbot-0.48.1 → pyswitchbot-0.49.0}/tests/test_curtain.py +0 -0
|
@@ -101,6 +101,12 @@ SUPPORTED_TYPES: dict[str, SwitchbotSupportedType] = {
|
|
|
101
101
|
"func": process_wosensorth,
|
|
102
102
|
"manufacturer_id": 2409,
|
|
103
103
|
},
|
|
104
|
+
"4": {
|
|
105
|
+
"modelName": SwitchbotModel.METER_PRO,
|
|
106
|
+
"modelFriendlyName": "Meter",
|
|
107
|
+
"func": process_wosensorth,
|
|
108
|
+
"manufacturer_id": 2409,
|
|
109
|
+
},
|
|
104
110
|
"v": {
|
|
105
111
|
"modelName": SwitchbotModel.HUB2,
|
|
106
112
|
"modelFriendlyName": "Hub 2",
|
|
@@ -49,7 +49,8 @@ def process_wolock_pro(
|
|
|
49
49
|
"unclosed_alarm": bool(mfr_data[11] & 0b10000000),
|
|
50
50
|
"unlocked_alarm": bool(mfr_data[11] & 0b01000000),
|
|
51
51
|
"auto_lock_paused": bool(mfr_data[8] & 0b100000),
|
|
52
|
-
|
|
52
|
+
# Looks like night latch bit is not anymore in ADV
|
|
53
|
+
"night_latch": False,
|
|
53
54
|
}
|
|
54
55
|
_LOGGER.debug(res)
|
|
55
56
|
return res
|
|
@@ -1459,6 +1459,39 @@ def test_parsing_lock_pro_passive():
|
|
|
1459
1459
|
)
|
|
1460
1460
|
|
|
1461
1461
|
|
|
1462
|
+
def test_parsing_lock_pro_passive_nightlatch_disabled():
|
|
1463
|
+
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
1464
|
+
adv_data = generate_advertisement_data(
|
|
1465
|
+
manufacturer_data={2409: bytes.fromhex("aabbccddeeff0a8200630000")}, rssi=-67
|
|
1466
|
+
)
|
|
1467
|
+
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.LOCK_PRO)
|
|
1468
|
+
assert result == SwitchBotAdvertisement(
|
|
1469
|
+
address="aa:bb:cc:dd:ee:ff",
|
|
1470
|
+
data={
|
|
1471
|
+
"data": {
|
|
1472
|
+
"battery": None,
|
|
1473
|
+
"calibration": True,
|
|
1474
|
+
"status": LockStatus.LOCKED,
|
|
1475
|
+
"update_from_secondary_lock": False,
|
|
1476
|
+
"door_open": False,
|
|
1477
|
+
"double_lock_mode": False,
|
|
1478
|
+
"unclosed_alarm": False,
|
|
1479
|
+
"unlocked_alarm": False,
|
|
1480
|
+
"auto_lock_paused": False,
|
|
1481
|
+
"night_latch": False,
|
|
1482
|
+
},
|
|
1483
|
+
"model": "$",
|
|
1484
|
+
"isEncrypted": False,
|
|
1485
|
+
"modelFriendlyName": "Lock Pro",
|
|
1486
|
+
"modelName": SwitchbotModel.LOCK_PRO,
|
|
1487
|
+
"rawAdvData": None,
|
|
1488
|
+
},
|
|
1489
|
+
device=ble_device,
|
|
1490
|
+
rssi=-67,
|
|
1491
|
+
active=False,
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
|
|
1462
1495
|
def test_parsing_lock_active_old_firmware():
|
|
1463
1496
|
"""Test parsing lock with active data. Old firmware."""
|
|
1464
1497
|
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
@@ -1527,3 +1560,62 @@ def test_parsing_lock_passive_old_firmware():
|
|
|
1527
1560
|
rssi=-67,
|
|
1528
1561
|
active=False,
|
|
1529
1562
|
)
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
def test_meter_pro_active() -> None:
|
|
1566
|
+
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
1567
|
+
adv_data = generate_advertisement_data(
|
|
1568
|
+
manufacturer_data={2409: b"\xb0\xe9\xfeR\xdd\x84\x06d\x08\x97,\x00\x05"},
|
|
1569
|
+
service_data={"0000fd3d-0000-1000-8000-00805f9b34fb": b"4\x00d"},
|
|
1570
|
+
rssi=-67,
|
|
1571
|
+
)
|
|
1572
|
+
result = parse_advertisement_data(ble_device, adv_data)
|
|
1573
|
+
assert result == SwitchBotAdvertisement(
|
|
1574
|
+
address="aa:bb:cc:dd:ee:ff",
|
|
1575
|
+
data={
|
|
1576
|
+
"data": {
|
|
1577
|
+
"battery": 100,
|
|
1578
|
+
"fahrenheit": False,
|
|
1579
|
+
"humidity": 44,
|
|
1580
|
+
"temp": {"c": 23.8, "f": 74.84},
|
|
1581
|
+
"temperature": 23.8,
|
|
1582
|
+
},
|
|
1583
|
+
"isEncrypted": False,
|
|
1584
|
+
"model": "4",
|
|
1585
|
+
"modelFriendlyName": "Meter",
|
|
1586
|
+
"modelName": SwitchbotModel.METER_PRO,
|
|
1587
|
+
"rawAdvData": b"4\x00d",
|
|
1588
|
+
},
|
|
1589
|
+
device=ble_device,
|
|
1590
|
+
rssi=-67,
|
|
1591
|
+
active=True,
|
|
1592
|
+
)
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
def test_meter_pro_passive() -> None:
|
|
1596
|
+
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
1597
|
+
adv_data = generate_advertisement_data(
|
|
1598
|
+
manufacturer_data={2409: b"\xb0\xe9\xfeR\xdd\x84\x06d\x08\x97,\x00\x05"},
|
|
1599
|
+
rssi=-67,
|
|
1600
|
+
)
|
|
1601
|
+
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.METER_PRO)
|
|
1602
|
+
assert result == SwitchBotAdvertisement(
|
|
1603
|
+
address="aa:bb:cc:dd:ee:ff",
|
|
1604
|
+
data={
|
|
1605
|
+
"data": {
|
|
1606
|
+
"battery": None,
|
|
1607
|
+
"fahrenheit": False,
|
|
1608
|
+
"humidity": 44,
|
|
1609
|
+
"temp": {"c": 23.8, "f": 74.84},
|
|
1610
|
+
"temperature": 23.8,
|
|
1611
|
+
},
|
|
1612
|
+
"isEncrypted": False,
|
|
1613
|
+
"model": "4",
|
|
1614
|
+
"modelFriendlyName": "Meter",
|
|
1615
|
+
"modelName": SwitchbotModel.METER_PRO,
|
|
1616
|
+
"rawAdvData": None,
|
|
1617
|
+
},
|
|
1618
|
+
device=ble_device,
|
|
1619
|
+
rssi=-67,
|
|
1620
|
+
active=False,
|
|
1621
|
+
)
|
|
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
|