Add the ability to reload light/cover groups from yaml (#39250)
* Add the ability to reload light/cover groups from yaml Update previous usage to reduce code duplication. * Fix conflict from rebase
This commit is contained in:
1 parent
e109b04efe
commit
810df38f0d
16 files changed
+175
-56
No files matched your search
@@ -34,6 +34,7 @@ import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.reload import async_reload_integration_platforms
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
@@ -57,6 +58,8 @@ ATTR_ALL = "all"
|
||||
SERVICE_SET = "set"
|
||||
SERVICE_REMOVE = "remove"
|
||||
|
||||
PLATFORMS = ["light", "cover"]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -219,6 +222,8 @@ async def async_setup(hass, config):
|
||||
|
||||
await component.async_add_entities(auto)
|
||||
|
||||
await async_reload_integration_platforms(hass, DOMAIN, PLATFORMS)
|
||||
|
||||
hass.services.async_register(
|
||||
DOMAIN, SERVICE_RELOAD, reload_service_handler, schema=vol.Schema({})
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user