Webhook names (#18206)
* Add new automation_info param to async_trigger * Add domain and name to webhook registration and add WS command
This commit is contained in:
parent
6e4ce35a69
commit
2e9132873a
20 changed files with 119 additions and 54 deletions
|
@ -14,6 +14,8 @@ from homeassistant.core import callback
|
|||
from homeassistant.const import CONF_PLATFORM, CONF_WEBHOOK_ID
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import DOMAIN as AUTOMATION_DOMAIN
|
||||
|
||||
DEPENDENCIES = ('webhook',)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -39,10 +41,11 @@ async def _handle_webhook(action, hass, webhook_id, request):
|
|||
hass.async_run_job(action, {'trigger': result})
|
||||
|
||||
|
||||
async def async_trigger(hass, config, action):
|
||||
async def async_trigger(hass, config, action, automation_info):
|
||||
"""Trigger based on incoming webhooks."""
|
||||
webhook_id = config.get(CONF_WEBHOOK_ID)
|
||||
hass.components.webhook.async_register(
|
||||
AUTOMATION_DOMAIN, automation_info['name'],
|
||||
webhook_id, partial(_handle_webhook, action))
|
||||
|
||||
@callback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue