core/homeassistant/components/demo/notify.py

28 lines
790 B
Python
Raw Normal View History

"""Demo notification service."""
from homeassistant.components.notify import BaseNotificationService
EVENT_NOTIFY = "notify"
def get_service(hass, config, discovery_info=None):
"""Get the demo notification service."""
return DemoNotificationService(hass)
class DemoNotificationService(BaseNotificationService):
2016-03-08 10:46:32 +00:00
"""Implement demo notification service."""
def __init__(self, hass):
2016-03-08 10:46:32 +00:00
"""Initialize the service."""
self.hass = hass
@property
def targets(self):
"""Return a dictionary of registered targets."""
return {"test target name": "test target id"}
def send_message(self, message="", **kwargs):
2016-03-08 10:46:32 +00:00
"""Send a message to a user."""
2019-07-31 19:25:30 +00:00
kwargs["message"] = message
2016-08-10 03:23:57 +00:00
self.hass.bus.fire(EVENT_NOTIFY, kwargs)