2019-06-10 22:36:11 +00:00
|
|
|
"""Offer device oriented automation."""
|
|
|
|
import voluptuous as vol
|
|
|
|
|
|
|
|
from homeassistant.const import CONF_DOMAIN, CONF_PLATFORM
|
|
|
|
from homeassistant.loader import async_get_integration
|
|
|
|
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
TRIGGER_SCHEMA = vol.Schema(
|
|
|
|
{vol.Required(CONF_PLATFORM): "device", vol.Required(CONF_DOMAIN): str},
|
|
|
|
extra=vol.ALLOW_EXTRA,
|
|
|
|
)
|
2019-06-10 22:36:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_trigger(hass, config, action, automation_info):
|
|
|
|
"""Listen for trigger."""
|
|
|
|
integration = await async_get_integration(hass, config[CONF_DOMAIN])
|
2019-07-31 19:25:30 +00:00
|
|
|
platform = integration.get_platform("device_automation")
|
2019-06-10 22:36:11 +00:00
|
|
|
return await platform.async_trigger(hass, config, action, automation_info)
|