2015-03-16 22:20:31 -07:00
|
|
|
"""
|
|
|
|
Demo notification service.
|
2016-02-24 10:38:06 +01:00
|
|
|
|
|
|
|
For more details about this platform, please refer to the documentation
|
|
|
|
https://home-assistant.io/components/demo/
|
2015-03-16 22:20:31 -07:00
|
|
|
"""
|
2019-03-20 22:56:46 -07:00
|
|
|
from . 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."""
|
2016-08-09 20:23:57 -07:00
|
|
|
kwargs['message'] = message
|
|
|
|
self.hass.bus.fire(EVENT_NOTIFY, kwargs)
|