Make statistics validation create issue registry issues (#122595)
* Make statistics validation create issue registry issues * Disable creating issue about outdated MariaDB version in tests * Use call_soon_threadsafe instead of run_callback_threadsafe * Update tests * Fix flapping test * Disable creating issue about outdated SQLite version in tests * Implement agreed changes * Add translation strings for issue titles * Update test
This commit is contained in:
parent
d6e34e0984
commit
771575cfc5
9 changed files with 395 additions and 109 deletions
|
@ -43,6 +43,7 @@ from .statistics import (
|
|||
list_statistic_ids,
|
||||
statistic_during_period,
|
||||
statistics_during_period,
|
||||
update_statistics_issues,
|
||||
validate_statistics,
|
||||
)
|
||||
from .util import PERIOD_SCHEMA, get_instance, resolve_period
|
||||
|
@ -80,6 +81,7 @@ def async_setup(hass: HomeAssistant) -> None:
|
|||
websocket_api.async_register_command(hass, ws_get_statistics_metadata)
|
||||
websocket_api.async_register_command(hass, ws_list_statistic_ids)
|
||||
websocket_api.async_register_command(hass, ws_import_statistics)
|
||||
websocket_api.async_register_command(hass, ws_update_statistics_issues)
|
||||
websocket_api.async_register_command(hass, ws_update_statistics_metadata)
|
||||
websocket_api.async_register_command(hass, ws_validate_statistics)
|
||||
|
||||
|
@ -292,6 +294,24 @@ async def ws_validate_statistics(
|
|||
connection.send_result(msg["id"], statistic_ids)
|
||||
|
||||
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required("type"): "recorder/update_statistics_issues",
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
async def ws_update_statistics_issues(
|
||||
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict[str, Any]
|
||||
) -> None:
|
||||
"""Update statistics issues."""
|
||||
instance = get_instance(hass)
|
||||
await instance.async_add_executor_job(
|
||||
update_statistics_issues,
|
||||
hass,
|
||||
)
|
||||
connection.send_result(msg["id"])
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue