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

ValueError: None is not a valid OperationModeMiot #1861

Open
iwconfig opened this issue Nov 24, 2023 · 0 comments
Open

ValueError: None is not a valid OperationModeMiot #1861

iwconfig opened this issue Nov 24, 2023 · 0 comments
Labels

Comments

@iwconfig
Copy link

Describe the bug
I have the dmaker.fan.p39 (Xiaomi Smart Tower Fan) and use HA. The following error floods my log file constantly:

ValueError: None is not a valid OperationModeMiot

I also get this warning a lot:

2023-11-24 12:11:14.310 WARNING (SyncWorker_4) [miio.device] Found an unsupported model 'dmaker.fan.p39' for class 'FanMiot'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2023-11-24 12:11:14.311 WARNING (SyncWorker_4) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9

And I also noticed that error when I used fanmiot instead of device in

$ miiocli fanmiot --ip <ip address> --token <token> info
WARNING:miio.device:Found an unsupported model 'dmaker.fan.p39' for class 'FanMiot'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
Model: dmaker.fan.p39
Hardware version: RTL8720C
Firmware version: 2.0.5

Not sure if #1768 is related. My device seems to work as expected IIRC (in accordance with #1581), but this error is rather annoying as it floods my logs. 8 months ago when I fiddled with this in a hurry there was some issue with a feature, but I don't remember which and I don't remember if it ever got solved.

But this is still very annoying as it bogs down my system.

Version information (please complete the following information):

Device information:
If the issue is specific to a device [Use miiocli device --ip <ip address> --token <token> info]:

  • Model: dmaker.fan.p39
  • Hardware version: RTL8720C
  • Firmware version: 2.0.5

Console output
Here is a log file for the HA integration in debug mode:

2023-11-24 12:11:14.310 WARNING (SyncWorker_4) [miio.device] Found an unsupported model 'dmaker.fan.p39' for class 'FanMiot'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
2023-11-24 12:11:14.311 WARNING (SyncWorker_4) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9
2023-11-24 12:11:29.745 WARNING (SyncWorker_6) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9
2023-11-24 12:11:29.768 DEBUG (SyncWorker_6) [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\x19t\x92\xc1\x00#=>' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('197492c1')
            ts = 1970-01-27 17:30:38
        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)
2023-11-24 12:11:29.771 DEBUG (SyncWorker_6) [miio.miioprotocol] Discovered 197492c1 with ts: 1970-01-27 17:30:38, token: b'ffffffffffffffffffffffffffffffff'
2023-11-24 12:11:29.775 DEBUG (SyncWorker_6) [miio.miioprotocol] 192.168.0.130:54321 >>: {'id': 3, 'method': 'get_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 1}, {'did': 'fan_level', 'siid': 2, 'piid': 2}, {'did': 'child_lock', 'siid': 3, 'piid': 1}, {'did': 'fan_speed', 'siid': 2, 'piid': 11}, {'did': 'swing_mode', 'siid': 2, 'piid': 5}, {'did': 'swing_mode_angle', 'siid': 2, 'piid': 6}, {'did': 'power_off_time', 'siid': 2, 'piid': 8}, {'did': 'buzzer', 'siid': 2, 'piid': 7}, {'did': 'light', 'siid': 2, 'piid': 9}, {'did': 'mode', 'siid': 2, 'piid': 4}, {'did': 'set_move', 'siid': 2, 'piid': 10}]}
2023-11-24 12:11:30.124 DEBUG (SyncWorker_6) [miio.miioprotocol] 192.168.0.130:54321 (ts: 1970-01-27 17:30:39, id: 3) << {'id': 3, 'result': [{'did': 'power', 'siid': 2, 'piid': 1, 'code': -4004}, {'did': 'fan_level', 'siid': 2, 'piid': 2, 'code': -4004}, {'did': 'child_lock', 'siid': 3, 'piid': 1, 'code': -4004}, {'did': 'fan_speed', 'siid': 2, 'piid': 11, 'code': -4004}, {'did': 'swing_mode', 'siid': 2, 'piid': 5, 'code': -4004}, {'did': 'swing_mode_angle', 'siid': 2, 'piid': 6, 'code': -4004}, {'did': 'power_off_time', 'siid': 2, 'piid': 8, 'code': -4004}, {'did': 'buzzer', 'siid': 2, 'piid': 7, 'code': -4004}, {'did': 'light', 'siid': 2, 'piid': 9, 'code': -4004}, {'did': 'mode', 'siid': 2, 'piid': 4, 'code': -4004}, {'did': 'set_move', 'siid': 2, 'piid': 10, 'code': -4004}], 'exe_time': 201}
2023-11-24 12:11:30.126 DEBUG (MainThread) [homeassistant.components.xiaomi_miio] Got new state: <FanStatusMiot angle=None buzzer=None child_lock=None delay_off_countdown=None is_on=None led=None mode=ValueError oscillate=None power=off speed=None>
2023-11-24 12:11:30.129 DEBUG (MainThread) [homeassistant.components.xiaomi_miio] Finished fetching Xiaomi Smart Tower Fan data in 0.384 seconds (success: True)
2023-11-24 12:11:30.129 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.device] Attribute angle is None, this is unexpected
2023-11-24 12:11:30.130 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.device] Attribute delay_off_countdown is None, this is unexpected
2023-11-24 12:11:30.131 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 233, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 389, in _async_refresh
    self.async_update_listeners()
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 172, in async_update_listeners
    update_callback()
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/components/xiaomi_miio/fan.py", line 1085, in _handle_coordinator_update
    self._preset_mode = self.coordinator.data.mode.name
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/lsiopy/lib/python3.11/site-packages/miio/integrations/fan/dmaker/fan_miot.py", line 153, in mode
    return OperationMode[OperationModeMiot(self.data["mode"]).name]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: None is not a valid OperationModeMiot
