homeassistant-edata
homeassistant-edata copied to clipboard
edata.recreate_statistics no funciona
He intentado recrear los statistics, pero me da un error 'unknown'. He reinciado Home Assistant y e reinstalado edata 2-3 veces.
2023-07-26 16:16:33.722 WARNING (MainThread) [custom_components.edata.stats] Clearing statistics for ['edata:sv0f_consumption', 'edata:sv0f_p1_consumption', 'edata:sv0f_p2_consumption', 'edata:sv0f_p3_consumption', 'edata:sv0f_maximeter', 'edata:sv0f_p1_maximeter', 'edata:sv0f_p2_maximeter', 'edata:sv0f_cost', 'edata:sv0f_p1_cost', 'edata:sv0f_p2_cost', 'edata:sv0f_p3_cost', 'edata:sv0f_power_cost', 'edata:sv0f_energy_cost', 'edata:sv0f_p1_energy_cost', 'edata:sv0f_p2_energy_cost', 'edata:sv0f_p3_energy_cost']
2023-07-26 16:16:33.723 ERROR (DbWorker_1) [homeassistant.components.recorder.util] Error executing query: Detected unsafe call not in recorder thread
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 130, in session_scope
yield session
File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 659, in clear_statistics
instance.statistics_meta_manager.delete(session, statistic_ids)
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 325, in delete
self._assert_in_recorder_thread()
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 126, in _assert_in_recorder_thread
raise RuntimeError("Detected unsafe call not in recorder thread")
RuntimeError: Detected unsafe call not in recorder thread
2023-07-26 16:16:33.725 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Detected unsafe call not in recorder thread
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
return await cast(
^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 866, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
response_data = task.result() # pop exception if have
^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
return await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/edata/sensor.py", line 222, in service_recreate_statistics
await self._coordinator.statistics.clear_all_statistics()
File "/config/custom_components/edata/stats.py", line 162, in clear_all_statistics
await get_db_instance(self.hass).async_add_executor_job(
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 659, in clear_statistics
instance.statistics_meta_manager.delete(session, statistic_ids)
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 325, in delete
self._assert_in_recorder_thread()
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 126, in _assert_in_recorder_thread
raise RuntimeError("Detected unsafe call not in recorder thread")
RuntimeError: Detected unsafe call not in recorder thread
2023-07-26 16:16:33.729 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140210263851472] Error handling message: Unknown error (unknown_error) Petar from 213.195.120.184 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/113.0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 680, in handle_execute_script
response = await script_obj.async_run(msg.get("variables"), context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1569, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
return await cast(
^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 866, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
response_data = task.result() # pop exception if have
^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
return await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/edata/sensor.py", line 222, in service_recreate_statistics
await self._coordinator.statistics.clear_all_statistics()
File "/config/custom_components/edata/stats.py", line 162, in clear_all_statistics
await get_db_instance(self.hass).async_add_executor_job(
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 659, in clear_statistics
instance.statistics_meta_manager.delete(session, statistic_ids)
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 325, in delete
self._assert_in_recorder_thread()
File "/usr/src/homeassistant/homeassistant/components/recorder/table_managers/statistics_meta.py", line 126, in _assert_in_recorder_thread
raise RuntimeError("Detected unsafe call not in recorder thread")
RuntimeError: Detected unsafe call not in recorder thread