diff --git a/homeassistant/components/mycroft/notify.py b/homeassistant/components/mycroft/notify.py index 67203ae0564..19e29004be8 100644 --- a/homeassistant/components/mycroft/notify.py +++ b/homeassistant/components/mycroft/notify.py @@ -3,6 +3,7 @@ from __future__ import annotations import logging +from typing import Any from mycroftapi import MycroftAPI @@ -10,6 +11,8 @@ from homeassistant.components.notify import BaseNotificationService from homeassistant.core import HomeAssistant from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from . import DOMAIN + _LOGGER = logging.getLogger(__name__) @@ -19,17 +22,17 @@ def get_service( discovery_info: DiscoveryInfoType | None = None, ) -> MycroftNotificationService: """Get the Mycroft notification service.""" - return MycroftNotificationService(hass.data["mycroft"]) + return MycroftNotificationService(hass.data[DOMAIN]) class MycroftNotificationService(BaseNotificationService): """The Mycroft Notification Service.""" - def __init__(self, mycroft_ip): + def __init__(self, mycroft_ip: str) -> None: """Initialize the service.""" self.mycroft_ip = mycroft_ip - def send_message(self, message="", **kwargs): + def send_message(self, message: str = "", **kwargs: Any) -> None: """Send a message mycroft to speak on instance.""" text = message @@ -37,4 +40,4 @@ class MycroftNotificationService(BaseNotificationService): if mycroft is not None: mycroft.speak_text(text) else: - _LOGGER.log("Could not reach this instance of mycroft") + _LOGGER.warning("Could not reach this instance of mycroft")