2023-11-24 12:11:30.219 WARNING (SyncWorker_10) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9
2023-11-24 12:11:30.239 DEBUG (SyncWorker_10) [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\x19t\x92\xc1\x00#=?' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('197492c1')
            ts = 1970-01-27 17:30:39
        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)
2023-11-24 12:11:30.241 DEBUG (SyncWorker_10) [miio.miioprotocol] Discovered 197492c1 with ts: 1970-01-27 17:30:39, token: b'ffffffffffffffffffffffffffffffff'
2023-11-24 12:11:30.243 DEBUG (SyncWorker_10) [miio.miioprotocol] 192.168.0.130:54321 >>: {'id': 4, 'method': 'set_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 1, 'value': True}]}
2023-11-24 12:11:30.454 DEBUG (SyncWorker_10) [miio.miioprotocol] 192.168.0.130:54321 (ts: 1970-01-27 17:30:39, id: 4) << {'id': 4, 'result': [{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0}], 'exe_time': 152}
2023-11-24 12:11:30.456 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.device] Response received from miio device: [{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0}]
2023-11-24 12:11:34.208 WARNING (SyncWorker_4) [miio.miot_device] Unable to find mapping for dmaker.fan.p39, falling back to dmaker.fan.p9
2023-11-24 12:11:34.228 DEBUG (SyncWorker_4) [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\x19t\x92\xc1\x00#=C' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('197492c1')
            ts = 1970-01-27 17:30:43
        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)
2023-11-24 12:11:34.230 DEBUG (SyncWorker_4) [miio.miioprotocol] Discovered 197492c1 with ts: 1970-01-27 17:30:43, token: b'ffffffffffffffffffffffffffffffff'
2023-11-24 12:11:34.231 DEBUG (SyncWorker_4) [miio.miioprotocol] 192.168.0.130:54321 >>: {'id': 5, 'method': 'set_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 1, 'value': False}]}
2023-11-24 12:11:34.436 DEBUG (SyncWorker_4) [miio.miioprotocol] 192.168.0.130:54321 (ts: 1970-01-27 17:30:43, id: 5) << {'id': 5, 'result': [{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0}], 'exe_time': 147}
2023-11-24 12:11:34.437 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.device] Response received from miio device: [{'did': 'power', 'siid': 2, 'piid': 1, 'code': 0}]

miiocli in debug mode (fanmiot):

$ miiocli -d fanmiot --ip 192.168.0.130 --token f909f500a314e0e66a5610d6ac64df65 info
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\x19t\x92\xc1\x00#LD' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('197492c1')
            ts = 1970-01-27 18:34:44
        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 197492c1 with ts: 1970-01-27 18:34:44, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.130:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:192.168.0.130:54321 (ts: 1970-01-27 18:34:45, id: 1) << {'id': 1, 'result': {'life': 2313285, 'uid': 8203112917, 'model': 'dmaker.fan.p39', 'token': 'f909f500a314e0e66a5610d6ac64df65', 'ipflag': 1, 'fw_ver': '2.0.5', 'mcu_fw_ver': '0002', 'miio_ver': '0.0.9', 'hw_ver': 'RTL8720C', 'mmfree': 45456, 'mac': '58:B6:23:D3:95:56', 'wifi_fw_ver': 'v7.1a_rc4_r38993', 'ap': {'ssid': 'dlink-8CA4', 'bssid': '70:62:B8:70:8C:A4', 'rssi': -44, 'primary': 3}, 'netif': {'localIp': '192.168.0.130', 'mask': '255.255.255.0', 'gw': '192.168.0.1'}}, 'exe_time': 62}
DEBUG:miio.device:Detected model dmaker.fan.p39
WARNING:miio.device:Found an unsupported model 'dmaker.fan.p39' for class 'FanMiot'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
Model: dmaker.fan.p39
Hardware version: RTL8720C
Firmware version: 2.0.5

miiocli in debug mode (device):

$ miiocli -d device --ip 192.168.0.130 --token f909f500a314e0e66a5610d6ac64df65 info
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\x19t\x92\xc1\x00#L\x8f' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('197492c1')
            ts = 1970-01-27 18:35:59
        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 197492c1 with ts: 1970-01-27 18:35:59, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.130:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:192.168.0.130:54321 (ts: 1970-01-27 18:35:59, id: 1) << {'id': 1, 'result': {'life': 2313359, 'uid': 8203112917, 'model': 'dmaker.fan.p39', 'token': 'f909f500a314e0e66a5610d6ac64df65', 'ipflag': 1, 'fw_ver': '2.0.5', 'mcu_fw_ver': '0002', 'miio_ver': '0.0.9', 'hw_ver': 'RTL8720C', 'mmfree': 45472, 'mac': '58:B6:23:D3:95:56', 'wifi_fw_ver': 'v7.1a_rc4_r38993', 'ap': {'ssid': 'dlink-8CA4', 'bssid': '70:62:B8:70:8C:A4', 'rssi': -44, 'primary': 3}, 'netif': {'localIp': '192.168.0.130', 'mask': '255.255.255.0', 'gw': '192.168.0.1'}}, 'exe_time': 60}
DEBUG:miio.device:Detected model dmaker.fan.p39
Model: dmaker.fan.p39
Hardware version: RTL8720C
Firmware version: 2.0.5
@iwconfig iwconfig added the bug label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant