mirror of
https://github.com/home-assistant/core
synced 2024-08-31 05:57:13 +02:00
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
This commit is contained in:
parent
9cb6464c58
commit
02cc6a2f9a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user