mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Add hints to get_service in integrations (2/2) (#86693)
This commit is contained in:
parent
8a5a1b810a
commit
0d579f6ac3
@ -1,4 +1,6 @@
|
||||
"""Support for the Mailgun mail notifications."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from pymailgunner import (
|
||||
@ -17,6 +19,8 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN, CONF_RECIPIENT, CONF_SENDER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import CONF_SANDBOX, DOMAIN as MAILGUN_DOMAIN
|
||||
|
||||
@ -33,7 +37,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MailgunNotificationService | None:
|
||||
"""Get the Mailgun notification service."""
|
||||
data = hass.data[MAILGUN_DOMAIN]
|
||||
mailgun_service = MailgunNotificationService(
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Support for Matrix notifications."""
|
||||
from __future__ import annotations
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
@ -8,7 +10,9 @@ from homeassistant.components.notify import (
|
||||
PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DOMAIN, SERVICE_SEND_MESSAGE
|
||||
|
||||
@ -17,7 +21,11 @@ CONF_DEFAULT_ROOM = "default_room"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_DEFAULT_ROOM): cv.string})
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MatrixNotificationService:
|
||||
"""Get the Matrix notification service."""
|
||||
return MatrixNotificationService(config[CONF_DEFAULT_ROOM])
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""MessageBird platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import messagebird
|
||||
@ -11,7 +13,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_SENDER
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -25,7 +29,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MessageBirdNotificationService | None:
|
||||
"""Get the MessageBird notification service."""
|
||||
client = messagebird.Client(config[CONF_API_KEY])
|
||||
try:
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Support for mobile_app push notifications."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from functools import partial
|
||||
from http import HTTPStatus
|
||||
@ -15,8 +17,10 @@ from homeassistant.components.notify import (
|
||||
ATTR_TITLE_DEFAULT,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import (
|
||||
@ -81,7 +85,11 @@ def log_rate_limits(hass, device_name, resp, level=logging.INFO):
|
||||
)
|
||||
|
||||
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
async def async_get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MobileAppNotificationService:
|
||||
"""Get the mobile_app notification service."""
|
||||
service = hass.data[DOMAIN][DATA_NOTIFY] = MobileAppNotificationService(hass)
|
||||
return service
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Microsoft Teams platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import pymsteams
|
||||
@ -12,7 +14,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -21,7 +25,11 @@ ATTR_FILE_URL = "image_url"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_URL): cv.url})
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MSTeamsNotificationService | None:
|
||||
"""Get the Microsoft Teams notification service."""
|
||||
webhook_url = config.get(CONF_URL)
|
||||
|
||||
|
@ -1,14 +1,22 @@
|
||||
"""Mycroft AI notification platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from mycroftapi import MycroftAPI
|
||||
|
||||
from homeassistant.components.notify import BaseNotificationService
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MycroftNotificationService:
|
||||
"""Get the Mycroft notification service."""
|
||||
return MycroftNotificationService(hass.data["mycroft"])
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Notify.Events platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
|
||||
@ -10,6 +12,8 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_TOKEN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
@ -33,7 +37,11 @@ ATTR_TOKEN = "token"
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> NotifyEventsNotificationService:
|
||||
"""Get the Notify.Events notification service."""
|
||||
return NotifyEventsNotificationService(hass.data[DOMAIN][CONF_TOKEN])
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Prowl notification service."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
@ -14,8 +16,10 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = "https://api.prowlapp.com/publicapi/"
|
||||
@ -23,7 +27,11 @@ _RESOURCE = "https://api.prowlapp.com/publicapi/"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_API_KEY): cv.string})
|
||||
|
||||
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
async def async_get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> ProwlNotificationService:
|
||||
"""Get the Prowl notification service."""
|
||||
return ProwlNotificationService(hass, config[CONF_API_KEY])
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Pushsafer platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
@ -17,7 +19,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import ATTR_ICON
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = "https://www.pushsafer.com/api"
|
||||
@ -49,7 +53,11 @@ ATTR_PICTURE1_AUTH = "auth"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_DEVICE_KEY): cv.string})
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> PushsaferNotificationService:
|
||||
"""Get the Pushsafer.com notification service."""
|
||||
return PushsaferNotificationService(
|
||||
config.get(CONF_DEVICE_KEY), hass.config.is_allowed_path
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Rocket.Chat notification service."""
|
||||
from __future__ import annotations
|
||||
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
|
||||
@ -15,7 +17,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -30,7 +34,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> RocketChatNotificationService | None:
|
||||
"""Return the notify service."""
|
||||
|
||||
username = config.get(CONF_USERNAME)
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""SendGrid notification service."""
|
||||
from __future__ import annotations
|
||||
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
|
||||
@ -17,7 +19,9 @@ from homeassistant.const import (
|
||||
CONF_SENDER,
|
||||
CONTENT_TYPE_TEXT_PLAIN,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -36,7 +40,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> SendgridNotificationService:
|
||||
"""Get the SendGrid notification service."""
|
||||
return SendgridNotificationService(config)
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Support for Sinch notifications."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from clx.xms.api import MtBatchTextSmsResult
|
||||
@ -19,7 +21,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_SENDER
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
DOMAIN = "sinch"
|
||||
|
||||
@ -44,7 +48,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> SinchNotificationService:
|
||||
"""Get the Sinch notification service."""
|
||||
return SinchNotificationService(config)
|
||||
|
||||
|
@ -1,17 +1,25 @@
|
||||
"""Support for SMS notification services."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import gammu # pylint: disable=import-error
|
||||
|
||||
from homeassistant.components.notify import ATTR_DATA, BaseNotificationService
|
||||
from homeassistant.const import CONF_TARGET
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import CONF_UNICODE, DOMAIN, GATEWAY, SMS_GATEWAY
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
async def async_get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> SMSNotificationService | None:
|
||||
"""Get the SMS notification service."""
|
||||
|
||||
if discovery_info is None:
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Mail (SMTP) notification service."""
|
||||
from __future__ import annotations
|
||||
|
||||
from email.mime.application import MIMEApplication
|
||||
from email.mime.image import MIMEImage
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
@ -27,8 +29,10 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.ssl import client_context
|
||||
|
||||
@ -72,7 +76,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MailNotificationService | None:
|
||||
"""Get the mail notification service."""
|
||||
setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
mail_service = MailNotificationService(
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""SynologyChat platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
import logging
|
||||
@ -12,7 +14,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_RESOURCE, CONF_VERIFY_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
ATTR_FILE_URL = "file_url"
|
||||
|
||||
@ -26,7 +30,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> SynologyChatNotificationService:
|
||||
"""Get the Synology Chat notification service."""
|
||||
resource = config.get(CONF_RESOURCE)
|
||||
verify_ssl = config.get(CONF_VERIFY_SSL)
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Telegram platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
@ -18,7 +20,9 @@ from homeassistant.components.telegram_bot import (
|
||||
ATTR_PARSER,
|
||||
)
|
||||
from homeassistant.const import ATTR_LOCATION
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.reload import setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as TELEGRAM_DOMAIN, PLATFORMS
|
||||
|
||||
@ -37,7 +41,11 @@ 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):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> TelegramNotificationService:
|
||||
"""Get the Telegram notification service."""
|
||||
|
||||
setup_reload_service(hass, TELEGRAM_DOMAIN, PLATFORMS)
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Twilio Call platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import urllib
|
||||
|
||||
@ -11,7 +13,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.components.twilio import DATA_TWILIO
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -26,7 +30,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> TwilioCallNotificationService:
|
||||
"""Get the Twilio Call notification service."""
|
||||
return TwilioCallNotificationService(
|
||||
hass.data[DATA_TWILIO], config[CONF_FROM_NUMBER]
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Twilio SMS platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
@ -10,7 +12,9 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.components.twilio import DATA_TWILIO
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -32,7 +36,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> TwilioSMSNotificationService | None:
|
||||
"""Get the Twilio SMS notification service."""
|
||||
return TwilioSMSNotificationService(
|
||||
hass.data[DATA_TWILIO], config[CONF_FROM_NUMBER]
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Twitter platform for notify component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from functools import partial
|
||||
from http import HTTPStatus
|
||||
@ -17,8 +19,10 @@ from homeassistant.components.notify import (
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_point_in_time
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -39,7 +43,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> TwitterNotificationService:
|
||||
"""Get the Twitter notification service."""
|
||||
return TwitterNotificationService(
|
||||
hass,
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Jabber (XMPP) notification service."""
|
||||
from __future__ import annotations
|
||||
|
||||
from concurrent.futures import TimeoutError as FutTimeoutError
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
@ -31,8 +33,10 @@ from homeassistant.const import (
|
||||
CONF_ROOM,
|
||||
CONF_SENDER,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.helpers.template as template_helper
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -64,7 +68,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
)
|
||||
|
||||
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
async def async_get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> XmppNotificationService:
|
||||
"""Get the Jabber (XMPP) notification service."""
|
||||
return XmppNotificationService(
|
||||
config.get(CONF_SENDER),
|
||||
|
Loading…
x
Reference in New Issue
Block a user