Add hints to get_service in integrations (1/2) (#86692)
This commit is contained in:
parent
0d579f6ac3
commit
2bef69c6a7
16 changed files with 143 additions and 17 deletions
|
@ -1,4 +1,6 @@
|
||||||
"""Apprise platform for notify component."""
|
"""Apprise platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import apprise
|
import apprise
|
||||||
|
@ -12,7 +14,9 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_URL
|
from homeassistant.const import CONF_URL
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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,
|
||||||
|
) -> AppriseNotificationService | None:
|
||||||
"""Get the Apprise notification service."""
|
"""Get the Apprise notification service."""
|
||||||
# Create our Apprise Instance (reference our asset)
|
# Create our Apprise Instance (reference our asset)
|
||||||
a_obj = apprise.Apprise()
|
a_obj = apprise.Apprise()
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""AWS platform for notify component."""
|
"""AWS platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
@ -20,7 +22,9 @@ from homeassistant.const import (
|
||||||
CONF_PROFILE_NAME,
|
CONF_PROFILE_NAME,
|
||||||
CONF_SERVICE,
|
CONF_SERVICE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.json import JSONEncoder
|
from homeassistant.helpers.json import JSONEncoder
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import CONF_CONTEXT, CONF_CREDENTIAL_NAME, CONF_REGION, DATA_SESSIONS
|
from .const import CONF_CONTEXT, CONF_CREDENTIAL_NAME, CONF_REGION, DATA_SESSIONS
|
||||||
|
|
||||||
|
@ -33,7 +37,11 @@ async def get_available_regions(hass, service):
|
||||||
return await session.get_available_regions(service)
|
return await session.get_available_regions(service)
|
||||||
|
|
||||||
|
|
||||||
async def async_get_service(hass, config, discovery_info=None):
|
async def async_get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> AWSNotify | None:
|
||||||
"""Get the AWS notification service."""
|
"""Get the AWS notification service."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
_LOGGER.error("Please config aws notify platform in aws component")
|
_LOGGER.error("Please config aws notify platform in aws component")
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
"""Unify Circuit platform for notify component."""
|
"""Unify Circuit platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from circuit_webhook import Circuit
|
from circuit_webhook import Circuit
|
||||||
|
|
||||||
from homeassistant.components.notify import BaseNotificationService
|
from homeassistant.components.notify import BaseNotificationService
|
||||||
from homeassistant.const import CONF_URL
|
from homeassistant.const import CONF_URL
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> CircuitNotificationService | None:
|
||||||
"""Get the Unify Circuit notification service."""
|
"""Get the Unify Circuit notification service."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Cisco Webex Teams notify component."""
|
"""Cisco Webex Teams notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -10,7 +12,9 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_TOKEN
|
from homeassistant.const import CONF_TOKEN
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -21,7 +25,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,
|
||||||
|
) -> CiscoWebexTeamsNotificationService | None:
|
||||||
"""Get the CiscoWebexTeams notification service."""
|
"""Get the CiscoWebexTeams notification service."""
|
||||||
|
|
||||||
client = WebexTeamsAPI(access_token=config[CONF_TOKEN])
|
client = WebexTeamsAPI(access_token=config[CONF_TOKEN])
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""clicksend_tts platform for notify component."""
|
"""clicksend_tts platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -14,7 +16,9 @@ from homeassistant.const import (
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
CONTENT_TYPE_JSON,
|
CONTENT_TYPE_JSON,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -49,7 +53,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,
|
||||||
|
) -> ClicksendNotificationService | None:
|
||||||
"""Get the ClickSend notification service."""
|
"""Get the ClickSend notification service."""
|
||||||
if not _authenticate(config):
|
if not _authenticate(config):
|
||||||
_LOGGER.error("You are not authorized to access ClickSend")
|
_LOGGER.error("You are not authorized to access ClickSend")
|
||||||
|
|
|
@ -1,14 +1,22 @@
|
||||||
"""Support for SMS notifications from the Dovado router."""
|
"""Support for SMS notifications from the Dovado router."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import DOMAIN as DOVADO_DOMAIN
|
from . import DOMAIN as DOVADO_DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> DovadoSMSNotificationService:
|
||||||
"""Get the Dovado Router SMS notification service."""
|
"""Get the Dovado Router SMS notification service."""
|
||||||
return DovadoSMSNotificationService(hass.data[DOVADO_DOMAIN].client)
|
return DovadoSMSNotificationService(hass.data[DOVADO_DOMAIN].client)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
"""Support for Ecobee Send Message service."""
|
"""Support for Ecobee Send Message service."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> EcobeeNotificationService | None:
|
||||||
"""Get the Ecobee notification service."""
|
"""Get the Ecobee notification service."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Facebook platform for notify component."""
|
"""Facebook platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -13,7 +15,9 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONTENT_TYPE_JSON
|
from homeassistant.const import CONTENT_TYPE_JSON
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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,
|
||||||
|
) -> FacebookNotificationService:
|
||||||
"""Get the Facebook notification service."""
|
"""Get the Facebook notification service."""
|
||||||
return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN])
|
return FacebookNotificationService(config[CONF_PAGE_ACCESS_TOKEN])
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Flock platform for notify component."""
|
"""Flock platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
|
@ -8,8 +10,10 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_RESOURCE = "https://api.flock.com/hooks/sendMessage/"
|
_RESOURCE = "https://api.flock.com/hooks/sendMessage/"
|
||||||
|
@ -17,7 +21,11 @@ _RESOURCE = "https://api.flock.com/hooks/sendMessage/"
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_ACCESS_TOKEN): cv.string})
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_ACCESS_TOKEN): 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,
|
||||||
|
) -> FlockNotificationService:
|
||||||
"""Get the Flock notification service."""
|
"""Get the Flock notification service."""
|
||||||
access_token = config.get(CONF_ACCESS_TOKEN)
|
access_token = config.get(CONF_ACCESS_TOKEN)
|
||||||
url = f"{_RESOURCE}{access_token}"
|
url = f"{_RESOURCE}{access_token}"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Free Mobile SMS platform."""
|
"""Support for Free Mobile SMS platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -7,7 +9,9 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -16,7 +20,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,
|
||||||
|
) -> FreeSMSNotificationService:
|
||||||
"""Get the Free Mobile SMS notification service."""
|
"""Get the Free Mobile SMS notification service."""
|
||||||
return FreeSMSNotificationService(config[CONF_USERNAME], config[CONF_ACCESS_TOKEN])
|
return FreeSMSNotificationService(config[CONF_USERNAME], config[CONF_ACCESS_TOKEN])
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Notification support for Homematic."""
|
"""Notification support for Homematic."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
|
@ -6,8 +8,10 @@ from homeassistant.components.notify import (
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.helpers.template as template_helper
|
import homeassistant.helpers.template as template_helper
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_ADDRESS,
|
ATTR_ADDRESS,
|
||||||
|
@ -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,
|
||||||
|
) -> HomematicNotificationService:
|
||||||
"""Get the Homematic notification service."""
|
"""Get the Homematic notification service."""
|
||||||
data = {
|
data = {
|
||||||
ATTR_ADDRESS: config[ATTR_ADDRESS],
|
ATTR_ADDRESS: config[ATTR_ADDRESS],
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""HTML5 Push Messaging notification service."""
|
"""HTML5 Push Messaging notification service."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
@ -27,9 +29,10 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_NAME, URL_ROOT
|
from homeassistant.const import ATTR_NAME, URL_ROOT
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util import ensure_unique_string
|
from homeassistant.util import ensure_unique_string
|
||||||
from homeassistant.util.json import load_json, save_json
|
from homeassistant.util.json import load_json, save_json
|
||||||
|
|
||||||
|
@ -161,7 +164,11 @@ HTML5_SHOWNOTIFICATION_PARAMETERS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> HTML5NotificationService | None:
|
||||||
"""Get the HTML5 push notification service."""
|
"""Get the HTML5 push notification service."""
|
||||||
json_path = hass.config.path(REGISTRATIONS_FILE)
|
json_path = hass.config.path(REGISTRATIONS_FILE)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for iOS push notifications."""
|
"""Support for iOS push notifications."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -12,6 +14,8 @@ from homeassistant.components.notify import (
|
||||||
ATTR_TITLE_DEFAULT,
|
ATTR_TITLE_DEFAULT,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .. import ios
|
from .. import ios
|
||||||
|
@ -43,7 +47,11 @@ def log_rate_limits(hass, target, resp, level=20):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> iOSNotificationService | None:
|
||||||
"""Get the iOS notification service."""
|
"""Get the iOS notification service."""
|
||||||
if "notify.ios" not in hass.config.components:
|
if "notify.ios" not in hass.config.components:
|
||||||
# Need this to enable requirements checking in the app.
|
# Need this to enable requirements checking in the app.
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
"""Support for Keba notifications."""
|
"""Support for Keba notifications."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.notify import ATTR_DATA, BaseNotificationService
|
from homeassistant.components.notify import ATTR_DATA, BaseNotificationService
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
async def async_get_service(hass, config, discovery_info=None):
|
async def async_get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> KebaNotificationService:
|
||||||
"""Return the notify service."""
|
"""Return the notify service."""
|
||||||
|
|
||||||
client = hass.data[DOMAIN]
|
client = hass.data[DOMAIN]
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Lannouncer platform for notify component."""
|
"""Lannouncer platform for notify component."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -11,7 +13,9 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
ATTR_METHOD = "method"
|
ATTR_METHOD = "method"
|
||||||
ATTR_METHOD_DEFAULT = "speak"
|
ATTR_METHOD_DEFAULT = "speak"
|
||||||
|
@ -29,7 +33,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> LannouncerNotificationService:
|
||||||
"""Get the Lannouncer notification service."""
|
"""Get the Lannouncer notification service."""
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
port = config.get(CONF_PORT)
|
port = config.get(CONF_PORT)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""LlamaLab Automate notification service."""
|
"""LlamaLab Automate notification service."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -11,7 +13,9 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_DEVICE
|
from homeassistant.const import CONF_API_KEY, CONF_DEVICE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_RESOURCE = "https://llamalab.com/automate/cloud/message"
|
_RESOURCE = "https://llamalab.com/automate/cloud/message"
|
||||||
|
@ -29,7 +33,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,
|
||||||
|
) -> AutomateNotificationService:
|
||||||
"""Get the LlamaLab Automate notification service."""
|
"""Get the LlamaLab Automate notification service."""
|
||||||
secret = config.get(CONF_API_KEY)
|
secret = config.get(CONF_API_KEY)
|
||||||
recipient = config.get(CONF_TO)
|
recipient = config.get(CONF_TO)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue