mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-04 18:18:58 +00:00
1.8 KiB
1.8 KiB
layout, title, description, date, sidebar, comments, sharing, footer
layout | title | description | date | sidebar | comments | sharing | footer |
---|---|---|---|---|---|---|---|
page | Initializing your components | Instructions how to handle initialization of your component. | 2016-04-16 13:32 | true | false | true | true |
After loading, the bootstrapper will call setup(hass, config)
method on the component to initialize it.
{% linkable_title hass: the Home Assistant instance %}
The Home Assistant instance contains four objects to help you interact with the system.
Object | Description |
---|---|
hass.config |
This is the core configuration of Home Assistant exposing location, temperature preferences and config directory path. Details |
hass.states |
This is the StateMachine. It allows you to set states and track when they are changed. See available methods. |
hass.bus |
This is the EventBus. It allows you to trigger and listen for events. See available methods. |
hass.services |
This is the ServiceRegistry. It allows you to register services. See available methods. |
{% linkable_title config: User given configuration. %}
The config
parameter is a dictionary containing the user supplied configuration. The keys of the dictionary are the component names and the value is another dictionary with the component configuration.
If your configuration file contains the following lines:
example:
host: paulusschoutsen.nl
Then in the setup method of your component you will be able to refer to config['example']['host']
to get the value paulusschoutsen.nl
.