home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.42k stars 30.66k forks source link

Xiaomi Air Purifier 2S (Resp invalid json) #77077

Closed samfili closed 1 year ago

samfili commented 2 years ago

The problem

Logger: miio.miioprotocol Source: /usr/local/lib/python3.10/site-packages/miio/miioprotocol.py:255 First occurred: 21:57:03 (13 occurrences) Last logged: 22:03:46

2022-08-20 21:59:36.846 DEBUG (SyncWorker_2) [miio.click_common] Unknown model, trying autodetection. None None
2022-08-20 21:59:36.861 DEBUG (SyncWorker_2) [miio.miioprotocol] Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x04\xfc\xf3\xa6\x00\x97\tp' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('04fcf3a6')
            ts = 1970-04-25 13:32:32
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (total 16)
2022-08-20 21:59:36.861 DEBUG (SyncWorker_2) [miio.miioprotocol] Discovered 04fcf3a6 with ts: 1970-04-25 13:32:32, token: b'00000000000000000000000000000000'
2022-08-20 21:59:36.862 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2022-08-20 21:59:36.869 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:32, id: 1) << {'result': {'life': 9898352, 'cfg_time': 0, 'token': 'TOKENNAME', 'mac': '78:11:DC:F8:36:88', 'fw_ver': '1.4.3_13108', 'hw_ver': 'MW300', 'model': 'zhimi.airpurifier.ma2', 'wifi_fw_ver': 'SD878x-14.76.36.p103-702.1.0-WM', 'ap': {'rssi': -50, 'ssid': 'SSIDNAME', 'bssid': 'CC:2D:E0:9B:9F:7E'}, 'netif': {'localIp': '10.10.10.30', 'mask': '255.255.255.0', 'gw': '10.10.10.1', 'gw_mac': 'CC:2D:E0:9B:9F:7B'}, 'mmfree': 151100, 'ot': 'ott', 'otu_stat': [331, 297, 101072, 475, 99374, 2599], 'ott_stat': [207, 187, 2210, 1207]}, 'id': 1}
2022-08-20 21:59:36.869 DEBUG (SyncWorker_2) [miio.device] Detected model zhimi.airpurifier.ma2
2022-08-20 21:59:36.869 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 2, 'method': 'get_prop', 'params': ['power', 'aqi', 'average_aqi', 'humidity', 'temp_dec', 'mode', 'favorite_level', 'filter1_life', 'f1_hour_used', 'use_time', 'motor1_speed', 'motor2_speed', 'purify_volume', 'f1_hour', 'led']}
2022-08-20 21:59:36.883 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:32, id: 2) << {'result': ['on', 3, 15, 43, 236, 'favorite', 0, 32, 2378, 5307600, 352, None, 46316, 3500, 'on'], 'id': 2}
2022-08-20 21:59:36.884 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 3, 'method': 'get_prop', 'params': ['led_b', 'bright', 'buzzer', 'child_lock', 'volume', 'rfid_product_id', 'rfid_tag', 'act_sleep', 'sleep_mode', 'sleep_time', 'sleep_data_num', 'app_extra', 'act_det', 'button_pressed']}
2022-08-20 21:59:36.906 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:32, id: 3) << {'id': 3, 'error': {'code': -30001, 'message': 'Resp invalid json.'}}
2022-08-20 21:59:36.906 DEBUG (SyncWorker_2) [miio.miioprotocol] Retrying to send failed command, retries left: 3
2022-08-20 21:59:36.906 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 4, 'method': 'get_prop', 'params': ['led_b', 'bright', 'buzzer', 'child_lock', 'volume', 'rfid_product_id', 'rfid_tag', 'act_sleep', 'sleep_mode', 'sleep_time', 'sleep_data_num', 'app_extra', 'act_det', 'button_pressed']}
2022-08-20 21:59:36.917 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:33, id: 4) << {'id': 4, 'error': {'code': -30001, 'message': 'Resp invalid json.'}}
2022-08-20 21:59:36.917 DEBUG (SyncWorker_2) [miio.miioprotocol] Retrying to send failed command, retries left: 2
2022-08-20 21:59:36.919 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 5, 'method': 'get_prop', 'params': ['led_b', 'bright', 'buzzer', 'child_lock', 'volume', 'rfid_product_id', 'rfid_tag', 'act_sleep', 'sleep_mode', 'sleep_time', 'sleep_data_num', 'app_extra', 'act_det', 'button_pressed']}
2022-08-20 21:59:36.929 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:33, id: 5) << {'id': 5, 'error': {'code': -30001, 'message': 'Resp invalid json.'}}
2022-08-20 21:59:36.929 DEBUG (SyncWorker_2) [miio.miioprotocol] Retrying to send failed command, retries left: 1
2022-08-20 21:59:36.930 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 >>: {'id': 6, 'method': 'get_prop', 'params': ['led_b', 'bright', 'buzzer', 'child_lock', 'volume', 'rfid_product_id', 'rfid_tag', 'act_sleep', 'sleep_mode', 'sleep_time', 'sleep_data_num', 'app_extra', 'act_det', 'button_pressed']}
2022-08-20 21:59:36.941 DEBUG (SyncWorker_2) [miio.miioprotocol] 10.10.10.30:54321 (ts: 1970-04-25 13:32:33, id: 6) << {'id': 6, 'error': {'code': -30001, 'message': 'Resp invalid json.'}}
2022-08-20 21:59:36.941 ERROR (SyncWorker_2) [miio.miioprotocol] Got error when receiving: {'code': -30001, 'message': 'Resp invalid json.'}

What version of Home Assistant Core has the issue?

core-2022.8.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Xiaomi Miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @rytilahti, @syssi, @starkillerog, @bieniu, mind taking a look at this issue as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)

samfili commented 2 years ago

up

rytilahti commented 2 years ago

Looks like the first batch of properties is fetched correctly but the second one is not. Did this behavior start just recently or was it always like this? Maybe one of the properties is not supported by your hw/fw version.

Anyway, please install python-miio (from git, not from pypi: https://python-miio.readthedocs.io/en/latest/discovery.html#installation) and try the following command:

miiocli devtools test-properties power aqi average_aqi humidity temp_dec mode favorite_level filter1_life f1_hour_used use_time motor1_speed motor2_speed purify_volume f1_hour led led_b bright buzzer child_lock volume rfid_product_id rfid_tag act_sleep sleep_mode sleep_time sleep_data_num app_extra act_det button_pressed

It will try to fetch all properties one-by-one to see which it can fetch and which it cannot, that could be helpful in figuring out what changes are needed.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.