mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-10-15 09:04:16 +00:00
Use the real discovery reply in the TD21 fixture (#1800)
Use the real discovery reply in the TD21 fixture. I said there that the TD21 doesn't answer UDP discovery, and that was wrong: it was asleep during my first attempt, and I had skipped discovery in `dump_devinfo` by passing the family flags. The doorbell does answer, from port 20004. This commit uses the real device response for the fixture, so the `_comment` marker is removed since nothing in the fixture is hand-made any more. --------- Co-authored-by: Smugaski <Smugaski@users.noreply.github.com>
This commit is contained in:
@@ -200,6 +200,10 @@ def create_discovery_mock(ip: str, fixture_data: dict):
|
||||
):
|
||||
login_version = max([int(i) for i in et])
|
||||
https = discovery_result["mgt_encrypt_schm"]["is_support_https"]
|
||||
if not encrypt_type and https and login_version == 3:
|
||||
# Mirrors Discover._get_connection_parameters for cameras that
|
||||
# only send the top level encrypt_type list
|
||||
encrypt_type = "AES"
|
||||
http_port = discovery_result["mgt_encrypt_schm"].get("http_port")
|
||||
if not http_port: # noqa: SIM108
|
||||
# Not all discovery responses set the http port, i.e. smartcam.
|
||||
|
||||
99
tests/fixtures/smartcam/TD21(EU)_2.0_1.1.5.json
vendored
99
tests/fixtures/smartcam/TD21(EU)_2.0_1.1.5.json
vendored
@@ -1,17 +1,13 @@
|
||||
{
|
||||
"discovery_result": {
|
||||
"_comment": "Manually created, not a real device response.",
|
||||
"error_code": 0,
|
||||
"result": {
|
||||
"battery_charging": false,
|
||||
"battery_percent": 8,
|
||||
"device_id": "00000000000000000000000000000000",
|
||||
"device_model": "TD21",
|
||||
"device_name": "#MASKED_NAME#",
|
||||
"device_type": "SMART.TAPODOORBELL",
|
||||
"encrypt_info": {
|
||||
"data": "",
|
||||
"key": "",
|
||||
"sym_schm": "AES"
|
||||
},
|
||||
"encrypt_type": [
|
||||
"3"
|
||||
],
|
||||
@@ -19,12 +15,19 @@
|
||||
"firmware_version": "1.1.5 Build 260423 Rel.6435n",
|
||||
"hardware_version": "2.0",
|
||||
"ip": "127.0.0.123",
|
||||
"isResetWiFi": false,
|
||||
"is_support_iot_cloud": true,
|
||||
"last_alarm_time": 1791915611,
|
||||
"lens_mask": "off",
|
||||
"low_battery": true,
|
||||
"mac": "C0-3A-55-00-00-00",
|
||||
"mgt_encrypt_schm": {
|
||||
"is_support_https": true
|
||||
}
|
||||
},
|
||||
"owner": "00000000000000000000000000000000",
|
||||
"power": "BATTERY",
|
||||
"power_save_status": "off",
|
||||
"protocol_version": 1,
|
||||
"sd_status": "normal",
|
||||
"sleep": true
|
||||
}
|
||||
},
|
||||
"getAlertPlan": {
|
||||
@@ -279,8 +282,8 @@
|
||||
"getClockStatus": {
|
||||
"system": {
|
||||
"clock_status": {
|
||||
"local_time": "2026-10-07 20:57:13",
|
||||
"seconds_from_1970": 1791403033
|
||||
"local_time": "2026-10-13 19:52:21",
|
||||
"seconds_from_1970": 1791917541
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -294,8 +297,8 @@
|
||||
"getConnectionType": {
|
||||
"channel": 0,
|
||||
"link_type": "wifi",
|
||||
"rssi": "2",
|
||||
"rssiValue": -64,
|
||||
"rssi": "3",
|
||||
"rssiValue": -61,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
"getDetectionConfig": {
|
||||
@@ -318,7 +321,7 @@
|
||||
"barcode": "",
|
||||
"battery_charging": "NO",
|
||||
"battery_overheated": false,
|
||||
"battery_percent": 20,
|
||||
"battery_percent": 7,
|
||||
"channel_plan_code": "",
|
||||
"dev_id": "0000000000000000000000000000000000000000",
|
||||
"device_alias": "#MASKED_NAME#",
|
||||
@@ -369,7 +372,7 @@
|
||||
"getLastAlarmInfo": {
|
||||
"system": {
|
||||
"last_alarm_info": {
|
||||
"last_alarm_time": "1791402993",
|
||||
"last_alarm_time": "1791917500",
|
||||
"last_alarm_type": "motion"
|
||||
}
|
||||
}
|
||||
@@ -657,8 +660,8 @@
|
||||
"crossline_total_space_accurate": "0B",
|
||||
"detect_status": "normal",
|
||||
"disk_name": "1",
|
||||
"free_space": "28.0GB",
|
||||
"free_space_accurate": "30047127744B",
|
||||
"free_space": "27.8GB",
|
||||
"free_space_accurate": "29887174540B",
|
||||
"loop_record_status": "0",
|
||||
"msg_push_free_space": "0B",
|
||||
"msg_push_free_space_accurate": "0B",
|
||||
@@ -677,8 +680,8 @@
|
||||
"total_space": "29.5GB",
|
||||
"total_space_accurate": "31638716416B",
|
||||
"type": "local",
|
||||
"video_free_space": "28.0GB",
|
||||
"video_free_space_accurate": "30047127744B",
|
||||
"video_free_space": "27.8GB",
|
||||
"video_free_space_accurate": "29887174540B",
|
||||
"video_total_space": "28.3GB",
|
||||
"video_total_space_accurate": "30333206528B",
|
||||
"write_protect": "0"
|
||||
@@ -741,7 +744,7 @@
|
||||
"getVideoQualities": {
|
||||
"video": {
|
||||
"main": {
|
||||
"bitrate": "900",
|
||||
"bitrate": "1500",
|
||||
"bitrate_type": "vbr",
|
||||
"codec_switch_trigger": "none",
|
||||
"default_bitrate": "1500",
|
||||
@@ -979,14 +982,6 @@
|
||||
"onboarding": {
|
||||
"scan": {
|
||||
"ap_list": [
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 2,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 0,
|
||||
"bssid": "000000000000",
|
||||
@@ -995,6 +990,30 @@
|
||||
"rssi": 2,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 2,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 1,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 1,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
@@ -1042,30 +1061,6 @@
|
||||
"encryption": 3,
|
||||
"rssi": 0,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 0,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 3,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 0,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
},
|
||||
{
|
||||
"auth": 5,
|
||||
"bssid": "000000000000",
|
||||
"channel": 0,
|
||||
"encryption": 3,
|
||||
"rssi": 0,
|
||||
"ssid": "I01BU0tFRF9TU0lEIw=="
|
||||
}
|
||||
],
|
||||
"public_key": "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8rndtJFzDJrH5dJEUHfpwZ04O\nBCXYTegs75oDyqZC9To5shtOlH1cCyxR/y6OF2V/NYFU+PlJEaa1QvkFM7mxYRCv\n7A7j/KOmmseX6pOmILDlU7Mcii64kAKSrNrgEhILIvCvN3cBfb+jIm7G70YaIJ98\n+MaPNJGAoIhbHJT0dQIDAQAB\n-----END PUBLIC KEY-----\n",
|
||||
|
||||
Reference in New Issue
Block a user