Retain last two chars for children device_id (#733)

This commit is contained in:
Teemu R 2024-02-01 19:27:01 +01:00 committed by GitHub
parent 8657959ace
commit 1acf4e86da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 29 deletions

View File

@ -60,6 +60,7 @@ def scrub(res):
"alias", "alias",
"bssid", "bssid",
"channel", "channel",
"original_device_id", # for child devices
] ]
for k, v in res.items(): for k, v in res.items():
@ -96,6 +97,11 @@ def scrub(res):
v = "#MASKED_NAME#" v = "#MASKED_NAME#"
elif isinstance(res[k], int): elif isinstance(res[k], int):
v = 0 v = 0
elif k == "device_id" and len(v) > 40:
# retain the last two chars when scrubbing child ids
end = v[-2:]
v = re.sub(r"\w", "0", v)
v = v[:40] + end
else: else:
v = re.sub(r"\w", "0", v) v = re.sub(r"\w", "0", v)

View File

@ -170,7 +170,7 @@
"ver_code": 1 "ver_code": 1
} }
], ],
"device_id": "000000000000000000000000000000000000000000" "device_id": "000000000000000000000000000000000000000002"
}, },
{ {
"component_list": [ "component_list": [
@ -235,7 +235,7 @@
"ver_code": 1 "ver_code": 1
} }
], ],
"device_id": "000000000000000000000000000000000000000000" "device_id": "000000000000000000000000000000000000000001"
}, },
{ {
"component_list": [ "component_list": [
@ -318,7 +318,7 @@
}, },
"type": "custom" "type": "custom"
}, },
"device_id": "000000000000000000000000000000000000000000", "device_id": "000000000000000000000000000000000000000002",
"device_on": false, "device_on": false,
"fw_id": "00000000000000000000000000000000", "fw_id": "00000000000000000000000000000000",
"fw_ver": "1.0.13 Build 230925 Rel.150200", "fw_ver": "1.0.13 Build 230925 Rel.150200",
@ -332,7 +332,7 @@
"nickname": "I01BU0tFRF9OQU1FIw==", "nickname": "I01BU0tFRF9OQU1FIw==",
"oem_id": "00000000000000000000000000000000", "oem_id": "00000000000000000000000000000000",
"on_time": 0, "on_time": 0,
"original_device_id": "8022852468EC205A8178C7CBE81FC119213BC020", "original_device_id": "0000000000000000000000000000000000000000",
"overheat_status": "normal", "overheat_status": "normal",
"position": 3, "position": 3,
"region": "Europe/Berlin", "region": "Europe/Berlin",
@ -347,7 +347,7 @@
"default_states": { "default_states": {
"type": "last_states" "type": "last_states"
}, },
"device_id": "000000000000000000000000000000000000000000", "device_id": "000000000000000000000000000000000000000001",
"device_on": false, "device_on": false,
"fw_id": "00000000000000000000000000000000", "fw_id": "00000000000000000000000000000000",
"fw_ver": "1.0.13 Build 230925 Rel.150200", "fw_ver": "1.0.13 Build 230925 Rel.150200",
@ -361,7 +361,7 @@
"nickname": "I01BU0tFRF9OQU1FIw==", "nickname": "I01BU0tFRF9OQU1FIw==",
"oem_id": "00000000000000000000000000000000", "oem_id": "00000000000000000000000000000000",
"on_time": 0, "on_time": 0,
"original_device_id": "8022852468EC205A8178C7CBE81FC119213BC020", "original_device_id": "0000000000000000000000000000000000000000",
"overheat_status": "normal", "overheat_status": "normal",
"position": 2, "position": 2,
"region": "Europe/Berlin", "region": "Europe/Berlin",
@ -393,7 +393,7 @@
"nickname": "I01BU0tFRF9OQU1FIw==", "nickname": "I01BU0tFRF9OQU1FIw==",
"oem_id": "00000000000000000000000000000000", "oem_id": "00000000000000000000000000000000",
"on_time": 0, "on_time": 0,
"original_device_id": "8022852468EC205A8178C7CBE81FC119213BC020", "original_device_id": "0000000000000000000000000000000000000000",
"overheat_status": "normal", "overheat_status": "normal",
"position": 1, "position": 1,
"region": "Europe/Berlin", "region": "Europe/Berlin",
@ -406,7 +406,7 @@
"sum": 3 "sum": 3
}, },
"get_connect_cloud_state": { "get_connect_cloud_state": {
"status": 0 "status": 2
}, },
"get_device_info": { "get_device_info": {
"avatar": "", "avatar": "",
@ -435,12 +435,12 @@
"get_device_time": { "get_device_time": {
"region": "Europe/Berlin", "region": "Europe/Berlin",
"time_diff": 60, "time_diff": 60,
"timestamp": 1706320181 "timestamp": 1706810351
}, },
"get_device_usage": { "get_device_usage": {
"time_usage": { "time_usage": {
"past30": 0, "past30": 134,
"past7": 0, "past7": 134,
"today": 0 "today": 0
} }
}, },
@ -451,23 +451,13 @@
"status": 0, "status": 0,
"upgrade_time": 5 "upgrade_time": 5
}, },
"get_latest_fw": {
"fw_size": 0,
"fw_ver": "1.0.13 Build 230925 Rel.150200",
"hw_id": "",
"need_to_upgrade": false,
"oem_id": "",
"release_date": "",
"release_note": "",
"type": 0
},
"get_led_info": { "get_led_info": {
"led_rule": "night_mode", "led_rule": "night_mode",
"led_status": false, "led_status": false,
"night_mode": { "night_mode": {
"end_time": 496, "end_time": 489,
"night_mode_type": "sunrise_sunset", "night_mode_type": "sunrise_sunset",
"start_time": 1034, "start_time": 1043,
"sunrise_offset": 0, "sunrise_offset": 0,
"sunset_offset": 0 "sunset_offset": 0
} }

View File

@ -170,7 +170,7 @@
"ver_code": 1 "ver_code": 1
} }
], ],
"device_id": "000000000000000000000000000000000000000000" "device_id": "000000000000000000000000000000000000000001"
}, },
{ {
"component_list": [ "component_list": [
@ -235,7 +235,7 @@
"ver_code": 1 "ver_code": 1
} }
], ],
"device_id": "000000000000000000000000000000000000000000" "device_id": "000000000000000000000000000000000000000002"
}, },
{ {
"component_list": [ "component_list": [
@ -300,7 +300,7 @@
"ver_code": 1 "ver_code": 1
} }
], ],
"device_id": "000000000000000000000000000000000000000000" "device_id": "000000000000000000000000000000000000000003"
} }
], ],
"start_index": 0, "start_index": 0,
@ -315,7 +315,7 @@
"default_states": { "default_states": {
"type": "last_states" "type": "last_states"
}, },
"device_id": "000000000000000000000000000000000000000000", "device_id": "000000000000000000000000000000000000000001",
"device_on": true, "device_on": true,
"fw_id": "00000000000000000000000000000000", "fw_id": "00000000000000000000000000000000",
"fw_ver": "1.0.7 Build 220715 Rel.200458", "fw_ver": "1.0.7 Build 220715 Rel.200458",
@ -344,7 +344,7 @@
"default_states": { "default_states": {
"type": "last_states" "type": "last_states"
}, },
"device_id": "000000000000000000000000000000000000000000", "device_id": "000000000000000000000000000000000000000002",
"device_on": true, "device_on": true,
"fw_id": "00000000000000000000000000000000", "fw_id": "00000000000000000000000000000000",
"fw_ver": "1.0.7 Build 220715 Rel.200458", "fw_ver": "1.0.7 Build 220715 Rel.200458",
@ -373,7 +373,7 @@
"default_states": { "default_states": {
"type": "last_states" "type": "last_states"
}, },
"device_id": "000000000000000000000000000000000000000000", "device_id": "000000000000000000000000000000000000000003",
"device_on": true, "device_on": true,
"fw_id": "00000000000000000000000000000000", "fw_id": "00000000000000000000000000000000",
"fw_ver": "1.0.7 Build 220715 Rel.200458", "fw_ver": "1.0.7 Build 220715 Rel.200458",