Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5' #1344

Closed
H4rl3k1n opened this issue Mar 4, 2022 · 23 comments · Fixed by #1345 or #1348
Closed

Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5' #1344

H4rl3k1n opened this issue Mar 4, 2022 · 23 comments · Fixed by #1345 or #1348
Labels

Comments

@H4rl3k1n
Copy link

H4rl3k1n commented Mar 4, 2022

Describe the bug
My Xiaomi SmartMi Standing Fan 3 integration worked untill 2022.2.x, with 2022.3.0 integration failed.
Message in integration:
{'code': -9999, 'message': 'user ack timeout'}

Errormessage in log:
Source: /usr/local/lib/python3.9/site-packages/miio/device.py:155
First occurred: 07:58:08 (19 occurrences)
Last logged: 08:20:41

Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/

I checked the login datas, also the fan works in Xiaomi App.

System Health

version core-2022.3.1
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.92-v8+
arch aarch64
timezone Europe/Berlin
@H4rl3k1n H4rl3k1n added the bug label Mar 4, 2022
@KitHubek
Copy link

KitHubek commented Mar 4, 2022

the same here, the same verions HA and all. fans working via Xiaomi mobile app

Logger: miio.device
Source: /usr/local/lib/python3.9/site-packages/miio/device.py:155
First occurred: 09:47:49 (274 occurrences)
Last logged: 11:31:59

Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/

2022-03-04 09:47:58 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vent1' for xiaomi_miio integration not ready yet: {'code': -9999, 'message': 'user ack timeout'}; Retrying in background
2022-03-04 09:47:59 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vent2' for xiaomi_miio integration not ready yet: {'code': -9999, 'message': 'user ack timeout'}; Retrying in background
2022-03-04 09:47:59 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vent3' for xiaomi_miio integration not ready yet: {'code': -9999, 'message': 'user ack timeout'}; Retrying in background

fan5fail
logfail2

@rytilahti
Copy link
Owner

The linked PR fixes the warning about an unsupported model. Those user ack timeout errors are difficult to fix as that is what the device is responding for the requests, and there is no easy way of knowing why that is happening: maybe the device is being accessed by other app? Maybe the device does not understand the command? Maybe the device is busy updating its data from sensors and doesn't want to respond?

@rytilahti
Copy link
Owner

Ah, as it was working previously, I'll reopen this issue.

Could you please try if miiocli fanza5 commands are working correctly? It would be helpful to know if it broke due to a change in homeassistant or due to one in this project, thanks!

@KitHubek
Copy link

KitHubek commented Mar 4, 2022

yes, previously this fans working without any problems. Iam using this fans with mio integraton since few months with success and without any errors

@ikaruswill
Copy link

Same here. This just happened after a restart of home-assistant for me. Strangely before the restart it worked.

@H4rl3k1n
Copy link
Author

H4rl3k1n commented Mar 4, 2022

Same here, the Fan worked without any problems before Version 3.0, since the new version the problem pops up. For fun ive loaded 2.x again, worked again. Must have smth to do with new HA version i.m.o.

@rytilahti
Copy link
Owner

It is not that simple to debug such issues without a test device and it's already clear that there is an issue, but we need to narrow whether it is in the backend lib or in the integration itself. And that's why I asked if someone could try to control the device using the miiocli tool, so if someone could please try it out to see if it works it would be great.

@H4rl3k1n
Copy link
Author

H4rl3k1n commented Mar 4, 2022

Im afk untill sunday evening, but then ill have a look at this tool.

@ikaruswill
Copy link

ikaruswill commented Mar 5, 2022

I noticed this issue right before I was heading to bed so I figured to contribute any info I had at that point. Anyways, I ran miiocli and this is the output from an off command. It does turn off the fan, for the record.

$ miiocli fanza5 --ip <REDACTED> --token <REDACTED> off
Powering off
WARNING:miio.device:Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
[{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0}]

Other commands work as well, tested a sample of all possible commands

