Initializing Your Components

After loading, the bootstrapper will call setup(hass, config) method on the component to initialize it.

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. This is the ServiceRegistry. It allows you to register services.
See available methods.

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:


Then in the setup method of your component you will be able to refer to config['example']['host'] to get the value