1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add websock command to query device for triggers (#24044)

* Add websock command to query device for triggers

* Lint

* Refactor

* Add support for domain automations

* Make device automation an automation platform

* lint

* Support device_id in light trigger

* Review comments

* Add tests

* Add tests

* lint
This commit is contained in:
Erik Montnemery
2019-06-11 00:36:11 +02:00
committed by Paulus Schoutsen
parent 168f20bdf4
commit 935240f8c3
9 changed files with 388 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
"""Offer device oriented automation."""
import voluptuous as vol
from homeassistant.const import CONF_DOMAIN, CONF_PLATFORM
from homeassistant.loader import async_get_integration
TRIGGER_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'device',
vol.Required(CONF_DOMAIN): str,
}, extra=vol.ALLOW_EXTRA)
async def async_trigger(hass, config, action, automation_info):
"""Listen for trigger."""
integration = await async_get_integration(hass, config[CONF_DOMAIN])
platform = integration.get_platform('device_automation')
return await platform.async_trigger(hass, config, action, automation_info)