fineemb / lovelace-air-filter-card

用于Lovelace的小米空气净化器卡片
12 stars 9 forks source link

Xiaomi Mi Air Purifier File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 651, in _try_command #2

Closed paarak closed 4 years ago

paarak commented 4 years ago

Hello. is only 1 thing that does not work .. When I choose mode Strong I get error, change to Strong or Favorite comes the same error

`speed_list:

`Loggdetaljer (ERROR) Logger: homeassistant.components.websocket_api.http.connection.139985340805776 Source: components/system_log/init.py:97 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 7:07:02 (1 occurrences) Last logged: 7:07:02

not all arguments converted during string formatting Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 651, in _try_command partial(func, *args, *kwargs) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(self.args, **self.kwargs) File "/usr/local/lib/python3.7/site-packages/miio/airpurifier.py", line 448, in set_mode return self.send("set_mode", [mode.value]) File "/usr/local/lib/python3.7/site-packages/miio/device.py", line 124, in send return self._protocol.send(command, parameters, retry_count) File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 196, in send raise DeviceError(error) miio.exceptions.DeviceError: {'code': -5001, 'message': 'invaild_arg'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service`

MrUkleja commented 4 years ago

Hi,

I also have Xiaomi Air Purifier. In my case, no metter which modes I select in config, it always works as if first would be set to "auto" and second to "silent". Third one gives me error:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 651, in _try_command partial(func, *args, *kwargs) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(self.args, **self.kwargs) File "/usr/local/lib/python3.7/site-packages/miio/airpurifier.py", line 448, in set_mode return self.send("set_mode", [mode.value]) File "/usr/local/lib/python3.7/site-packages/miio/device.py", line 124, in send return self._protocol.send(command, parameters, retry_count) File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 196, in send raise DeviceError(error) miio.exceptions.DeviceError: {'code': -5001, 'message': 'invaild_arg'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1247, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1282, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service self._platforms.values(), func, call, required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 453, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 484, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 814, in async_set_speed AirpurifierOperationMode[speed.title()], File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/fan.py", line 658, in _try_command _LOGGER.error(mask_error, exc) File "/usr/local/lib/python3.7/logging/init.py", line 1407, in error self._log(ERROR, msg, args, **kwargs) File "/usr/local/lib/python3.7/logging/init.py", line 1514, in _log self.handle(record) File "/usr/local/lib/python3.7/logging/init.py", line 1524, in handle self.callHandlers(record) File "/usr/local/lib/python3.7/logging/init.py", line 1586, in callHandlers hdlr.handle(record) File "/usr/local/lib/python3.7/logging/init.py", line 894, in handle self.emit(record) File "/usr/src/homeassistant/homeassistant/components/system_log/init.py", line 181, in emit record, stack, _figure_out_source(record, stack, self.hass) File "/usr/src/homeassistant/homeassistant/components/system_log/init.py", line 97, in init self.message = deque([record.getMessage()], maxlen=5) File "/usr/local/lib/python3.7/logging/init.py", line 369, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting

And here is device in home assistant:

speed_list: Auto, Silent, Favorite, Idle model: zhimi.airpurifier.m1 temperature: 21.4 humidity: 36 aqi: 10 mode: idle filter_hours_used: 593 filter_life_remaining: 83 favorite_level: 16 child_lock: false led: true motor_speed: 0 average_aqi: 8 learn_mode: false extra_features: 1 turbo_mode_supported: true button_pressed: power purify_volume: 382286 sleep_time: 737 sleep_mode_learn_count: null auto_detect: null use_time: 36056011 buzzer: false led_brightness: 1 sleep_mode: silent friendly_name: Oczyszczacz Powietrza supported_features: 1

fineemb commented 4 years ago

fix v1.1.2

MrUkleja commented 4 years ago

Works for me, thank you :)