roleoroleo / yi-hack-Allwinner-v2

Custom firmware for Yi 1080p camera based on Allwinner platform
MIT License
752 stars 90 forks source link

can't use switch in automations #901

Open bedson87 opened 6 days ago

bedson87 commented 6 days ago

Home Assistant 2024.6.4 Log from ha: Logger: homeassistant.helpers.script.websocket_api_script Source: helpers/script.py:526 First occurred: 7:25:48 AM (1 occurrences) Last logged: 7:25:48 AM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Detected that custom integration 'yi_hack' calls hass.async_create_task from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassasync_create_task at custom_components/yi_hack/switch.py, line 176: self.hass.async_create_task(. Please report it to the author of the 'yi_hack' custom integration. Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1684, in async_turn_off await self.hass.async_add_executor_job(ft.partial(self.turn_off, *kwargs)) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/yi_hack/switch.py", line 176, in turn_off self.hass.async_create_task( File "/usr/src/homeassistant/homeassistant/core.py", line 805, in async_create_task self.verify_event_loop_thread("hass.async_create_task") File "/usr/src/homeassistant/homeassistant/core.py", line 447, in verify_event_loop_thread frame.report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration raise RuntimeError( RuntimeError: Detected that custom integration 'yi_hack' calls hass.async_create_task from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassasync_create_task at custom_components/yi_hack/switch.py, line 176: self.hass.async_create_task(. Please report it to the author of the 'yi_hack' custom integration.