mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add fixture for waterleak sensor T300 (#897)
Fixture by courtesy of @ngaertner (https://github.com/python-kasa/python-kasa/issues/875#issuecomment-2091484438)
This commit is contained in:
parent
88381f270f
commit
530fb841b0
@ -109,7 +109,7 @@ DIMMERS = {
|
||||
}
|
||||
|
||||
HUBS_SMART = {"H100", "KH100"}
|
||||
SENSORS_SMART = {"T310", "T315"}
|
||||
SENSORS_SMART = {"T310", "T315", "T300"}
|
||||
THERMOSTATS_SMART = {"KE100"}
|
||||
|
||||
WITH_EMETER_IOT = {"HS110", "HS300", "KP115", "KP125", *BULBS_IOT}
|
||||
|
533
kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json
vendored
Normal file
533
kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json
vendored
Normal file
@ -0,0 +1,533 @@
|
||||
{
|
||||
"component_nego": {
|
||||
"component_list": [
|
||||
{
|
||||
"id": "device",
|
||||
"ver_code": 2
|
||||
},
|
||||
{
|
||||
"id": "quick_setup",
|
||||
"ver_code": 3
|
||||
},
|
||||
{
|
||||
"id": "trigger_log",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "time",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "device_local_time",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "account",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "synchronize",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "cloud_connect",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "iot_cloud",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "firmware",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "localSmart",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "battery_detect",
|
||||
"ver_code": 1
|
||||
},
|
||||
{
|
||||
"id": "sensor_alarm",
|
||||
"ver_code": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"get_connect_cloud_state": {
|
||||
"status": 0
|
||||
},
|
||||
"get_device_info": {
|
||||
"at_low_battery": false,
|
||||
"avatar": "sensor_t300",
|
||||
"battery_percentage": 100,
|
||||
"bind_count": 1,
|
||||
"category": "subg.trigger.water-leak-sensor",
|
||||
"device_id": "SCRUBBED_CHILD_DEVICE_ID_1",
|
||||
"fw_ver": "1.7.0 Build 230628 Rel.194748",
|
||||
"hw_id": "00000000000000000000000000000000",
|
||||
"hw_ver": "1.0",
|
||||
"in_alarm": false,
|
||||
"jamming_rssi": -120,
|
||||
"jamming_signal_level": 1,
|
||||
"lastOnboardingTimestamp": 1714661760,
|
||||
"mac": "98254A000000",
|
||||
"model": "T300",
|
||||
"nickname": "I01BU0tFRF9OQU1FIw==",
|
||||
"oem_id": "00000000000000000000000000000000",
|
||||
"parent_device_id": "0000000000000000000000000000000000000000",
|
||||
"region": "Europe/Berlin",
|
||||
"report_interval": 16,
|
||||
"rssi": -49,
|
||||
"signal_level": 3,
|
||||
"specs": "EU",
|
||||
"status": "online",
|
||||
"status_follow_edge": false,
|
||||
"type": "SMART.TAPOSENSOR",
|
||||
"water_leak_status": "normal"
|
||||
},
|
||||
"get_fw_download_state": {
|
||||
"cloud_cache_seconds": 1,
|
||||
"download_progress": 0,
|
||||
"reboot_time": 5,
|
||||
"status": 0,
|
||||
"upgrade_time": 5
|
||||
},
|
||||
"get_latest_fw": {
|
||||
"fw_size": 0,
|
||||
"fw_ver": "1.7.0 Build 230628 Rel.194748",
|
||||
"hw_id": "",
|
||||
"need_to_upgrade": false,
|
||||
"oem_id": "",
|
||||
"release_date": "",
|
||||
"release_note": "",
|
||||
"type": 0
|
||||
},
|
||||
"get_temp_humidity_records": {
|
||||
"local_time": 1714681045,
|
||||
"past24h_humidity": [
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000
|
||||
],
|
||||
"past24h_humidity_exception": [
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000
|
||||
],
|
||||
"past24h_temp": [
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000
|
||||
],
|
||||
"past24h_temp_exception": [
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000,
|
||||
-1000
|
||||
],
|
||||
"temp_unit": "celsius"
|
||||
},
|
||||
"get_trigger_logs": {
|
||||
"logs": [
|
||||
{
|
||||
"event": "waterDry",
|
||||
"eventId": "18a67996-611a-a7f9-5689-6699ee55806a",
|
||||
"id": 8,
|
||||
"timestamp": 1714680176
|
||||
},
|
||||
{
|
||||
"event": "waterLeak",
|
||||
"eventId": "4b43c78d-a832-7755-cc80-a6357cd88aa3",
|
||||
"id": 7,
|
||||
"timestamp": 1714680174
|
||||
},
|
||||
{
|
||||
"event": "waterDry",
|
||||
"eventId": "2a3731ba-7f1d-2c34-38be-f5580e2d3cbc",
|
||||
"id": 6,
|
||||
"timestamp": 1714680172
|
||||
},
|
||||
{
|
||||
"event": "waterLeak",
|
||||
"eventId": "eebb19c0-2cda-215c-62f5-be13cda215c6",
|
||||
"id": 5,
|
||||
"timestamp": 1714676832
|
||||
}
|
||||
],
|
||||
"start_id": 8,
|
||||
"sum": 4
|
||||
}
|
||||
}
|
@ -12,17 +12,17 @@ waterleak = parametrize(
|
||||
|
||||
@waterleak
|
||||
@pytest.mark.parametrize(
|
||||
"feature, type",
|
||||
"feature, prop_name, type",
|
||||
[
|
||||
("alert", int),
|
||||
("status", Enum),
|
||||
("water_alert", "alert", int),
|
||||
("water_leak", "status", Enum),
|
||||
],
|
||||
)
|
||||
async def test_waterleak_properties(dev, feature, type):
|
||||
async def test_waterleak_properties(dev, feature, prop_name, type):
|
||||
"""Test that features are registered and work as expected."""
|
||||
waterleak: WaterleakSensor = dev.modules["WaterleakSensor"]
|
||||
|
||||
prop = getattr(waterleak, feature)
|
||||
prop = getattr(waterleak, prop_name)
|
||||
assert isinstance(prop, type)
|
||||
|
||||
feat = waterleak._module_features[feature]
|
||||
|
Loading…
Reference in New Issue
Block a user