1
mirror of https://github.com/home-assistant/core synced 2024-09-12 15:16:21 +02:00
ha-core/homeassistant/components/notify/demo.py

33 lines
908 B
Python
Raw Normal View History

"""
Demo notification service.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
2016-08-10 05:23:57 +02:00
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 11:46:32 +01:00
"""Implement demo notification service."""
def __init__(self, hass):
2016-03-08 11:46:32 +01: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 11:46:32 +01:00
"""Send a message to a user."""
2016-08-10 05:23:57 +02:00
kwargs['message'] = message
self.hass.bus.fire(EVENT_NOTIFY, kwargs)