cnk700i / havcs

Home Assistant Voice Control Skill
https://ljr.im/articles/plugins-havcs-edible-instructions/
Apache License 2.0
307 stars 97 forks source link

天猫说控制失败 (asyncio.exceptions.CancelledError) #34

Open xuefer opened 3 years ago

xuefer commented 3 years ago

结合 https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/ 实际操作成功了但是天猫说失败了,似乎sleep被cancel了导致报错

2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Setting HeatCoolType: 0
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Setting TemRec: 0                                                                                 2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Setting SvSt: 0                                                                                   2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Setting SlpMod: 0
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Done setting acOptions
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Overwriting acOptions with new settings
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Overwriting Pow: 1
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Done overwriting acOptions
2020-09-07 04:00:34 INFO (SyncWorker_13) [custom_components.gree.climate] Start sending state to HVAC
2020-09-07 04:00:36 ERROR (MainThread) [custom_components.havcs.http] [http] handle fail: Traceback (most recent call last):
  File "/var/lib/homeassistant/custom_components/havcs/http.py", line 56, in post
    response = await self._hass.data[INTEGRATION][DATA_HAVCS_HANDLER][platform].handleRequest(json.loads(data), refresh_token)
  File "/var/lib/homeassistant/custom_components/havcs/aligenie.py", line 188, in handleRequest
    err_result, content = await self.process_control_command(data)
  File "/var/lib/homeassistant/custom_components/havcs/helper.py", line 116, in process_control_command
    result = await self._hass.services.async_call(domain_list[i], service_list[i], data_list[i], True)
  File "/custom/mnt/data/var/lib/homeassistant/venv/lib/python3.8/site-packages/homeassistant/core.py", line 1293, in async_call
    await asyncio.wait({task}, timeout=limit)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 426, in wait
  File "/usr/lib/python3.8/asyncio/tasks.py", line 523, in _wait
asyncio.exceptions.CancelledError
2020-09-07 04:02:51 ERROR (MainThread) [custom_components.havcs.http] [http] handle fail: Traceback (most recent call last):
  File "/var/lib/homeassistant/custom_components/havcs/http.py", line 56, in post
    response = await self._hass.data[INTEGRATION][DATA_HAVCS_HANDLER][platform].handleRequest(json.loads(data), refresh_token)
  File "/var/lib/homeassistant/custom_components/havcs/aligenie.py", line 188, in handleRequest
    err_result, content = await self.process_control_command(data)
  File "/var/lib/homeassistant/custom_components/havcs/helper.py", line 129, in process_control_command
    await asyncio.sleep(1)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 648, in sleep
asyncio.exceptions.CancelledError

sleep 被别的 signal 唤醒了所以提前返回?

以下例子示范原理

# sleep 100 &
[1] 23639
# killall -USR1 sleep
[1]+  User defined signal 1   sleep 100
lkiarest commented 2 years ago

也遇到这个问题了~