Skip to content

Commit

Permalink
remove CONFIG_SCHEMA
Browse files Browse the repository at this point in the history
  • Loading branch information
akropp committed Aug 7, 2023
1 parent 3c72720 commit cf13324
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
19 changes: 12 additions & 7 deletions custom_components/savantaudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
from homeassistant import config_entries, core
import homeassistant.helpers.config_validation as cv

from .const import CONF_SOURCES, CONF_ZONES, DOMAIN

CONFIG_SCHEMA = cv.empty_config_schema
from .const import CONF_SOURCES, CONF_ZONES, DOMAIN, PLATFORMS

_LOGGER = logging.getLogger(__name__)

Expand All @@ -29,9 +27,10 @@ async def async_setup_entry(
entry.async_on_unload(entry.add_update_listener(update_listener))

# Forward the setup to the media_player platform.
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "media_player")
)
for platform in PLATFORMS:
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True

async def async_unload_entry(
Expand All @@ -42,7 +41,8 @@ async def async_unload_entry(
_LOGGER.info(f'async_unload_entry: {DOMAIN}')
unload_ok = all(
await asyncio.gather(
*[hass.config_entries.async_forward_entry_unload(entry, "media_player")]
*[hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS]
)
)

Expand All @@ -62,3 +62,8 @@ async def async_setup(hass: core.HomeAssistant, config: dict) -> bool:
_LOGGER.info(f'async_setup: {DOMAIN}')
hass.data.setdefault(DOMAIN, {})
return True

async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Reload config entry."""
await async_unload_entry(hass, entry)
await async_setup_entry(hass, entry)
4 changes: 4 additions & 0 deletions custom_components/savantaudio/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@

CONF_SOURCES = "sources"
CONF_ZONES = "zones"

# platforms
MEDIA_PLAYER = "media_player"
PLATFORMS = [MEDIA_PLAYER]

0 comments on commit cf13324

Please sign in to comment.