$ miiocli fanza5 --ip <REDACTED> --token <REDACTED> set_led_brightness 100
b6a set_led_brightness 100
Setting LED brightness to 100%
WARNING:miio.device:Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
[{'did': 'light', 'siid': 4, 'piid': 3, 'code': 0}]
$ miiocli fanza5 --ip <REDACTED> --token <REDACTED> set_buzzer on
Turning on buzzer
WARNING:miio.device:Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
[{'did': 'buzzer', 'siid': 5, 'piid': 1, 'code': 0}]
$ miiocli fanza5 --ip <REDACTED> --token <REDACTED> status
WARNING:miio.device:Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
Angle: 60
Battery Supported: False
Buttons Pressed: None
Buzzer: False
Child Lock: False
Delay Off Countdown: 0
Fan Level: 2
Fan Speed: 35
Humidity: 79
Ionizer: True
LED Brightness: 0
Mode: Normal
Oscillate: False
Power: on
Powersupply Attached: True
Speed RPM: 470
Temperature: 28.8

EDIT: Something's probably wrong with my battery. Checked your Miot mappings and confirmed they're correct.

@funforums
Copy link

Confirmed, same issue here after upgrading to latest stable version (2022.3.1).

@KitHubek
Copy link

KitHubek commented Mar 6, 2022

i searched when issue starts ant this issue starts after update to HA 2022.3.1

@rytilahti
Copy link
Owner

Thanks for testing, @ikaruswill! That makes it more probable that the bug is somewhere in the homeassistant integration and not in the backend lib, helping to narrow where to search for the solution.

@Kirmas
Copy link
Contributor

Kirmas commented Mar 6, 2022

Could some one change log level in home assistant to "debug" for integration and provide log with {'code': -9999, 'message': 'user ack timeout'} error.

@ikaruswill
Copy link

No probs, happy to help with any further information.
While I try to set the log level to debug, I'd like to highlight that I did not upgrade home-assistant when this problem first occurred. I'm still on 2022.2.8 using the official docker image + my own LDAP script. The problem first occurred when I restarted the container that day when I first left a comment.

@ikaruswill
Copy link

ikaruswill commented Mar 6, 2022

@Kirmas Do you happen to know what's the integration's log config key or more precisely, component_namespace?
e.g. in configuration.yaml

logger:
  default: debug
  logs:
    custom_components.my_integration: critical

@Kirmas
Copy link
Contributor

Kirmas commented Mar 6, 2022

@Kirmas Do you happen to know what's the integration's log config key or more precisely, component_namespace? e.g. in configuration.yaml

logger:
  default: debug
  logs:
    custom_components.my_integration: critical

yes. @ikaruswill thankyou for your help.

@ikaruswill
Copy link

ikaruswill commented Mar 6, 2022

I've redacted the IP addresses and any token-containing strings for privacy reasons but rest assured they are indeed of the fan itself.

This entry is on its own.

2022-03-06 18:26:01 INFO (MainThread) [homeassistant.components.xiaomi_miio] Got exception while fetching the state, trying again: {'code': -9999, 'message': 'user ack timeout'}

Another possibly relevant entry

2022-03-06 18:24:32 DEBUG (SyncWorker_1) [miio.miioprotocol] <REDACTED>:54321 (ts: 1970-02-02 03:11:55, id: 2) << {'id': 2, 'error': {'code': -9999, 'message': 'user ack timeout'}, 'exe_time': 4010}

Looking up the IP address of my fan in the logs:

