From f0c582ebbd062509ad8f1d54d61a9c6ace59737a Mon Sep 17 00:00:00 2001 From: 4lloyd <4lloyd@users.noreply.github.com> Date: Thu, 2 May 2019 01:04:05 +0200 Subject: [PATCH] Added message to data_template at notify REST (#23108) * Added message to data_template at notify rest * Added missing newlines --- homeassistant/components/rest/notify.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/rest/notify.py b/homeassistant/components/rest/notify.py index 8134e73ae6b..50b9436ba00 100644 --- a/homeassistant/components/rest/notify.py +++ b/homeassistant/components/rest/notify.py @@ -11,8 +11,8 @@ from homeassistant.const import ( import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( - ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, - BaseNotificationService) + ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, ATTR_MESSAGE, + PLATFORM_SCHEMA, BaseNotificationService) CONF_DATA = 'data' CONF_DATA_TEMPLATE = 'data_template' @@ -110,6 +110,8 @@ class RestNotificationService(BaseNotificationService): if self._data: data.update(self._data) elif self._data_template: + kwargs[ATTR_MESSAGE] = message + def _data_template_creator(value): """Recursive template creator helper function.""" if isinstance(value, list): @@ -119,6 +121,7 @@ class RestNotificationService(BaseNotificationService): for key, item in value.items()} value.hass = self._hass return value.async_render(kwargs) + data.update(_data_template_creator(self._data_template)) if self._method == 'POST':