2014-09-21 02:19:39 +00:00
|
|
|
"""
|
|
|
|
custom_components.example
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Bare minimum what is needed for a component to be valid.
|
|
|
|
"""
|
|
|
|
|
2014-09-26 21:27:28 +00:00
|
|
|
# The domain of your component. Should be equal to the name of your component
|
2014-09-21 02:19:39 +00:00
|
|
|
DOMAIN = "example"
|
2014-09-26 21:27:28 +00:00
|
|
|
|
|
|
|
# List of component names (string) your component depends upon
|
|
|
|
# If you are setting up a group but not using a group for anything, don't depend on group
|
2014-09-21 02:19:39 +00:00
|
|
|
DEPENDENCIES = []
|
|
|
|
|
|
|
|
# pylint: disable=unused-argument
|
|
|
|
def setup(hass, config):
|
|
|
|
""" Register services or listen for events that your component needs. """
|
|
|
|
|
|
|
|
# Example of a service that prints the service call to the command-line.
|
2014-09-26 21:27:28 +00:00
|
|
|
hass.services.register(DOMAIN, "example_service_name", print)
|
2014-09-21 02:19:39 +00:00
|
|
|
|
|
|
|
# This prints a time change event to the command-line twice a minute.
|
|
|
|
hass.track_time_change(print, second=[0, 30])
|
|
|
|
|
2014-09-26 21:27:28 +00:00
|
|
|
# See also (defined in homeassistant/__init__.py):
|
2014-09-21 02:19:39 +00:00
|
|
|
# hass.track_state_change
|
|
|
|
# hass.track_point_in_time
|
|
|
|
|
2014-09-26 21:27:28 +00:00
|
|
|
# Tells the bootstrapper that the component was succesfully initialized
|
2014-09-21 02:19:39 +00:00
|
|
|
return True
|