2022-03-06 18:25:56 DEBUG (MainThread) [homeassistant.components.xiaomi_miio] Initializing with host <REDACTED> (token <REDACTED>...)
2022-03-06 18:25:56 DEBUG (SyncWorker_0) [miio.click_common] Unknown model, trying autodetection. None None
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [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\x17\x92\x92\xdd\x00*]O' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('179292dd')
            ts = 1970-02-02 03:13:19
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [miio.miioprotocol] Discovered 179292dd with ts: 1970-02-02 03:13:19, token: b'ffffffffffffffffffffffffffffffff'
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [miio.miioprotocol] <REDACTED>:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [miio.miioprotocol] <REDACTED>:54321 (ts: 1970-02-02 03:13:19, id: 1) << {'id': 1, 'result': {'life': 2776399, 'uid': 1576645942, 'model': 'zhimi.fan.za5', 'token': '<REDACTED>', 'ipflag': 1, 'fw_ver': '2.0.8', 'mcu_fw_ver': '0018', 'miio_ver': '0.0.8', 'hw_ver': 'esp32', 'mmfree': 63760, 'mac': '54:48:E6:EC:E9:C0', 'wifi_fw_ver': 'cef6c09-dirty', 'ap': {'ssid': '<REDACTED>', 'bssid': 'D4:5D:64:98:8F:00', 'rssi': -48, 'primary': 6}, 'netif': {'localIp': '<REDACTED>', 'mask': '255.255.255.0', 'gw': '<REDACTED>'}}, 'exe_time': 40}
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [miio.device] Detected model zhimi.fan.za5
2022-03-06 18:25:57 WARNING (SyncWorker_0) [miio.device] Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2022-03-06 18:25:57 DEBUG (SyncWorker_0) [miio.miioprotocol] <REDACTED>:54321 >>: {'id': 2, 'method': 'get_properties', 'params': [{'did': 'zhimi.fan.za5', 'power': {'siid': 2, 'piid': 1}, 'fan_level': {'siid': 2, 'piid': 2}, 'swing_mode': {'siid': 2, 'piid': 3}, 'swing_mode_angle': {'siid': 2, 'piid': 5}, 'mode': {'siid': 2, 'piid': 7}, 'power_off_time': {'siid': 2, 'piid': 10}, 'anion': {'siid': 2, 'piid': 11}, 'child_lock': {'siid': 3, 'piid': 1}, 'light': {'siid': 4, 'piid': 3}, 'buzzer': {'siid': 5, 'piid': 1}, 'buttons_pressed': {'siid': 6, 'piid': 1}, 'battery_supported': {'siid': 6, 'piid': 2}, 'set_move': {'siid': 6, 'piid': 3}, 'speed_rpm': {'siid': 6, 'piid': 4}, 'powersupply_attached': {'siid': 6, 'piid': 5}, 'fan_speed': {'siid': 6, 'piid': 8}, 'humidity': {'siid': 7, 'piid': 1}, 'temperature': {'siid': 7, 'piid': 7}}]}

@rytilahti
Copy link
Owner

While I try to set the log level to debug, I'd like to highlight that I did not upgrade home-assistant when this problem first occurred. I'm still on 2022.2.8 using the official docker image + my own LDAP script.

This made me think that the problem could be related to something else besides the upstream version bump of python-miio. Could it be that the device got a new firmware which doesn't like how the library is talking to it?

That command is the very same that is used by miiocli to request the state, but if you wish, you could verify it by adding --debug (miiocli --debug fanza5 --ip <REDACTED> --token <REDACTED> status), just to be sure.

@H4rl3k1n
Copy link
Author

H4rl3k1n commented Mar 6, 2022

I dont think its related to firmware, my fan has no permission to connect to Internet (via setting in my router), i gave the permission after the problem showed up to test if it works via Xiaomi app. So it had no chance for an upgrade.

@ikaruswill
Copy link

ikaruswill commented Mar 7, 2022

I tried running miiocli with the --debug, I see the exact same log output as the ones reported in the home-assistant logs I pasted above.

