This commit is contained in:
Lewis Juggins authored and Paulus Schoutsen committed 2016-09-10 07:36:55 -07:00
1 parent d466bae244
commit de150ecbc9
2 files changed
+44 -10

No files matched your search

+11 -8
View File
@@ -91,19 +91,22 @@ def setup(hass, config):
def notify_message(notify_service, call):
"""Handle sending notification message service calls."""
kwargs = {}
message = call.data[ATTR_MESSAGE]
title = call.data.get(ATTR_TITLE)
if title:
kwargs[ATTR_TITLE] = template.render(hass, title)
title = template.render(
hass, call.data.get(ATTR_TITLE, ATTR_TITLE_DEFAULT))
if targets.get(call.service) is not None:
target = targets[call.service]
kwargs[ATTR_TARGET] = targets[call.service]
else:
target = call.data.get(ATTR_TARGET)
message = template.render(hass, message)
data = call.data.get(ATTR_DATA)
kwargs[ATTR_TARGET] = call.data.get(ATTR_TARGET)
notify_service.send_message(message, title=title, target=target,
data=data)
kwargs[ATTR_MESSAGE] = template.render(hass, message)
kwargs[ATTR_DATA] = call.data.get(ATTR_DATA)
notify_service.send_message(**kwargs)
service_call_handler = partial(notify_message, notify_service)