2019-04-03 17:40:03 +02:00
|
|
|
"""Demo notification service."""
|
2019-03-27 20:36:13 -07:00
|
|
|
from homeassistant.components.notify import BaseNotificationService
|
2015-03-16 22:20:31 -07:00
|
|
|
|
|
|
|
EVENT_NOTIFY = "notify"
|
|
|
|
|
|
|
|
|
2017-01-15 03:53:14 +01:00
|
|
|
def get_service(hass, config, discovery_info=None):
|
2016-02-24 10:38:06 +01:00
|
|
|
"""Get the demo notification service."""
|
2015-03-16 22:20:31 -07:00
|
|
|
return DemoNotificationService(hass)
|
|
|
|
|
|
|
|
|
|
|
|
class DemoNotificationService(BaseNotificationService):
|
2016-03-08 11:46:32 +01:00
|
|
|
"""Implement demo notification service."""
|
|
|
|
|
2015-03-16 22:20:31 -07:00
|
|
|
def __init__(self, hass):
|
2016-03-08 11:46:32 +01:00
|
|
|
"""Initialize the service."""
|
2015-03-16 22:20:31 -07:00
|
|
|
self.hass = hass
|
|
|
|
|
2016-08-16 22:05:41 -07:00
|
|
|
@property
|
|
|
|
def targets(self):
|
|
|
|
"""Return a dictionary of registered targets."""
|
2016-09-25 09:41:11 -07:00
|
|
|
return {"test target name": "test target id"}
|
2016-08-16 22:05:41 -07:00
|
|
|
|
2015-03-16 22:20:31 -07:00
|
|
|
def send_message(self, message="", **kwargs):
|
2016-03-08 11:46:32 +01:00
|
|
|
"""Send a message to a user."""
|
2019-07-31 12:25:30 -07:00
|
|
|
kwargs["message"] = message
|
2016-08-09 20:23:57 -07:00
|
|
|
self.hass.bus.fire(EVENT_NOTIFY, kwargs)
|