core/config/custom_components/example.py

33 lines
1016 B
Python
Raw Normal View History

"""
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
DOMAIN = "example"
2014-09-26 21:27:28 +00:00
# List of component names (string) your component depends upon
2014-10-29 07:47:55 +00:00
# If you are setting up a group but not using a group for anything,
# don't depend on group
DEPENDENCIES = []
2014-10-29 07:47:55 +00:00
# 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)
# 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):
# hass.states.track_change
# hass.track_point_in_time
2014-09-26 21:27:28 +00:00
# Tells the bootstrapper that the component was succesfully initialized
return True