Skip to content

Commit

Permalink
Add CONFIG_SCHEMA to analytics (#93598)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed May 26, 2023
1 parent 0bf9bb1 commit d446282
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/analytics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
from homeassistant.components import websocket_api
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import Event, HassJob, HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_call_later, async_track_time_interval
from homeassistant.helpers.typing import ConfigType

from .analytics import Analytics
from .const import ATTR_ONBOARDED, ATTR_PREFERENCES, DOMAIN, INTERVAL, PREFERENCE_SCHEMA

CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)


async def async_setup(hass: HomeAssistant, _: ConfigType) -> bool:
"""Set up the analytics integration."""
Expand Down
5 changes: 5 additions & 0 deletions homeassistant/helpers/config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,11 @@ def expand_condition_shorthand(value: Any | None) -> Any:


# Schemas
def empty_config_schema(domain: str) -> vol.Schema:
"""Return a config schema which accepts no configuration parameters."""
return vol.Schema({vol.Optional(domain): vol.Schema({})}, extra=vol.ALLOW_EXTRA)


PLATFORM_SCHEMA = vol.Schema(
{
vol.Required(CONF_PLATFORM): string,
Expand Down

0 comments on commit d446282

Please sign in to comment.