bash-5.1# miiocli --debug fanza5 --ip <REDACTED> --token <REDACTED> status
INFO:miio.cli:Debug mode active
DEBUG:miio.click_common:Unknown model, trying autodetection. None None
DEBUG: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\x17\x92\x92\xdd\x00*\xd6\xfd' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('179292dd')
            ts = 1970-02-02 11:52:29
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocol:Discovered 179292dd with ts: 1970-02-02 11:52:29, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:<REDACTED>:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:<REDACTED>:54321 (ts: 1970-02-02 11:52:30, id: 1) << {'id': 1, 'result': {'life': 2807550, 'uid': 1576645942, 'model': 'zhimi.fan.za5', 'token': '<REDACTED>', 'ipflag': 1, 'fw_ver': '2.0.8', 'mcu_fw_ver': '0018', 'miio_ver': '0.0.8', 'hw_ver': 'esp32', 'mmfree': 63760, 'mac': '54:48:E6:EC:E9:C0', 'wifi_fw_ver': 'cef6c09-dirty', 'ap': {'ssid': '<REDACTED>', 'bssid': 'D4:5D:64:98:8F:00', 'rssi': -48, 'primary': 6}, 'netif': {'localIp': '<REDACTED>', 'mask': '255.255.255.0', 'gw': '<REDACTED>'}}, 'exe_time': 40}
DEBUG:miio.device:Detected model zhimi.fan.za5
WARNING:miio.device:Found an unsupported model 'zhimi.fan.za5' for class 'FanZA5'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
DEBUG:miio.miioprotocol:<REDACTED>:54321 >>: {'id': 2, 'method': 'get_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 1}, {'did': 'fan_level', 'siid': 2, 'piid': 2}, {'did': 'swing_mode', 'siid': 2, 'piid': 3}, {'did': 'swing_mode_angle', 'siid': 2, 'piid': 5}, {'did': 'mode', 'siid': 2, 'piid': 7}, {'did': 'power_off_time', 'siid': 2, 'piid': 10}, {'did': 'anion', 'siid': 2, 'piid': 11}, {'did': 'child_lock', 'siid': 3, 'piid': 1}, {'did': 'light', 'siid': 4, 'piid': 3}, {'did': 'buzzer', 'siid': 5, 'piid': 1}, {'did': 'buttons_pressed', 'siid': 6, 'piid': 1}, {'did': 'battery_supported', 'siid': 6, 'piid': 2}, {'did': 'set_move', 'siid': 6, 'piid': 3}, {'did': 'speed_rpm', 'siid': 6, 'piid': 4}, {'did': 'powersupply_attached', 'siid': 6, 'piid': 5}]}
DEBUG:miio.miioprotocol:<REDACTED>:54321 (ts: 1970-02-02 11:52:30, id: 2) << {'id': 2, 'result': [{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0, 'value': False}, {'did': 'fan_level', 'siid': 2, 'piid': 2, 'code': 0, 'value': 2}, {'did': 'swing_mode', 'siid': 2, 'piid': 3, 'code': 0, 'value': False}, {'did': 'swing_mode_angle', 'siid': 2, 'piid': 5, 'code': 0, 'value': 60}, {'did': 'mode', 'siid': 2, 'piid': 7, 'code': 0, 'value': 1}, {'did': 'power_off_time', 'siid': 2, 'piid': 10, 'code': 0, 'value': 0}, {'did': 'anion', 'siid': 2, 'piid': 11, 'code': 0, 'value': True}, {'did': 'child_lock', 'siid': 3, 'piid': 1, 'code': 0, 'value': False}, {'did': 'light', 'siid': 4, 'piid': 3, 'code': 0, 'value': 0}, {'did': 'buzzer', 'siid': 5, 'piid': 1, 'code': 0, 'value': False}, {'did': 'buttons_pressed', 'siid': 6, 'piid': 1, 'code': 0, 'value': 0}, {'did': 'battery_supported', 'siid': 6, 'piid': 2, 'code': 0, 'value': False}, {'did': 'set_move', 'siid': 6, 'piid': 3, 'code': -4005}, {'did': 'speed_rpm', 'siid': 6, 'piid': 4, 'code': 0, 'value': 0}, {'did': 'powersupply_attached', 'siid': 6, 'piid': 5, 'code': 0, 'value': True}], 'exe_time': 210}
DEBUG:miio.miioprotocol:<REDACTED>:54321 >>: {'id': 3, 'method': 'get_properties', 'params': [{'did': 'fan_speed', 'siid': 6, 'piid': 8}, {'did': 'humidity', 'siid': 7, 'piid': 1}, {'did': 'temperature', 'siid': 7, 'piid': 7}]}
DEBUG:miio.miioprotocol:<REDACTED>:54321 (ts: 1970-02-02 11:52:30, id: 3) << {'id': 3, 'result': [{'did': 'fan_speed', 'siid': 6, 'piid': 8, 'code': 0, 'value': 35}, {'did': 'humidity', 'siid': 7, 'piid': 1, 'code': 0, 'value': 78}, {'did': 'temperature', 'siid': 7, 'piid': 7, 'code': 0, 'value': 29.6}], 'exe_time': 140}
Angle: 60
Battery Supported: False
Buttons Pressed: None
Buzzer: False
Child Lock: False
Delay Off Countdown: 0
Fan Level: 2
Fan Speed: 35
Humidity: 78
Ionizer: True
LED Brightness: 0
Mode: Normal
Oscillate: False
Power: off
Powersupply Attached: True
Speed RPM: 0
Temperature: 29.6

@Kirmas
Copy link
Contributor

Kirmas commented Mar 7, 2022

@rytilahti as for me command is different:

  • From Homeassistant
    <REDACTED>:54321 >>: {'id': 2, 'method': 'get_properties', 'params': [{'did': 'zhimi.fan.za5', 'power': {'siid': 2, 'piid': 1}, 'fan_level': {'siid': 2, 'piid': 2}, 'swing_mode': {'siid': 2, 'piid': 3}, 'swing_mode_angle': {'siid': 2, 'piid': 5}, 'mode': {'siid': 2, 'piid': 7}, 'power_off_time': {'siid': 2, 'piid': 10}, 'anion': {'siid': 2, 'piid': 11}, 'child_lock': {'siid': 3, 'piid': 1}, 'light': {'siid': 4, 'piid': 3}, 'buzzer': {'siid': 5, 'piid': 1}, 'buttons_pressed': {'siid': 6, 'piid': 1}, 'battery_supported': {'siid': 6, 'piid': 2}, 'set_move': {'siid': 6, 'piid': 3}, 'speed_rpm': {'siid': 6, 'piid': 4}, 'powersupply_attached': {'siid': 6, 'piid': 5}, 'fan_speed': {'siid': 6, 'piid': 8}, 'humidity': {'siid': 7, 'piid': 1}, 'temperature': {'siid': 7, 'piid': 7}}]}
  • From miiocli
    <REDACTED>:54321 >>: {'id': 2, 'method': 'get_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 1}, {'did': 'fan_level', 'siid': 2, 'piid': 2}, {'did': 'swing_mode', 'siid': 2, 'piid': 3}, {'did': 'swing_mode_angle', 'siid': 2, 'piid': 5}, {'did': 'mode', 'siid': 2, 'piid': 7}, {'did': 'power_off_time', 'siid': 2, 'piid': 10}, {'did': 'anion', 'siid': 2, 'piid': 11}, {'did': 'child_lock', 'siid': 3, 'piid': 1}, {'did': 'light', 'siid': 4, 'piid': 3}, {'did': 'buzzer', 'siid': 5, 'piid': 1}, {'did': 'buttons_pressed', 'siid': 6, 'piid': 1}, {'did': 'battery_supported', 'siid': 6, 'piid': 2}, {'did': 'set_move', 'siid': 6, 'piid': 3}, {'did': 'speed_rpm', 'siid': 6, 'piid': 4}, {'did': 'powersupply_attached', 'siid': 6, 'piid': 5}]}

I don't know if both are correct

@KitHubek
Copy link

KitHubek commented Mar 7, 2022

after upgrade to 2022.3.2 problem still exsist

@rytilahti
Copy link
Owner

rytilahti commented Mar 7, 2022

@Kirmas ah, thanks! The model in your example pointed me to the right direction to figure out the issue (mapping instead of _mappings in the impl. class)... I'll prepare a PR asap edit: looks like @saxel was faster than me: #1348

rytilahti added a commit that referenced this issue Mar 7, 2022
* Simplifies the code as there is no need to define supported models separately
  * The keys from mappings are used as supported models, this will be extended to miio devices in the future, too.
* Mass convert miot devices to use _mappings instead of mapping
* Add tests to verify that deprecated 'mapping' is not used and the data structure is what is expected, re #1344
* As class properties are supported only from python3.9 onwards, the supported_models is now defined in the meta class.
rytilahti added a commit that referenced this issue Mar 7, 2022
* Simplifies the code as there is no need to define supported models separately
  * The keys from mappings are used as supported models, this will be extended to miio devices in the future, too.
* Mass convert miot devices to use _mappings instead of mapping
* Add tests to verify that deprecated 'mapping' is not used and the data structure is what is expected, re #1344
* As class properties are supported only from python3.9 onwards, the supported_models is now defined in the meta class.
rytilahti added a commit that referenced this issue Mar 7, 2022
* Simplifies the code as there is no need to define supported models separately
  * The keys from mappings are used as supported models, this will be extended to miio devices in the future, too.
* Mass convert miot devices to use _mappings instead of mapping
* Add tests to verify that deprecated 'mapping' is not used and the data structure is what is expected, re #1344
* As class properties are supported only from python3.9 onwards, the supported_models is now defined in the meta class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants