Support reloading the universal platform (#39248)

This commit is contained in:
J. Nick Koston 2020-08-25 17:25:15 -05:00 committed by GitHub
parent 63ebea1706
commit 90842fcb84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 300 additions and 82 deletions

View file

@ -17,7 +17,7 @@ from homeassistant.exceptions import TemplateError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.script import Script
from . import async_setup_platform_reloadable
from . import async_setup_reload_service
from .const import CONF_AVAILABILITY_TEMPLATE
from .template_entity import TemplateEntity
@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
)
async def async_create_entities(hass, config):
async def _async_create_entities(hass, config):
"""Create the Template lock."""
device = config.get(CONF_NAME)
value_template = config.get(CONF_VALUE_TEMPLATE)
@ -65,8 +65,8 @@ async def async_create_entities(hass, config):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the template lock."""
await async_setup_platform_reloadable(hass)
async_add_entities(await async_create_entities(hass, config))
await async_setup_reload_service(hass)
async_add_entities(await _async_create_entities(hass, config))
class TemplateLock(TemplateEntity, LockEntity):