1 """Support for Netgear LTE notifications."""
3 from __future__
import annotations
8 from eternalegypt.eternalegypt
import Modem
15 from .const
import CONF_NOTIFY, LOGGER
21 discovery_info: DiscoveryInfoType |
None =
None,
22 ) -> NetgearNotifyService |
None:
23 """Get the notification service."""
24 if discovery_info
is None:
31 """Implementation of a notification service."""
36 discovery_info: dict[str, Any],
38 """Initialize the service."""
40 self.modem: Modem = discovery_info[
"modem"]
43 """Send a message to a user."""
45 if not self.modem.token:
46 LOGGER.error(
"Modem not ready")
48 if not (targets := kwargs.get(ATTR_TARGET)):
49 targets = self.
configconfig[CONF_NOTIFY][CONF_RECIPIENT]
51 LOGGER.warning(
"No recipients")
57 for target
in targets:
59 await self.modem.sms(target, message)
60 except eternalegypt.Error:
61 LOGGER.error(
"Unable to send to %s", target)
None __init__(self, ConfigType config, dict[str, Any] discovery_info)
def async_send_message(self, message="", **kwargs)
NetgearNotifyService|None async_get_service(HomeAssistant hass, ConfigType config, DiscoveryInfoType|None discovery_info=None)