mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Support templating MQTT triggers (#45614)
* Add support for limited templates (no HASS access) * Pass variables to automation triggers * Support templates in MQTT triggers * Spelling * Handle trigger referenced by variables * Raise on unsupported function in limited templates * Validate MQTT trigger schema in MQTT device trigger * Add trigger_variables to automation config schema * Don't print stacktrace when setting up trigger throws * Make pylint happy * Add trigger_variables to variables * Add debug prints, document limited template * Add tests * Validate MQTT trigger topic early when possible * Improve valid_subscribe_topic_template
This commit is contained in:
@@ -8,6 +8,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.loader import IntegrationNotFound, async_get_integration
|
||||
|
||||
@@ -79,7 +80,9 @@ async def async_initialize_triggers(
|
||||
removes = []
|
||||
|
||||
for result in attach_results:
|
||||
if isinstance(result, Exception):
|
||||
if isinstance(result, HomeAssistantError):
|
||||
log_cb(logging.ERROR, f"Got error '{result}' when setting up triggers for")
|
||||
elif isinstance(result, Exception):
|
||||
log_cb(logging.ERROR, "Error setting up trigger", exc_info=result)
|
||||
elif result is None:
|
||||
log_cb(
|
||||
|
||||
Reference in New Issue
Block a user