mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
move action registration into platform setup
This commit is contained in:
parent
7e117dfac6
commit
f02b5de7b5
@ -12,7 +12,8 @@ from synology_dsm.exceptions import SynologyDSMNotLoggedInException
|
|||||||
from homeassistant.const import CONF_MAC, CONF_SCAN_INTERVAL, CONF_VERIFY_SSL
|
from homeassistant.const import CONF_MAC, CONF_SCAN_INTERVAL, CONF_VERIFY_SSL
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .common import SynoApi, raise_config_entry_auth_error
|
from .common import SynoApi, raise_config_entry_auth_error
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -36,9 +37,17 @@ from .coordinator import (
|
|||||||
)
|
)
|
||||||
from .service import async_setup_services
|
from .service import async_setup_services
|
||||||
|
|
||||||
|
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
|
"""Set up the Synology DSM services."""
|
||||||
|
await async_setup_services(hass)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry) -> bool:
|
||||||
"""Set up Synology DSM sensors."""
|
"""Set up Synology DSM sensors."""
|
||||||
|
|
||||||
@ -89,9 +98,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry)
|
|||||||
details = EXCEPTION_UNKNOWN
|
details = EXCEPTION_UNKNOWN
|
||||||
raise ConfigEntryNotReady(details) from err
|
raise ConfigEntryNotReady(details) from err
|
||||||
|
|
||||||
# Services
|
|
||||||
await async_setup_services(hass)
|
|
||||||
|
|
||||||
# For SSDP compat
|
# For SSDP compat
|
||||||
if not entry.data.get(CONF_MAC):
|
if not entry.data.get(CONF_MAC):
|
||||||
hass.config_entries.async_update_entry(
|
hass.config_entries.async_update_entry(
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
rules:
|
rules:
|
||||||
# Bronze
|
# Bronze
|
||||||
action-setup:
|
action-setup: done
|
||||||
status: todo
|
|
||||||
comment: services are still registered in entry setup
|
|
||||||
appropriate-polling: done
|
appropriate-polling: done
|
||||||
brands: done
|
brands: done
|
||||||
common-modules: done
|
common-modules: done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user