Use report_usage in integrations (#130366)

This commit is contained in:
epenet 2024-11-11 20:09:26 +01:00 committed by GitHub
parent f3708549f0
commit 906bdda6fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@ from homeassistant.components.media_player import (
from homeassistant.components.websocket_api import ActiveConnection from homeassistant.components.websocket_api import ActiveConnection
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.frame import report from homeassistant.helpers.frame import report_usage
from homeassistant.helpers.integration_platform import ( from homeassistant.helpers.integration_platform import (
async_process_integration_platforms, async_process_integration_platforms,
) )
@ -156,7 +156,7 @@ async def async_resolve_media(
raise Unresolvable("Media Source not loaded") raise Unresolvable("Media Source not loaded")
if target_media_player is UNDEFINED: if target_media_player is UNDEFINED:
report( report_usage(
"calls media_source.async_resolve_media without passing an entity_id", "calls media_source.async_resolve_media without passing an entity_id",
exclude_integrations={DOMAIN}, exclude_integrations={DOMAIN},
) )

View File

@ -16,7 +16,7 @@ from sqlalchemy.pool import (
StaticPool, StaticPool,
) )
from homeassistant.helpers.frame import report from homeassistant.helpers.frame import ReportBehavior, report_usage
from homeassistant.util.loop import raise_for_blocking_call from homeassistant.util.loop import raise_for_blocking_call
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -108,14 +108,14 @@ class RecorderPool(SingletonThreadPool, NullPool):
# raise_for_blocking_call will raise an exception # raise_for_blocking_call will raise an exception
def _do_get_db_connection_protected(self) -> ConnectionPoolEntry: def _do_get_db_connection_protected(self) -> ConnectionPoolEntry:
report( report_usage(
( (
"accesses the database without the database executor; " "accesses the database without the database executor; "
f"{ADVISE_MSG} " f"{ADVISE_MSG} "
"for faster database operations" "for faster database operations"
), ),
exclude_integrations={"recorder"}, exclude_integrations={"recorder"},
error_if_core=False, core_behavior=ReportBehavior.LOG,
) )
return NullPool._create_connection(self) # noqa: SLF001 return NullPool._create_connection(self) # noqa: SLF001

View File

@ -4,7 +4,7 @@ from typing import Any
import zeroconf import zeroconf
from homeassistant.helpers.frame import report from homeassistant.helpers.frame import ReportBehavior, report_usage
from .models import HaZeroconf from .models import HaZeroconf
@ -16,14 +16,14 @@ def install_multiple_zeroconf_catcher(hass_zc: HaZeroconf) -> None:
""" """
def new_zeroconf_new(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> HaZeroconf: def new_zeroconf_new(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> HaZeroconf:
report( report_usage(
( (
"attempted to create another Zeroconf instance. Please use the shared" "attempted to create another Zeroconf instance. Please use the shared"
" Zeroconf via await" " Zeroconf via await"
" homeassistant.components.zeroconf.async_get_instance(hass)" " homeassistant.components.zeroconf.async_get_instance(hass)"
), ),
exclude_integrations={"zeroconf"}, exclude_integrations={"zeroconf"},
error_if_core=False, core_behavior=ReportBehavior.LOG,
) )
return hass_zc return hass_zc