Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ At the moment, the following devices have been confirmed to work:
* Tapo P300
* Tapo TP25

#### Hubs

* Tapo H100

### Newer Kasa branded devices

Expand Down
5 changes: 4 additions & 1 deletion devtools/dump_devinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def scrub(res):
"alias",
"bssid",
"channel",
"original_device_id", # for child devices
"original_device_id", # for child devices on strips
"parent_device_id", # for hub children
"setup_code", # matter
"setup_payload", # matter
]

for k, v in res.items():
Expand Down
11 changes: 10 additions & 1 deletion devtools/helpers/smartrequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def get_component_requests(component_id, ver_code):
"energy_monitoring": SmartRequest.energy_monitoring_list(),
"power_protection": SmartRequest.power_protection_list(),
"current_protection": [], # overcurrent in device_info
"matter": [],
"matter": [SmartRequest.get_raw_request("get_matter_setup_info")],
"preset": [SmartRequest.get_preset_rules()],
"brightness": [], # in device_info
"color": [], # in device_info
Expand All @@ -372,4 +372,13 @@ def get_component_requests(component_id, ver_code):
"music_rhythm": [], # music_rhythm_enable in device_info
"segment": [SmartRequest.get_raw_request("get_device_segment")],
"segment_effect": [SmartRequest.get_raw_request("get_segment_effect_rule")],
"device_load": [SmartRequest.get_raw_request("get_device_load_info")],
"child_quick_setup": [
SmartRequest.get_raw_request("get_support_child_device_category")
],
"alarm": [
SmartRequest.get_raw_request("get_support_alarm_type_list"),
SmartRequest.get_raw_request("get_alarm_configure"),
],
"alarm_logs": [SmartRequest.get_raw_request("get_alarm_triggers")],
}
2 changes: 1 addition & 1 deletion kasa/smart/modules/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ def auto_update_enabled(self):
async def set_auto_update_enabled(self, enabled: bool):
"""Change autoupdate setting."""
data = {**self.data["get_auto_update_info"], "enable": enabled}
await self.call("set_auto_update_info", data) #{"enable": enabled})
await self.call("set_auto_update_info", data) # {"enable": enabled})
12 changes: 11 additions & 1 deletion kasa/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
*DIMMERS_SMART,
}

HUBS_SMART = {"H100"}

WITH_EMETER_IOT = {"HS110", "HS300", "KP115", "KP125", *BULBS_IOT}
WITH_EMETER_SMART = {"P110", "KP125M", "EP25"}
WITH_EMETER = {*WITH_EMETER_IOT, *WITH_EMETER_SMART}
Expand All @@ -134,7 +136,10 @@

ALL_DEVICES_IOT = BULBS_IOT.union(PLUGS_IOT).union(STRIPS_IOT).union(DIMMERS_IOT)
ALL_DEVICES_SMART = (
BULBS_SMART.union(PLUGS_SMART).union(STRIPS_SMART).union(DIMMERS_SMART)
BULBS_SMART.union(PLUGS_SMART)
.union(STRIPS_SMART)
.union(DIMMERS_SMART)
.union(HUBS_SMART)
)
ALL_DEVICES = ALL_DEVICES_IOT.union(ALL_DEVICES_SMART)

Expand Down Expand Up @@ -257,6 +262,7 @@ def parametrize(desc, devices, protocol_filter=None, ids=None):
dimmers_smart = parametrize(
"dimmer devices smart", DIMMERS_SMART, protocol_filter={"SMART"}
)
hubs_smart = parametrize("hubs smart", HUBS_SMART, protocol_filter={"SMART"})
device_smart = parametrize(
"devices smart", ALL_DEVICES_SMART, protocol_filter={"SMART"}
)
Expand Down Expand Up @@ -318,6 +324,7 @@ def check_categories():
+ plug_smart.args[1]
+ bulb_smart.args[1]
+ dimmers_smart.args[1]
+ hubs_smart.args[1]
)
diff = set(SUPPORTED_DEVICES) - set(categorized_fixtures)
if diff:
Expand Down Expand Up @@ -355,6 +362,9 @@ def device_for_file(model, protocol):
for d in STRIPS_SMART:
if d in model:
return SmartDevice
for d in HUBS_SMART:
if d in model:
return SmartDevice
else:
for d in STRIPS_IOT:
if d in model:
Expand Down
16 changes: 16 additions & 0 deletions kasa/tests/fakeprotocol_smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ def credentials_hash(self):
"firmware",
{"enable": True, "random_range": 120, "time": 180},
),
"get_alarm_configure": (
"alarm",
{
"get_alarm_configure": {
"duration": 10,
"type": "Doorbell Ring 2",
"volume": "low",
}
},
),
"get_support_alarm_type_list": ("alarm", {
"alarm_type_list": [
"Doorbell Ring 1",
]
}),
"get_device_usage": ("device", {}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The out-of-the-box fw didn't apparently respond to this, but the currently installed one returns just {}.

}

async def send(self, request: str):
Expand Down
221 changes: 221 additions & 0 deletions kasa/tests/fixtures/smart/H100(EU)_1.0_1.2.3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"component_nego": {
"component_list": [
{
"id": "device",
"ver_code": 2
},
{
"id": "firmware",
"ver_code": 2
},
{
"id": "quick_setup",
"ver_code": 3
},
{
"id": "inherit",
"ver_code": 1
},
{
"id": "time",
"ver_code": 1
},
{
"id": "wireless",
"ver_code": 1
},
{
"id": "account",
"ver_code": 1
},
{
"id": "synchronize",
"ver_code": 1
},
{
"id": "sunrise_sunset",
"ver_code": 1
},
{
"id": "led",
"ver_code": 1
},
{
"id": "cloud_connect",
"ver_code": 1
},
{
"id": "iot_cloud",
"ver_code": 1
},
{
"id": "child_device",
"ver_code": 1
},
{
"id": "child_quick_setup",
"ver_code": 1
},
{
"id": "child_inherit",
"ver_code": 1
},
{
"id": "control_child",
"ver_code": 1
},
{
"id": "alarm",
"ver_code": 1
},
{
"id": "device_load",
"ver_code": 1
},
{
"id": "device_local_time",
"ver_code": 1
},
{
"id": "alarm_logs",
"ver_code": 1
}
]
},
"discovery_result": {
"device_id": "00000000000000000000000000000000",
"device_model": "H100(EU)",
"device_type": "SMART.TAPOHUB",
"factory_default": true,
"ip": "127.0.0.123",
"is_support_iot_cloud": true,
"mac": "3C-52-A1-00-00-00",
"mgt_encrypt_schm": {
"encrypt_type": "AES",
"http_port": 80,
"is_support_https": false,
"lv": 2
},
"obd_src": "tplink",
"owner": ""
},
"get_auto_update_info": {
"enable": true,
"random_range": 120,
"time": 180
},
"get_child_device_component_list": {
"child_component_list": [],
"start_index": 0,
"sum": 0
},
"get_child_device_list": {
"child_device_list": [],
"start_index": 0,
"sum": 0
},
"get_connect_cloud_state": {
"status": 1
},
"get_device_info": {
"avatar": "",
"device_id": "0000000000000000000000000000000000000000",
"fw_id": "00000000000000000000000000000000",
"fw_ver": "1.2.3 Build 221012 Rel.103821",
"has_set_location_info": false,
"hw_id": "00000000000000000000000000000000",
"hw_ver": "1.0",
"in_alarm": false,
"in_alarm_source": "",
"ip": "127.0.0.123",
"lang": "",
"latitude": 0,
"longitude": 0,
"mac": "3C-52-A1-00-00-00",
"model": "H100",
"nickname": "I01BU0tFRF9OQU1FIw==",
"oem_id": "00000000000000000000000000000000",
"overheated": false,
"region": "",
"rssi": -30,
"signal_level": 3,
"specs": "EU",
"ssid": "I01BU0tFRF9TU0lEIw==",
"time_diff": 0,
"type": "SMART.TAPOHUB"
},
"get_device_time": {
"region": "",
"time_diff": 0,
"timestamp": 946771480
},
"get_fw_download_state": {
"auto_upgrade": false,
"download_progress": 0,
"reboot_time": 5,
"status": 0,
"upgrade_time": 5
},
"get_inherit_info": null,
"get_led_info": {
"led_rule": "always",
"led_status": true,
"night_mode": {
"end_time": 420,
"night_mode_type": "sunrise_sunset",
"start_time": 1140,
"sunrise_offset": 0,
"sunset_offset": 0
}
},
"get_wireless_scan_info": {
"ap_list": [
{
"bssid": "000000000000",
"channel": 0,
"cipher_type": 2,
"key_type": "wpa2_psk",
"signal_level": 2,
"ssid": "I01BU0tFRF9TU0lEIw=="
},
{
"bssid": "000000000000",
"channel": 0,
"cipher_type": 2,
"key_type": "wpa2_psk",
"signal_level": 2,
"ssid": "I01BU0tFRF9TU0lEIw=="
}
],
"wep_supported": false
},
"qs_component_nego": {
"component_list": [
{
"id": "quick_setup",
"ver_code": 3
},
{
"id": "sunrise_sunset",
"ver_code": 1
},
{
"id": "iot_cloud",
"ver_code": 1
},
{
"id": "inherit",
"ver_code": 1
},
{
"id": "firmware",
"ver_code": 2
}
],
"extra_info": {
"device_model": "H100",
"device_type": "SMART.TAPOHUB"
}
}
}
Loading