ha0y / xiaomi_miot_raw

All-in-one & Easy-to-use. Integrate all your Xiaomi Smart Home - with a single integration and NO YAML files - into Home Assistant.
Apache License 2.0
2.2k stars 230 forks source link

"Call-service error. wait() got an unexpected keyword argument 'loop'" #504

Open ccssuit opened 1 year ago

ccssuit commented 1 year ago

homeassistant日志 此错误来自自定义集成。 Logger: homeassistant.helpers.script.websocket_api_script Source: custom_components/xiaomi_miot_raw/basic_dev_class.py:709 Integration: Xiaomi MIoT (documentation, issues) First occurred: 2023年4月26日 18:24:27 (7 occurrences) Last logged: 08:33:06

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: wait() got an unexpected keyword argument 'loop' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 452, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xiaomi_miot_raw/basic_dev_class.py", line 709, in async_service_handler yield from asyncio.wait(update_tasks, loop=self.hass.loop) TypeError: wait() got an unexpected keyword argument 'loop'

ccssuit commented 1 year ago

按报错信息File "/config/custom_components/xiaomi_miot_raw/basic_dev_class.py", line 709, in async_service_handler yield from asyncio.wait(update_tasks, loop=self.hass.loop) 将/config/custom_components/xiaomi_miot_raw/basic_dev_class.py代码修改去掉loop=self.hass.loop,可以消除错误。 此方法有参考【调用execute_text服务,报"wait() got an unexpected keyword argument 'loop'" #468】问题的回复。

代码修改:

## yield from asyncio.wait(update_tasks, loop=self.hass.loop)
yield from asyncio.wait(update_tasks)