mirror of
https://github.com/home-assistant/core.git
synced 2025-05-10 17:09:17 +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
925 B
Python
33 lines
925 B
Python
"""Mycroft AI notification platform."""
|
|
import logging
|
|
|
|
from homeassistant.components.notify import BaseNotificationService
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
def get_service(hass, config, discovery_info=None):
|
|
"""Get the Mycroft notification service."""
|
|
return MycroftNotificationService(
|
|
hass.data['mycroft'])
|
|
|
|
|
|
class MycroftNotificationService(BaseNotificationService):
|
|
"""The Mycroft Notification Service."""
|
|
|
|
def __init__(self, mycroft_ip):
|
|
"""Initialize the service."""
|
|
self.mycroft_ip = mycroft_ip
|
|
|
|
def send_message(self, message="", **kwargs):
|
|
"""Send a message mycroft to speak on instance."""
|
|
from mycroftapi import MycroftAPI
|
|
|
|
text = message
|
|
mycroft = MycroftAPI(self.mycroft_ip)
|
|
if mycroft is not None:
|
|
mycroft.speak_text(text)
|
|
else:
|
|
_LOGGER.log("Could not reach this instance of mycroft")
|