From 02cc6a2f9a564b7a021c6e7f84e397000bd38738 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Sun, 11 Nov 2018 17:46:28 +0100 Subject: [PATCH] Fix hangouts notify (#18372) * Remove notify schema from hangouts platform * Notify platforms shouldn't overwrite the notify component service schema. That has no effect. * Fix hangouts service data key value --- homeassistant/components/notify/hangouts.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/notify/hangouts.py b/homeassistant/components/notify/hangouts.py index 01f98146f4c..7261663b99f 100644 --- a/homeassistant/components/notify/hangouts.py +++ b/homeassistant/components/notify/hangouts.py @@ -9,13 +9,12 @@ import logging import voluptuous as vol from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA, - NOTIFY_SERVICE_SCHEMA, BaseNotificationService, ATTR_MESSAGE, ATTR_DATA) from homeassistant.components.hangouts.const \ - import (DOMAIN, SERVICE_SEND_MESSAGE, MESSAGE_DATA_SCHEMA, - TARGETS_SCHEMA, CONF_DEFAULT_CONVERSATIONS) + import (DOMAIN, SERVICE_SEND_MESSAGE, TARGETS_SCHEMA, + CONF_DEFAULT_CONVERSATIONS) _LOGGER = logging.getLogger(__name__) @@ -25,11 +24,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_DEFAULT_CONVERSATIONS): [TARGETS_SCHEMA] }) -NOTIFY_SERVICE_SCHEMA = NOTIFY_SERVICE_SCHEMA.extend({ - vol.Optional(ATTR_TARGET): [TARGETS_SCHEMA], - vol.Optional(ATTR_DATA, default={}): MESSAGE_DATA_SCHEMA -}) - def get_service(hass, config, discovery_info=None): """Get the Hangouts notification service.""" @@ -61,8 +55,9 @@ class HangoutsNotificationService(BaseNotificationService): service_data = { ATTR_TARGET: target_conversations, ATTR_MESSAGE: messages, - ATTR_DATA: kwargs[ATTR_DATA] } + if kwargs[ATTR_DATA]: + service_data[ATTR_DATA] = kwargs[ATTR_DATA] return self.hass.services.call( DOMAIN, SERVICE_SEND_MESSAGE, service_data=service_data)