2017-02-21 05:53:55 +00:00
|
|
|
"""Provide configuration end points for Groups."""
|
2020-09-30 14:13:53 +00:00
|
|
|
from homeassistant.components.group import (
|
|
|
|
DOMAIN,
|
|
|
|
GROUP_SCHEMA,
|
|
|
|
GroupIntegrationRegistry,
|
|
|
|
)
|
2019-10-15 23:15:26 +00:00
|
|
|
from homeassistant.config import GROUP_CONFIG_PATH
|
2019-12-08 16:57:28 +00:00
|
|
|
from homeassistant.const import SERVICE_RELOAD
|
2021-03-29 23:24:36 +00:00
|
|
|
from homeassistant.core import HomeAssistant, callback
|
2017-02-21 05:53:55 +00:00
|
|
|
import homeassistant.helpers.config_validation as cv
|
|
|
|
|
2019-03-21 05:56:46 +00:00
|
|
|
from . import EditKeyBasedConfigView
|
2017-02-21 05:53:55 +00:00
|
|
|
|
|
|
|
|
2018-10-01 06:50:05 +00:00
|
|
|
async def async_setup(hass):
|
2017-04-30 05:04:49 +00:00
|
|
|
"""Set up the Group config API."""
|
2019-07-31 19:25:30 +00:00
|
|
|
|
2020-01-27 07:01:35 +00:00
|
|
|
async def hook(action, config_key):
|
2017-12-01 20:53:46 +00:00
|
|
|
"""post_write_hook for Config View that reloads groups."""
|
2018-10-01 06:50:05 +00:00
|
|
|
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)
|
2017-12-01 20:53:46 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
hass.http.register_view(
|
|
|
|
EditKeyBasedConfigView(
|
2019-10-15 23:15:26 +00:00
|
|
|
"group",
|
|
|
|
"config",
|
|
|
|
GROUP_CONFIG_PATH,
|
|
|
|
cv.slug,
|
|
|
|
GROUP_SCHEMA,
|
|
|
|
post_write_hook=hook,
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
|
|
|
)
|
2017-02-21 05:53:55 +00:00
|
|
|
return True
|
2020-09-30 14:13:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
def async_describe_on_off_states(
|
2021-03-29 23:24:36 +00:00
|
|
|
hass: HomeAssistant, registry: GroupIntegrationRegistry
|
2020-09-30 14:13:53 +00:00
|
|
|
) -> None:
|
|
|
|
"""Describe group on off states."""
|
|
|
|
return
|