BaseNotificationService) _LOGGER = logging.getLogger(__name__) CONF_PANEL = 'panel' CONF_CLOUDID = 'cloudid' DEFAULT_PANEL = None VALID_PANELS = {'info', 'note', 'tip', 'warning', None} PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_CLOUDID): cv.string, vol.Required(CONF_ROOM): cv.string, vol.Required(CONF_TOKEN): cv.string, vol.Optional(CONF_PANEL, default=DEFAULT_PANEL): vol.In(VALID_PANELS), }) def get_service(hass, config, discovery_info=None): """Get the Stride notification service.""" return StrideNotificationService(config[CONF_TOKEN], config[CONF_ROOM], config[CONF_PANEL], config[CONF_CLOUDID]) class StrideNotificationService(BaseNotificationService): """Implement the notification service for Stride.""" def __init__(self, token, default_room, default_panel, cloudid):
https://home-assistant.io/components/notify.command_line/ """ import logging import subprocess import voluptuous as vol from homeassistant.const import (CONF_COMMAND, CONF_NAME) from homeassistant.components.notify import ( BaseNotificationService, PLATFORM_SCHEMA) import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_COMMAND): cv.string, vol.Optional(CONF_NAME): cv.string, }) def get_service(hass, config): """Get the Command Line notification service.""" command = config[CONF_COMMAND] return CommandLineNotificationService(command) # pylint: disable=too-few-public-methods class CommandLineNotificationService(BaseNotificationService): """Implement the notification service for the Command Line service.""" def __init__(self, command):
""" import logging import json import requests import voluptuous as vol from homeassistant.components.notify import ( BaseNotificationService, PLATFORM_SCHEMA, ATTR_DATA) from homeassistant.const import CONF_RESOURCE import homeassistant.helpers.config_validation as cv ATTR_FILE_URL = 'file_url' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RESOURCE): cv.url, }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config, discovery_info=None): """Get the Synology Chat notification service.""" resource = config.get(CONF_RESOURCE) return SynologyChatNotificationService(resource) class SynologyChatNotificationService(BaseNotificationService): """Implementation of a notification service for Synology Chat."""
from homeassistant.const import (ATTR_ICON, CONF_HOST, CONF_PORT, CONF_USERNAME, CONF_PASSWORD) from homeassistant.components.notify import (ATTR_TITLE, ATTR_TITLE_DEFAULT, ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService) import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['jsonrpc-requests==0.3'] DEFAULT_PORT = 8080 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Inclusive(CONF_USERNAME, 'auth'): cv.string, vol.Inclusive(CONF_PASSWORD, 'auth'): cv.string, }) ATTR_DISPLAYTIME = 'displaytime' def get_service(hass, config, discovery_info=None): """Return the notify service.""" url = '{}:{}'.format(config.get(CONF_HOST), config.get(CONF_PORT)) username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) if username is not None: auth = (username, password)
from homeassistant.components.notify import ( BaseNotificationService, PLATFORM_SCHEMA, ATTR_DATA) import homeassistant.helpers.config_validation as cv from homeassistant.components.homematic import ( DOMAIN, SERVICE_SET_DEVICE_VALUE, ATTR_ADDRESS, ATTR_CHANNEL, ATTR_PARAM, ATTR_VALUE, ATTR_INTERFACE) import homeassistant.helpers.template as template_helper _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ["homematic"] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(ATTR_ADDRESS): vol.All(cv.string, vol.Upper), vol.Required(ATTR_CHANNEL): vol.Coerce(int), vol.Required(ATTR_PARAM): vol.All(cv.string, vol.Upper), vol.Required(ATTR_VALUE): cv.match_all, vol.Optional(ATTR_INTERFACE): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Homematic notification service.""" data = { ATTR_ADDRESS: config[ATTR_ADDRESS], ATTR_CHANNEL: config[ATTR_CHANNEL], ATTR_PARAM: config[ATTR_PARAM], ATTR_VALUE: config[ATTR_VALUE] } if ATTR_INTERFACE in config: data[ATTR_INTERFACE] = config[ATTR_INTERFACE]
"""Support for thr Free Mobile SMS platform.""" import logging import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import (PLATFORM_SCHEMA, BaseNotificationService) _LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_ACCESS_TOKEN): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Free Mobile SMS notification service.""" return FreeSMSNotificationService( config[CONF_USERNAME], config[CONF_ACCESS_TOKEN]) class FreeSMSNotificationService(BaseNotificationService): """Implement a notification service for the Free Mobile SMS service.""" def __init__(self, username, access_token): """Initialize the service.""" from freesms import FreeClient
import asyncio import voluptuous as vol from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES from homeassistant.components.notify import PLATFORM_SCHEMA, \ BaseNotificationService from homeassistant.const import CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv CONF_ADDRESS = 'address' DEFAULT_NAME = 'KNX Notify' DEPENDENCIES = ['knx'] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_ADDRESS): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string }) @asyncio.coroutine def async_get_service(hass, config, discovery_info=None): """Get the KNX notification service.""" if DATA_KNX not in hass.data \ or not hass.data[DATA_KNX].initialized: return False return async_get_service_discovery(hass, discovery_info) \ if discovery_info is not None else \ async_get_service_config(hass, config)
ATTR_DATA, ATTR_MESSAGE, DOMAIN, PLATFORM_SCHEMA, BaseNotificationService, ) _LOGGER = logging.getLogger(__name__) CONF_SERVICES = "services" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_SERVICES): vol.All( cv.ensure_list, [{ vol.Required(ATTR_SERVICE): cv.slug, vol.Optional(ATTR_DATA): dict }], ) }) def update(input_dict, update_source): """Deep update a dictionary. Async friendly. """ for key, val in update_source.items(): if isinstance(val, Mapping): recurse = update(input_dict.get(key, {}), val) input_dict[key] = recurse
DEFAULT_PORT = 587 DEFAULT_TIMEOUT = 5 DEFAULT_DEBUG = False DEFAULT_ENCRYPTION = "starttls" ENCRYPTION_OPTIONS = ["tls", "starttls", "none"] # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( { vol.Required(CONF_RECIPIENT): vol.All(cv.ensure_list, [vol.Email()]), vol.Required(CONF_SENDER): vol.Email(), vol.Optional(CONF_SERVER, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int, vol.Optional(CONF_ENCRYPTION, default=DEFAULT_ENCRYPTION): vol.In( ENCRYPTION_OPTIONS ), vol.Optional(CONF_USERNAME): cv.string, vol.Optional(CONF_PASSWORD): cv.string, vol.Optional(CONF_SENDER_NAME): cv.string, vol.Optional(CONF_DEBUG, default=DEFAULT_DEBUG): cv.boolean, } ) def get_service(hass, config, discovery_info=None): """Get the mail notification service.""" setup_reload_service(hass, DOMAIN, PLATFORMS) mail_service = MailNotificationService( config.get(CONF_SERVER), config.get(CONF_PORT),
"red": "#F44336", "cyan": "#00BCD4", "teal": "#009688", "amber": "#FFC107", "pink": "#E91E63", } PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_DURATION, default=DEFAULT_DURATION): vol.Coerce(int), vol.Optional(CONF_FONTSIZE, default=DEFAULT_FONTSIZE): vol.In(FONTSIZES.keys()), vol.Optional(CONF_POSITION, default=DEFAULT_POSITION): vol.In(POSITIONS.keys()), vol.Optional(CONF_TRANSPARENCY, default=DEFAULT_TRANSPARENCY): vol.In(TRANSPARENCIES.keys()), vol.Optional(CONF_COLOR, default=DEFAULT_COLOR): vol.In(COLORS.keys()), vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): vol.Coerce(int), vol.Optional(CONF_INTERRUPT, default=DEFAULT_INTERRUPT): cv.boolean, }) def get_service(hass, config, discovery_info=None): """Get the Notifications for Android TV notification service.""" remoteip = config.get(CONF_HOST) duration = config.get(CONF_DURATION) fontsize = config.get(CONF_FONTSIZE)
BaseNotificationService, ) from homeassistant.const import ( CONF_URL, HTTP_BAD_REQUEST, HTTP_BASIC_AUTHENTICATION, HTTP_DIGEST_AUTHENTICATION, HTTP_INTERNAL_SERVER_ERROR, HTTP_OK, ) import homeassistant.helpers.config_validation as cv PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_URL): cv.url, }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config, discovery_info=None): """Get the Awtrix notification service.""" _LOGGER.debug("get AWTRIX Service") config = hass.data.get(AWTRIX_DOMAIN) return AwtrixNotificationService(config[CONF_URL], ) class AwtrixNotificationService(BaseNotificationService): """Implement the notification service for awtrix."""
from homeassistant.const import CONF_PASSWORD, CONF_SENDER, CONF_RECIPIENT REQUIREMENTS = [ 'sleekxmpp==1.3.2', 'dnspython3==1.15.0', 'pyasn1==0.2.3', 'pyasn1-modules==0.0.8' ] _LOGGER = logging.getLogger(__name__) CONF_TLS = 'tls' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_SENDER): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_RECIPIENT): cv.string, vol.Optional(CONF_TLS, default=True): cv.boolean, }) def get_service(hass, config, discovery_info=None): """Get the Jabber (XMPP) notification service.""" return XmppNotificationService(config.get('sender'), config.get('password'), config.get('recipient'), config.get('tls')) class XmppNotificationService(BaseNotificationService): """Implement the notification service for Jabber (XMPP)."""
GROUP_POSTFIX = '#group#' CONF_TULING_API_KEY = 'tuling_api_key' CONF_COMMANDER = 'commander' CONF_CMD_HANDLER = 'cmd_handler' CONF_CMD_PREFIX = 'cmd_prefix' CONF_TTS_HANDLER = 'tts_handler' CONF_TTS_PREFIX = 'tts_prefix' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_TULING_API_KEY): cv.string, vol.Optional(CONF_COMMANDER): cv.string, vol.Inclusive(CONF_CMD_HANDLER, 'cmd sys', 'Cmd handler and cmd prefix must exist together'): cv.entity_id, vol.Inclusive(CONF_CMD_PREFIX, 'cmd sys', 'Cmd handler and cmd prefix must exist together'): cv.string, vol.Inclusive(CONF_CMD_HANDLER, 'tts sys', 'Tts handler and tts prefix must exist together'): cv.entity_id, vol.Inclusive(CONF_CMD_PREFIX, 'tts sys', 'Tts handler and tts prefix must exist together'): cv.string, }) def get_service(hass, config, discovery_info=None): # Imagine that the bot is your wechat client. tuling_api_key = config.get(CONF_TULING_API_KEY, None) commander = config.get(CONF_COMMANDER, None) cmd_handler = config.get(CONF_CMD_HANDLER, None) cmd_prefix = config.get(CONF_CMD_PREFIX, None) tts_handler = config.get(CONF_TTS_HANDLER, None)
from homeassistant.components.notify import (BaseNotificationService, ATTR_TITLE, PLATFORM_SCHEMA) from homeassistant.const import CONTENT_TYPE_JSON import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) CONF_CONSUMER_KEY = 'consumer_key' CONF_CONSUMER_SECRET = 'consumer_secret' CONF_PHONE_NUMBER = 'phone_number' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_CONSUMER_KEY): cv.string, vol.Required(CONF_CONSUMER_SECRET): cv.string, vol.Required(CONF_PHONE_NUMBER): cv.string, }) def get_service(hass, config): """Get the Telstra SMS API notification service.""" consumer_key = config.get(CONF_CONSUMER_KEY) consumer_secret = config.get(CONF_CONSUMER_SECRET) phone_number = config.get(CONF_PHONE_NUMBER) if _authenticate(consumer_key, consumer_secret) is False: _LOGGER.exception('Error obtaining authorization from Telstra API') return None
REQUIREMENTS = ['boto3==1.4.7'] _LOGGER = logging.getLogger(__name__) CONF_REGION = 'region_name' CONF_ACCESS_KEY_ID = 'aws_access_key_id' CONF_SECRET_ACCESS_KEY = 'aws_secret_access_key' CONF_PROFILE_NAME = 'profile_name' CONF_CONTEXT = 'context' ATTR_CREDENTIALS = 'credentials' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_REGION, default='us-east-1'): cv.string, vol.Inclusive(CONF_ACCESS_KEY_ID, ATTR_CREDENTIALS): cv.string, vol.Inclusive(CONF_SECRET_ACCESS_KEY, ATTR_CREDENTIALS): cv.string, vol.Exclusive(CONF_PROFILE_NAME, ATTR_CREDENTIALS): cv.string, vol.Optional(CONF_CONTEXT, default=dict()): vol.Coerce(dict) }) def get_service(hass, config, discovery_info=None): """Get the AWS Lambda notification service.""" context_str = json.dumps({'hass': hass.config.as_dict(), 'custom': config[CONF_CONTEXT]}, cls=JSONEncoder) context_b64 = base64.b64encode(context_str.encode('utf-8')) context = context_b64.decode('utf-8') import boto3 aws_config = config.copy()
from homeassistant.components.notify import ( ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService, ) from homeassistant.const import CONF_FILENAME import homeassistant.helpers.config_validation as cv import homeassistant.util.dt as dt_util CONF_TIMESTAMP = "timestamp" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_FILENAME): cv.string, vol.Optional(CONF_TIMESTAMP, default=False): cv.boolean, }) def get_service(hass, config, discovery_info=None): """Get the file notification service.""" filename = config[CONF_FILENAME] timestamp = config[CONF_TIMESTAMP] return FileNotificationService(hass, filename, timestamp) class FileNotificationService(BaseNotificationService): """Implement the notification service for the File service.""" def __init__(self, hass, filename, add_timestamp):
import attr import voluptuous as vol from homeassistant.components.notify import ( ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import CONF_HOST import homeassistant.helpers.config_validation as cv from ..netgear_lte import DATA_KEY DEPENDENCIES = ['netgear_lte'] _LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_HOST): cv.string, vol.Required(ATTR_TARGET): vol.All(cv.ensure_list, [cv.string]), }) async def async_get_service(hass, config, discovery_info=None): """Get the notification service.""" return NetgearNotifyService(hass, config) @attr.s class NetgearNotifyService(BaseNotificationService): """Implementation of a notification service.""" hass = attr.ib() config = attr.ib()
ATTR_DATA, ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService, ) from homeassistant.const import CONTENT_TYPE_JSON import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) CONF_PAGE_ACCESS_TOKEN = "page_access_token" BASE_URL = "https://graph.facebook.com/v2.6/me/messages" CREATE_BROADCAST_URL = "https://graph.facebook.com/v2.11/me/message_creatives" SEND_BROADCAST_URL = "https://graph.facebook.com/v2.11/me/broadcast_messages" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( {vol.Required(CONF_PAGE_ACCESS_TOKEN): cv.string}) def get_service(hass, config, discovery_info=None): """Get the Facebook notification service.""" return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN]) class FacebookNotificationService(BaseNotificationService): """Implementation of a notification service for the Facebook service.""" def __init__(self, access_token): """Initialize the service.""" self.page_access_token = access_token def send_message(self, message="", **kwargs): """Send some message."""
import voluptuous as vol from homeassistant.const import CONF_TOKEN import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import (ATTR_TITLE, PLATFORM_SCHEMA, BaseNotificationService) REQUIREMENTS = ['ciscosparkapi==0.4.2'] _LOGGER = logging.getLogger(__name__) CONF_ROOMID = 'roomid' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_TOKEN): cv.string, vol.Required(CONF_ROOMID): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the CiscoSpark notification service.""" return CiscoSparkNotificationService( config.get(CONF_TOKEN), config.get(CONF_ROOMID)) class CiscoSparkNotificationService(BaseNotificationService): """The Cisco Spark Notification Service.""" def __init__(self, token, default_room): """Initialize the service."""
_LOGGER = logging.getLogger(__name__) REQUIREMENTS = ["boto3==1.3.1"] CONF_REGION = 'region_name' CONF_ACCESS_KEY_ID = 'aws_access_key_id' CONF_SECRET_ACCESS_KEY = 'aws_secret_access_key' CONF_PROFILE_NAME = 'profile_name' CONF_CONTEXT = 'context' ATTR_CREDENTIALS = 'credentials' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_REGION, default="us-east-1"): cv.string, vol.Inclusive(CONF_ACCESS_KEY_ID, ATTR_CREDENTIALS): cv.string, vol.Inclusive(CONF_SECRET_ACCESS_KEY, ATTR_CREDENTIALS): cv.string, vol.Exclusive(CONF_PROFILE_NAME, ATTR_CREDENTIALS): cv.string, vol.Optional(CONF_CONTEXT, default=dict()): vol.Coerce(dict) }) def get_service(hass, config): """Get the AWS Lambda notification service.""" context_str = json.dumps({ 'hass': hass.config.as_dict(), 'custom': config[CONF_CONTEXT] }) context_b64 = base64.b64encode(context_str.encode("utf-8")) context = context_b64.decode("utf-8")
import logging import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import CONF_API_KEY, CONF_SENDER _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ['messagebird==1.2.0'] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Optional(CONF_SENDER, default='HA'): vol.Match(r"^(\+?[1-9]\d{1,14}|\w{1,11})$"), }) # pylint: disable=unused-argument def get_service(hass, config): """Get the MessageBird notification service.""" import messagebird client = messagebird.Client(config[CONF_API_KEY]) try: # validates the api key client.balance() except messagebird.client.ErrorException: _LOGGER.error('The specified MessageBird API key is invalid.')
from homeassistant.const import CONF_API_KEY import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['python-join-api==0.0.4'] _LOGGER = logging.getLogger(__name__) CONF_DEVICE_ID = 'device_id' CONF_DEVICE_IDS = 'device_ids' CONF_DEVICE_NAMES = 'device_names' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Optional(CONF_DEVICE_ID): cv.string, vol.Optional(CONF_DEVICE_IDS): cv.string, vol.Optional(CONF_DEVICE_NAMES): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Join notification service.""" api_key = config.get(CONF_API_KEY) device_id = config.get(CONF_DEVICE_ID) device_ids = config.get(CONF_DEVICE_IDS) device_names = config.get(CONF_DEVICE_NAMES) if api_key: from pyjoin import get_devices if not get_devices(api_key):
import requests import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( ATTR_TARGET, ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import CONTENT_TYPE_JSON _LOGGER = logging.getLogger(__name__) CONF_PAGE_ACCESS_TOKEN = 'page_access_token' BASE_URL = 'https://graph.facebook.com/v2.6/me/messages' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_PAGE_ACCESS_TOKEN): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Facebook notification service.""" return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN]) class FacebookNotificationService(BaseNotificationService): """Implementation of a notification service for the Facebook service.""" def __init__(self, access_token): """Initialize the service.""" self.page_access_token = access_token
SYSLOG_PRIORITY = { 5: 'LOG_EMERG', 4: 'LOG_ALERT', 3: 'LOG_CRIT', 2: 'LOG_ERR', 1: 'LOG_WARNING', 0: 'LOG_NOTICE', -1: 'LOG_INFO', -2: 'LOG_DEBUG', } PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_FACILITY, default='syslog'): vol.In(SYSLOG_FACILITY.keys()), vol.Optional(CONF_OPTION, default='pid'): vol.In(SYSLOG_OPTION.keys()), vol.Optional(CONF_PRIORITY, default=-1): vol.In(SYSLOG_PRIORITY.keys()), }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config): """Get the syslog notification service.""" import syslog facility = getattr(syslog, SYSLOG_FACILITY[config.get(CONF_FACILITY)]) option = getattr(syslog, SYSLOG_OPTION[config.get(CONF_OPTION)]) priority = getattr(syslog, SYSLOG_PRIORITY[config.get(CONF_PRIORITY)])
""" import logging import json import requests import voluptuous as vol from homeassistant.components.notify import ( BaseNotificationService, PLATFORM_SCHEMA, ATTR_DATA) from homeassistant.const import CONF_RESOURCE, CONF_VERIFY_SSL import homeassistant.helpers.config_validation as cv ATTR_FILE_URL = 'file_url' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RESOURCE): cv.url, vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean, }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config, discovery_info=None): """Get the Synology Chat notification service.""" resource = config.get(CONF_RESOURCE) verify_ssl = config.get(CONF_VERIFY_SSL) return SynologyChatNotificationService(resource, verify_ssl) class SynologyChatNotificationService(BaseNotificationService): """Implementation of a notification service for Synology Chat."""
REQUIREMENTS = ['TwitterAPI==2.4.6'] _LOGGER = logging.getLogger(__name__) CONF_CONSUMER_KEY = 'consumer_key' CONF_CONSUMER_SECRET = 'consumer_secret' CONF_ACCESS_TOKEN_SECRET = 'access_token_secret' ATTR_MEDIA = 'media' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_ACCESS_TOKEN): cv.string, vol.Required(CONF_ACCESS_TOKEN_SECRET): cv.string, vol.Required(CONF_CONSUMER_KEY): cv.string, vol.Required(CONF_CONSUMER_SECRET): cv.string, vol.Optional(CONF_USERNAME): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Twitter notification service.""" return TwitterNotificationService(hass, config[CONF_CONSUMER_KEY], config[CONF_CONSUMER_SECRET], config[CONF_ACCESS_TOKEN], config[CONF_ACCESS_TOKEN_SECRET], config.get(CONF_USERNAME))
import logging import os.path import voluptuous as vol from homeassistant.const import CONF_TOKEN import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import (ATTR_DATA, ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) _LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_TOKEN): cv.string }) ATTR_IMAGES = 'images' def get_service(hass, config, discovery_info=None): """Get the Discord notification service.""" token = config.get(CONF_TOKEN) return DiscordNotificationService(hass, token) class DiscordNotificationService(BaseNotificationService): """Implement the notification service for Discord.""" def __init__(self, hass, token):
PLATFORM_SCHEMA, BaseNotificationService, ) _LOGGER = logging.getLogger(__name__) DEFAULT_PORT = 8080 DEFAULT_PROXY_SSL = False DEFAULT_TIMEOUT = 5 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Optional(CONF_PROXY_SSL, default=DEFAULT_PROXY_SSL): cv.boolean, vol.Inclusive(CONF_USERNAME, "auth"): cv.string, vol.Inclusive(CONF_PASSWORD, "auth"): cv.string, }) ATTR_DISPLAYTIME = "displaytime" async def async_get_service(hass, config, discovery_info=None): """Return the notify service.""" url = "{}:{}".format(config.get(CONF_HOST), config.get(CONF_PORT)) username = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD)
from homeassistant.components.frontend import add_manifest_json_key from homeassistant.helpers import config_validation as cv REQUIREMENTS = ['pywebpush==0.6.1', 'PyJWT==1.4.2'] DEPENDENCIES = ['frontend'] _LOGGER = logging.getLogger(__name__) REGISTRATIONS_FILE = 'html5_push_registrations.conf' ATTR_GCM_SENDER_ID = 'gcm_sender_id' ATTR_GCM_API_KEY = 'gcm_api_key' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(ATTR_GCM_SENDER_ID): cv.string, vol.Optional(ATTR_GCM_API_KEY): cv.string, }) ATTR_SUBSCRIPTION = 'subscription' ATTR_BROWSER = 'browser' ATTR_ENDPOINT = 'endpoint' ATTR_KEYS = 'keys' ATTR_AUTH = 'auth' ATTR_P256DH = 'p256dh' ATTR_TAG = 'tag' ATTR_ACTION = 'action' ATTR_ACTIONS = 'actions' ATTR_TYPE = 'type' ATTR_URL = 'url'
_GNTP_LOGGER.setLevel(logging.ERROR) CONF_APP_NAME = 'app_name' CONF_APP_ICON = 'app_icon' CONF_HOSTNAME = 'hostname' DEFAULT_APP_NAME = 'HomeAssistant' DEFAULT_HOST = 'localhost' DEFAULT_PORT = 23053 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_APP_NAME, default=DEFAULT_APP_NAME): cv.string, vol.Optional(CONF_APP_ICON): vol.Url, vol.Optional(CONF_HOSTNAME, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_PASSWORD): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, }) def get_service(hass, config): """Get the GNTP notification service.""" if config.get(CONF_APP_ICON) is None: icon_file = os.path.join(os.path.dirname(__file__), "..", "frontend", "www_static", "icons", "favicon-192x192.png") app_icon = open(icon_file, 'rb').read() else: app_icon = config.get(CONF_APP_ICON)
CONF_COLOR = 'color' CONF_NOTIFY = 'notify' CONF_FORMAT = 'format' DEFAULT_COLOR = 'yellow' DEFAULT_FORMAT = 'text' DEFAULT_HOST = 'https://api.hipchat.com/' DEFAULT_NOTIFY = False VALID_COLORS = {'yellow', 'green', 'red', 'purple', 'gray', 'random'} VALID_FORMATS = {'text', 'html'} PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_ROOM): vol.Coerce(int), vol.Required(CONF_TOKEN): cv.string, vol.Optional(CONF_COLOR, default=DEFAULT_COLOR): vol.In(VALID_COLORS), vol.Optional(CONF_FORMAT, default=DEFAULT_FORMAT): vol.In(VALID_FORMATS), vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_NOTIFY, default=DEFAULT_NOTIFY): cv.boolean, }) def get_service(hass, config, discovery_info=None): """Get the HipChat notification service.""" return HipchatNotificationService( config[CONF_TOKEN], config[CONF_ROOM], config[CONF_COLOR], config[CONF_NOTIFY], config[CONF_FORMAT], config[CONF_HOST]) class HipchatNotificationService(BaseNotificationService): """Implement the notification service for HipChat."""
from homeassistant.util import ensure_unique_string REQUIREMENTS = ['pywebpush==1.6.0', 'PyJWT==1.6.0'] DEPENDENCIES = ['frontend'] _LOGGER = logging.getLogger(__name__) REGISTRATIONS_FILE = 'html5_push_registrations.conf' ATTR_GCM_SENDER_ID = 'gcm_sender_id' ATTR_GCM_API_KEY = 'gcm_api_key' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(ATTR_GCM_SENDER_ID): cv.string, vol.Optional(ATTR_GCM_API_KEY): cv.string, }) ATTR_SUBSCRIPTION = 'subscription' ATTR_BROWSER = 'browser' ATTR_ENDPOINT = 'endpoint' ATTR_KEYS = 'keys' ATTR_AUTH = 'auth' ATTR_P256DH = 'p256dh' ATTR_EXPIRATIONTIME = 'expirationTime' ATTR_TAG = 'tag' ATTR_ACTION = 'action' ATTR_ACTIONS = 'actions'
import requests import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import CONF_API_KEY CONF_APP_SECRET = 'app_secret' CONF_EVENT = 'event' CONF_TRACKER = 'tracker' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_APP_SECRET): cv.string, vol.Required(CONF_EVENT): cv.string, vol.Required(CONF_TRACKER): cv.string, }) _LOGGER = logging.getLogger(__name__) _RESOURCE = 'https://api.instapush.im/v1/' def get_service(hass, config): """Get the instapush notification service.""" headers = {'x-instapush-appid': config[CONF_API_KEY], 'x-instapush-appsecret': config[CONF_APP_SECRET]} try: response = requests.get(_RESOURCE + 'events/list',
CONF_LANGUAGE = 'language' CONF_VOICE = 'voice' CONF_CALLER = 'caller' DEFAULT_LANGUAGE = 'en-us' DEFAULT_VOICE = 'female' TIMEOUT = 5 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_RECIPIENT): cv.string, vol.Optional(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): cv.string, vol.Optional(CONF_VOICE, default=DEFAULT_VOICE): cv.string, vol.Optional(CONF_CALLER): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the ClickSend notification service.""" if not _authenticate(config): _LOGGER.error("You are not authorized to access ClickSend") return None return ClicksendNotificationService(config)
"""Warn user that GCM API config is deprecated.""" if not value: return value _LOGGER.warning( "Configuring html5_push_notifications via the GCM api" " has been deprecated and will stop working after April 11," " 2019. Use the VAPID configuration instead. For instructions," " see https://www.home-assistant.io/components/notify.html5/") return value PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(ATTR_GCM_SENDER_ID): vol.All(cv.string, gcm_api_deprecated), vol.Optional(ATTR_GCM_API_KEY): cv.string, vol.Optional(ATTR_VAPID_PUB_KEY): cv.string, vol.Optional(ATTR_VAPID_PRV_KEY): cv.string, vol.Optional(ATTR_VAPID_EMAIL): cv.string, }) ATTR_SUBSCRIPTION = 'subscription' ATTR_BROWSER = 'browser' ATTR_NAME = 'name' ATTR_ENDPOINT = 'endpoint' ATTR_KEYS = 'keys' ATTR_AUTH = 'auth' ATTR_P256DH = 'p256dh' ATTR_EXPIRATIONTIME = 'expirationTime' ATTR_TAG = 'tag'
from homeassistant.components.notify import ( ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService, ) _LOGGER = logging.getLogger(__name__) CONF_FILE = "config" CONF_URL = "url" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_URL): vol.All(cv.ensure_list, [str]), vol.Optional(CONF_FILE): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Apprise notification service.""" # Create our object a_obj = apprise.Apprise() if config.get(CONF_FILE): # Sourced from a Configuration File a_config = apprise.AppriseConfig() if not a_config.add(config[CONF_FILE]): _LOGGER.error("Invalid Apprise config url provided")
CONF_PASSWORD, CONF_SENDER, CONF_RECIPIENT, CONF_ROOM) REQUIREMENTS = ['sleekxmpp==1.3.2', 'dnspython3==1.15.0', 'pyasn1==0.3.7', 'pyasn1-modules==0.1.5'] _LOGGER = logging.getLogger(__name__) CONF_TLS = 'tls' CONF_VERIFY = 'verify' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_SENDER): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_RECIPIENT): cv.string, vol.Optional(CONF_TLS, default=True): cv.boolean, vol.Optional(CONF_VERIFY, default=True): cv.boolean, vol.Optional(CONF_ROOM, default=''): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Jabber (XMPP) notification service.""" return XmppNotificationService( config.get(CONF_SENDER), config.get(CONF_PASSWORD), config.get(CONF_RECIPIENT), config.get(CONF_TLS), config.get(CONF_VERIFY), config.get(CONF_ROOM)) class XmppNotificationService(BaseNotificationService): """Implement the notification service for Jabber (XMPP)."""
from webexteamssdk import ApiError, WebexTeamsAPI, exceptions from homeassistant.components.notify import ( ATTR_TITLE, PLATFORM_SCHEMA, BaseNotificationService, ) from homeassistant.const import CONF_TOKEN import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) CONF_ROOM_ID = "room_id" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_TOKEN): cv.string, vol.Required(CONF_ROOM_ID): cv.string }) def get_service(hass, config, discovery_info=None): """Get the CiscoWebexTeams notification service.""" client = WebexTeamsAPI(access_token=config[CONF_TOKEN]) try: # Validate the token & room_id client.rooms.get(config[CONF_ROOM_ID]) except exceptions.ApiError as error: _LOGGER.error(error) return None return CiscoWebexTeamsNotificationService(client, config[CONF_ROOM_ID])
import voluptuous as vol from homeassistant.components import ecobee from homeassistant.components.notify import ( BaseNotificationService, PLATFORM_SCHEMA) # NOQA import homeassistant.helpers.config_validation as cv DEPENDENCIES = ['ecobee'] _LOGGER = logging.getLogger(__name__) CONF_INDEX = 'index' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_INDEX, default=0): cv.positive_int, }) def get_service(hass, config): """Get the Ecobee notification service.""" index = config.get(CONF_INDEX) return EcobeeNotificationService(index) # pylint: disable=too-few-public-methods class EcobeeNotificationService(BaseNotificationService): """Implement the notification service for the Ecobee thermostat.""" def __init__(self, thermostat_index): """Initialize the service."""
ATTR_URL = 'url' ATTR_URL_TEMPLATE = 'url_template' ATTR_VERIFY = 'verify' CONF_TLS = 'tls' CONF_VERIFY = 'verify' DEFAULT_CONTENT_TYPE = 'application/octet-stream' DEFAULT_RESOURCE = 'home-assistant' XEP_0363_TIMEOUT = 10 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_SENDER): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_RECIPIENT): cv.string, vol.Optional(CONF_RESOURCE, default=DEFAULT_RESOURCE): cv.string, vol.Optional(CONF_ROOM, default=''): cv.string, vol.Optional(CONF_TLS, default=True): cv.boolean, vol.Optional(CONF_VERIFY, default=True): cv.boolean, }) async def async_get_service(hass, config, discovery_info=None): """Get the Jabber (XMPP) notification service.""" return XmppNotificationService( config.get(CONF_SENDER), config.get(CONF_RESOURCE), config.get(CONF_PASSWORD), config.get(CONF_RECIPIENT), config.get(CONF_TLS), config.get(CONF_VERIFY), config.get(CONF_ROOM), hass)
from homeassistant.components.notify import ( ATTR_DATA, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import CONF_API_KEY import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['pushbullet.py==0.11.0'] _LOGGER = logging.getLogger(__name__) ATTR_URL = 'url' ATTR_FILE = 'file' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, }) # pylint: disable=unused-argument def get_service(hass, config, discovery_info=None): """Get the Pushbullet notification service.""" from pushbullet import PushBullet from pushbullet import InvalidKeyError try: pushbullet = PushBullet(config[CONF_API_KEY]) except InvalidKeyError: _LOGGER.error("Wrong API key supplied") return None
_LOGGER = logging.getLogger(__name__) DOMAIN = 'telegram_bot' DEPENDENCIES = [DOMAIN] ATTR_KEYBOARD = 'keyboard' ATTR_INLINE_KEYBOARD = 'inline_keyboard' ATTR_PHOTO = 'photo' ATTR_VIDEO = 'video' ATTR_DOCUMENT = 'document' CONF_CHAT_ID = 'chat_id' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_CHAT_ID): vol.Coerce(int), }) def get_service(hass, config, discovery_info=None): """Get the Telegram notification service.""" chat_id = config.get(CONF_CHAT_ID) return TelegramNotificationService(hass, chat_id) class TelegramNotificationService(BaseNotificationService): """Implement the notification service for Telegram.""" def __init__(self, hass, chat_id): """Initialize the service.""" self._chat_id = chat_id self.hass = hass
REQUIREMENTS = ['lmnotify==0.0.4'] DEPENDENCIES = ['lametric'] _LOGGER = logging.getLogger(__name__) CONF_LIFETIME = "lifetime" CONF_CYCLES = "cycles" CONF_PRIORITY = "priority" AVAILABLE_PRIORITIES = ["info", "warning", "critical"] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_ICON, default="i555"): cv.string, vol.Optional(CONF_LIFETIME, default=10): cv.positive_int, vol.Optional(CONF_CYCLES, default=1): cv.positive_int, vol.Optional(CONF_PRIORITY, default="warning"): vol.In(AVAILABLE_PRIORITIES) }) def get_service(hass, config, discovery_info=None): """Get the LaMetric notification service.""" hlmn = hass.data.get(LAMETRIC_DOMAIN) return LaMetricNotificationService(hlmn, config[CONF_ICON], config[CONF_LIFETIME] * 1000, config[CONF_CYCLES], config[CONF_PRIORITY])
import voluptuous as vol from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_ICON) import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['slacker==0.9.28'] _LOGGER = logging.getLogger(__name__) CONF_CHANNEL = 'default_channel' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_CHANNEL): cv.string, vol.Optional(CONF_USERNAME): cv.string, vol.Optional(CONF_ICON): cv.string, }) # pylint: disable=unused-variable def get_service(hass, config): """Get the Slack notification service.""" import slacker try: return SlackNotificationService(config[CONF_CHANNEL], config[CONF_API_KEY], config.get(CONF_USERNAME, None), config.get(CONF_ICON, None))
from homeassistant.components.notify import ( ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ["boto3==1.4.3"] CONF_REGION = 'region_name' CONF_ACCESS_KEY_ID = 'aws_access_key_id' CONF_SECRET_ACCESS_KEY = 'aws_secret_access_key' CONF_PROFILE_NAME = 'profile_name' ATTR_CREDENTIALS = 'credentials' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_REGION, default="us-east-1"): cv.string, vol.Inclusive(CONF_ACCESS_KEY_ID, ATTR_CREDENTIALS): cv.string, vol.Inclusive(CONF_SECRET_ACCESS_KEY, ATTR_CREDENTIALS): cv.string, vol.Exclusive(CONF_PROFILE_NAME, ATTR_CREDENTIALS): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the AWS SQS notification service.""" # pylint: disable=import-error import boto3 aws_config = config.copy() del aws_config[CONF_PLATFORM] del aws_config[CONF_NAME] profile = aws_config.get(CONF_PROFILE_NAME)
import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) _LOGGER = logging.getLogger(__name__) REQUIREMENTS = ["twilio==5.4.0"] CONF_ACCOUNT_SID = "account_sid" CONF_AUTH_TOKEN = "auth_token" CONF_FROM_NUMBER = "from_number" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_ACCOUNT_SID): cv.string, vol.Required(CONF_AUTH_TOKEN): cv.string, vol.Required(CONF_FROM_NUMBER): vol.All(cv.string, vol.Match(r"^\+?[1-9]\d{1,14}$")), }) def get_service(hass, config): """Get the Twilio SMS notification service.""" # pylint: disable=import-error from twilio.rest import TwilioRestClient twilio_client = TwilioRestClient(config[CONF_ACCOUNT_SID], config[CONF_AUTH_TOKEN]) return TwilioSMSNotificationService(twilio_client, config[CONF_FROM_NUMBER])
import socket import voluptuous as vol from homeassistant.components.notify import ( PLATFORM_SCHEMA, ATTR_DATA, BaseNotificationService) from homeassistant.const import (CONF_HOST, CONF_PORT) import homeassistant.helpers.config_validation as cv ATTR_METHOD = 'method' ATTR_METHOD_DEFAULT = 'speak' ATTR_METHOD_ALLOWED = ['speak', 'alarm'] DEFAULT_PORT = 1035 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config, discovery_info=None): """Get the Lannouncer notification service.""" host = config.get(CONF_HOST) port = config.get(CONF_PORT) return LannouncerNotificationService(hass, host, port) class LannouncerNotificationService(BaseNotificationService): """Implementation of a notification service for Lannouncer."""
ATTR_CHANNEL, ATTR_INTERFACE, ATTR_PARAM, ATTR_VALUE, DOMAIN, SERVICE_SET_DEVICE_VALUE, ) _LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(ATTR_ADDRESS): vol.All(cv.string, vol.Upper), vol.Required(ATTR_CHANNEL): vol.Coerce(int), vol.Required(ATTR_PARAM): vol.All(cv.string, vol.Upper), vol.Required(ATTR_VALUE): cv.match_all, vol.Optional(ATTR_INTERFACE): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Homematic notification service.""" data = { ATTR_ADDRESS: config[ATTR_ADDRESS], ATTR_CHANNEL: config[ATTR_CHANNEL], ATTR_PARAM: config[ATTR_PARAM], ATTR_VALUE: config[ATTR_VALUE], }
import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService, ATTR_MESSAGE) _LOGGER = logging.getLogger(__name__) CONF_DEFAULT_ROOM = 'default_room' DOMAIN = 'matrix' DEPENDENCIES = [DOMAIN] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_DEFAULT_ROOM): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Matrix notification service.""" return MatrixNotificationService(config.get(CONF_DEFAULT_ROOM)) class MatrixNotificationService(BaseNotificationService): """Send Notifications to a Matrix Room.""" def __init__(self, default_room): """Set up the notification service.""" self._default_room = default_room
from homeassistant.const import CONF_API_KEY import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( ATTR_DATA, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService) REQUIREMENTS = ['python-pushover==0.3'] _LOGGER = logging.getLogger(__name__) CONF_USER_KEY = 'user_key' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_USER_KEY): cv.string, vol.Required(CONF_API_KEY): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Pushover notification service.""" from pushover import InitError try: return PushoverNotificationService( config[CONF_USER_KEY], config[CONF_API_KEY]) except InitError: _LOGGER.error("Wrong API key supplied") return None
REQUIREMENTS = ['pymailgunner==1.4'] _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['mailgun'] # Images to attach to notification ATTR_IMAGES = 'images' DEFAULT_SENDER = 'hass@{domain}' DEFAULT_SANDBOX = False # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RECIPIENT): vol.Email(), vol.Optional(CONF_SENDER): vol.Email(), }) def get_service(hass, config, discovery_info=None): """Get the Mailgun notification service.""" data = hass.data[MAILGUN_DOMAIN] mailgun_service = MailgunNotificationService( data.get(CONF_DOMAIN), data.get(CONF_SANDBOX), data.get(CONF_API_KEY), config.get(CONF_SENDER), config.get(CONF_RECIPIENT)) if mailgun_service.connection_is_valid(): return mailgun_service return None
BaseNotificationService) REQUIREMENTS = ['sendgrid==5.6.0'] _LOGGER = logging.getLogger(__name__) CONF_SENDER_NAME = 'sender_name' DEFAULT_SENDER_NAME = 'Home Assistant' # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_SENDER): vol.Email(), vol.Required(CONF_RECIPIENT): vol.Email(), vol.Optional(CONF_SENDER_NAME, default=DEFAULT_SENDER_NAME): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the SendGrid notification service.""" return SendgridNotificationService(config) class SendgridNotificationService(BaseNotificationService): """Implementation the notification service for email via Sendgrid.""" def __init__(self, config): """Initialize the service."""
from homeassistant.components.notify import ( ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import ( CONF_API_KEY, CONF_USERNAME, CONF_ICON) import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['slacker==0.9.30'] _LOGGER = logging.getLogger(__name__) CONF_CHANNEL = 'default_channel' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_CHANNEL): cv.string, vol.Optional(CONF_USERNAME): cv.string, vol.Optional(CONF_ICON): cv.string, }) # pylint: disable=unused-variable def get_service(hass, config, discovery_info=None): """Get the Slack notification service.""" import slacker try: return SlackNotificationService( config[CONF_CHANNEL], config[CONF_API_KEY], config.get(CONF_USERNAME, None), config.get(CONF_ICON, None))
REQUIREMENTS = ['pymailgunner==1.4'] _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['mailgun'] # Images to attach to notification ATTR_IMAGES = 'images' DEFAULT_SENDER = 'hass@{domain}' DEFAULT_SANDBOX = False # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RECIPIENT): vol.Email(), vol.Optional(CONF_SENDER): vol.Email(), }) def get_service(hass, config, discovery_info=None): """Get the Mailgun notification service.""" data = hass.data[MAILGUN_DOMAIN] mailgun_service = MailgunNotificationService(data.get(CONF_DOMAIN), data.get(CONF_SANDBOX), data.get(CONF_API_KEY), config.get(CONF_SENDER), config.get(CONF_RECIPIENT)) if mailgun_service.connection_is_valid(): return mailgun_service
REQUIREMENTS = ['apns2==0.3.0'] APNS_DEVICES = 'apns.yaml' CONF_CERTFILE = 'cert_file' CONF_TOPIC = 'topic' CONF_SANDBOX = 'sandbox' DEVICE_TRACKER_DOMAIN = 'device_tracker' SERVICE_REGISTER = 'apns_register' ATTR_PUSH_ID = 'push_id' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_PLATFORM): 'apns', vol.Required(CONF_NAME): cv.string, vol.Required(CONF_CERTFILE): cv.isfile, vol.Required(CONF_TOPIC): cv.string, vol.Optional(CONF_SANDBOX, default=False): cv.boolean, }) REGISTER_SERVICE_SCHEMA = vol.Schema({ vol.Required(ATTR_PUSH_ID): cv.string, vol.Optional(ATTR_NAME): cv.string, }) def get_service(hass, config, discovery_info=None): """Return push service.""" name = config.get(CONF_NAME) cert_file = config.get(CONF_CERTFILE) topic = config.get(CONF_TOPIC)
from homeassistant.components.notify import (ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import (CONF_API_KEY, CONF_SENDER, CONF_RECIPIENT) import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['sendgrid==5.0.0'] _LOGGER = logging.getLogger(__name__) # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_SENDER): vol.Email(), vol.Required(CONF_RECIPIENT): vol.Email(), }) def get_service(hass, config, discovery_info=None): """Get the SendGrid notification service.""" api_key = config.get(CONF_API_KEY) sender = config.get(CONF_SENDER) recipient = config.get(CONF_RECIPIENT) return SendgridNotificationService(api_key, sender, recipient) class SendgridNotificationService(BaseNotificationService):
_GNTP_LOGGER = logging.getLogger('gntp') _GNTP_LOGGER.setLevel(logging.ERROR) CONF_APP_NAME = 'app_name' CONF_APP_ICON = 'app_icon' CONF_HOSTNAME = 'hostname' DEFAULT_APP_NAME = 'HomeAssistant' DEFAULT_HOST = 'localhost' DEFAULT_PORT = 23053 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_APP_NAME, default=DEFAULT_APP_NAME): cv.string, vol.Optional(CONF_APP_ICON): vol.Url, vol.Optional(CONF_HOSTNAME, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_PASSWORD): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, }) def get_service(hass, config, discovery_info=None): """Get the GNTP notification service.""" if config.get(CONF_APP_ICON) is None: icon_file = os.path.join(os.path.dirname(__file__), "..", "frontend", "www_static", "icons", "favicon-192x192.png") with open(icon_file, 'rb') as file: app_icon = file.read() else: app_icon = config.get(CONF_APP_ICON)
import homeassistant.helpers.config_validation as cv CONF_MESSAGE_PARAMETER_NAME = 'message_param_name' CONF_TARGET_PARAMETER_NAME = 'target_param_name' CONF_TITLE_PARAMETER_NAME = 'title_param_name' DEFAULT_MESSAGE_PARAM_NAME = 'message' DEFAULT_METHOD = 'GET' DEFAULT_TARGET_PARAM_NAME = None DEFAULT_TITLE_PARAM_NAME = None PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_RESOURCE): cv.url, vol.Optional(CONF_MESSAGE_PARAMETER_NAME, default=DEFAULT_MESSAGE_PARAM_NAME): cv.string, vol.Optional(CONF_METHOD, default=DEFAULT_METHOD): vol.In(['POST', 'GET', 'POST_JSON']), vol.Optional(CONF_NAME): cv.string, vol.Optional(CONF_TARGET_PARAMETER_NAME, default=DEFAULT_TARGET_PARAM_NAME): cv.string, vol.Optional(CONF_TITLE_PARAMETER_NAME, default=DEFAULT_TITLE_PARAM_NAME): cv.string, }) _LOGGER = logging.getLogger(__name__) def get_service(hass, config): """Get the RESTful notification service.""" resource = config.get(CONF_RESOURCE) method = config.get(CONF_METHOD) message_param_name = config.get(CONF_MESSAGE_PARAMETER_NAME) title_param_name = config.get(CONF_TITLE_PARAMETER_NAME)
import voluptuous as vol from homeassistant.components.notify import ( ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService) from homeassistant.const import (CONF_API_KEY, CONF_SENDER, CONF_RECIPIENT) import homeassistant.helpers.config_validation as cv REQUIREMENTS = ['sendgrid==3.6.0'] _LOGGER = logging.getLogger(__name__) # pylint: disable=no-value-for-parameter PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_SENDER): vol.Email(), vol.Required(CONF_RECIPIENT): vol.Email(), }) def get_service(hass, config): """Get the SendGrid notification service.""" api_key = config.get(CONF_API_KEY) sender = config.get(CONF_SENDER) recipient = config.get(CONF_RECIPIENT) return SendgridNotificationService(api_key, sender, recipient) # pylint: disable=too-few-public-methods class SendgridNotificationService(BaseNotificationService):
REQUIREMENTS = ['matrix-client==0.0.6'] _LOGGER = logging.getLogger(__name__) SESSION_FILE = 'matrix.conf' AUTH_TOKENS = dict() CONF_HOMESERVER = 'homeserver' CONF_DEFAULT_ROOM = 'default_room' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_HOMESERVER): cv.url, vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean, vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_DEFAULT_ROOM): cv.string, }) def get_service(hass, config, discovery_info=None): """Get the Matrix notification service.""" if not AUTH_TOKENS: load_token(hass.config.path(SESSION_FILE)) return MatrixNotificationService(config.get(CONF_HOMESERVER), config.get(CONF_DEFAULT_ROOM), config.get(CONF_VERIFY_SSL),