mirror of
https://github.com/home-assistant/core.git
synced 2025-05-02 21:19:16 +00:00

* Remove dependencies and requirements * Revert "Remove dependencies and requirements" This reverts commit fe7171b4cd30889bad5adc9a4fd60059d05ba5a7. * Remove dependencies and requirements * Revert "Remove dependencies and requirements" This reverts commit 391355ee2cc53cbe6954f940062b18ae34b05621. * Remove dependencies and requirements * Fix flake8 complaints * Fix more flake8 complaints * Revert non-component removals
33 lines
959 B
Python
33 lines
959 B
Python
"""Support for SMS notifications from the Dovado router."""
|
|
import logging
|
|
|
|
from homeassistant.components.notify import (
|
|
ATTR_TARGET, BaseNotificationService)
|
|
|
|
from . import DOMAIN as DOVADO_DOMAIN
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
def get_service(hass, config, discovery_info=None):
|
|
"""Get the Dovado Router SMS notification service."""
|
|
return DovadoSMSNotificationService(hass.data[DOVADO_DOMAIN].client)
|
|
|
|
|
|
class DovadoSMSNotificationService(BaseNotificationService):
|
|
"""Implement the notification service for the Dovado SMS component."""
|
|
|
|
def __init__(self, client):
|
|
"""Initialize the service."""
|
|
self._client = client
|
|
|
|
def send_message(self, message, **kwargs):
|
|
"""Send SMS to the specified target phone number."""
|
|
target = kwargs.get(ATTR_TARGET)
|
|
|
|
if not target:
|
|
_LOGGER.error("One target is required")
|
|
return
|
|
|
|
self._client.send_sms(target, message)
|