Home Assistant Documentation Release 2021.10.0.dev0

Home Assistant Team

Sep 29, 2021

CONTENTS

1 homeassistant.auth 3 1.1 homeassistant.auth.auth_store...... 5 1.2 homeassistant.auth.const...... 6 1.3 homeassistant.auth.models...... 7

2 homeassistant.bootstrap 9

3 homeassistant.components 11 3.1 air_quality...... 11 3.2 alarm_control_panel...... 12 3.3 binary_sensor...... 15 3.4 camera...... 17 3.5 calendar...... 22 3.6 climate...... 23 3.7 conversation...... 27 3.8 cover...... 28 3.9 device_tracker...... 30 3.10 fan...... 30 3.11 light...... 34 3.12 lock...... 37 3.13 media_player...... 38 3.14 notify...... 45 3.15 remote...... 46 3.16 switch...... 47 3.17 sensor...... 49 3.18 vacuum...... 50 3.19 water_heater...... 53 3.20 weather...... 56 3.21 webhook...... 58

4 homeassistant.config_entries 61

5 homeassistant.core 67

6 homeassistant.data_entry_flow 75

7 homeassistant.exceptions 77

8 homeassistant.helpers 79 8.1 homeassistant.helpers.aiohttp_client...... 79 8.2 homeassistant.helpers.area_registry...... 80

i 8.3 homeassistant.helpers.check_config...... 82 8.4 homeassistant.helpers.collection...... 82 8.5 homeassistant.helpers.condition...... 85 8.6 homeassistant.helpers.config_entry_flow...... 89 8.7 homeassistant.helpers.config_entry_oauth2_flow...... 91 8.8 homeassistant.helpers.config_validation...... 95 8.9 homeassistant.helpers.data_entry_flow...... 99 8.10 homeassistant.helpers.debounce...... 99 8.11 homeassistant.helpers.deprecation...... 100 8.12 homeassistant.helpers.device_registry...... 100 8.13 homeassistant.helpers.discovery...... 104 8.14 homeassistant.helpers.dispatcher...... 105 8.15 homeassistant.helpers.entity...... 106 8.16 homeassistant.helpers.entity_component...... 111 8.17 homeassistant.helpers.entity_platform...... 112 8.18 homeassistant.helpers.entity_registry...... 114 8.19 homeassistant.helpers.entity_values...... 117 8.20 homeassistant.helpers.entityfilter...... 118 8.21 homeassistant.helpers.event...... 118 8.22 homeassistant.helpers.icon...... 125 8.23 homeassistant.helpers.integration_platform...... 125 8.24 homeassistant.helpers.intent...... 126 8.25 homeassistant.helpers.json...... 128 8.26 homeassistant.helpers.location...... 128 8.27 homeassistant.helpers.logging...... 129 8.28 homeassistant.helpers.network...... 129 8.29 homeassistant.helpers.restore_state...... 130 8.30 homeassistant.helpers.script...... 131 8.31 homeassistant.helpers.service...... 132 8.32 homeassistant.helpers.signal...... 136 8.33 homeassistant.helpers.state...... 137 8.34 homeassistant.helpers.storage...... 137 8.35 homeassistant.helpers.sun...... 138 8.36 homeassistant.helpers.system_info...... 139 8.37 homeassistant.helpers.temperature...... 139 8.38 homeassistant.helpers.template...... 139 8.39 homeassistant.helpers.translation...... 145 8.40 homeassistant.helpers.typing...... 146 8.41 homeassistant.helpers.update_coordinator...... 146

9 homeassistant.loader 149

10 homeassistant.util 153 10.1 homeassistant.util.yaml...... 154 10.2 homeassistant.util.aiohttp...... 155 10.3 homeassistant.util.async_...... 155 10.4 homeassistant.util.color...... 156 10.5 homeassistant.util.decorator...... 159 10.6 homeassistant.util.distance...... 159 10.7 homeassistant.util.dt...... 159 10.8 homeassistant.util.json...... 160 10.9 homeassistant.util.location...... 161 10.10 homeassistant.util.logging...... 162 10.11 homeassistant.util.network...... 163 ii 10.12 homeassistant.util.package...... 164 10.13 homeassistant.util.pil...... 164 10.14 homeassistant.util.pressure...... 164 10.15 homeassistant.util.ssl...... 165 10.16 homeassistant.util.temperature...... 165 10.17 homeassistant.util.unit_system...... 165 10.18 homeassistant.util.volume...... 166

11 Indices and tables 167

Python Module Index 169

Index 171

iii iv Home Assistant Documentation, Release 2021.10.0.dev0

Public API documentation for Home Assistant developers. Contents:

CONTENTS 1 Home Assistant Documentation, Release 2021.10.0.dev0

2 CONTENTS CHAPTER ONE

HOMEASSISTANT.AUTH

Provide an authentication layer for Home Assistant. class homeassistant.auth.AuthManager(hass: homeassistant.core.HomeAssistant, store: homeassistant.auth.auth_store.AuthStore, providers: Dict[Tuple[str, Optional[str]], homeassistant.auth.providers.AuthProvider], mfa_modules: Dict[str, homeassis- tant.auth.mfa_modules.MultiFactorAuthModule]) Manage the authentication for Home Assistant. async async_activate_user(user: homeassistant.auth.models.User) → None Activate a user. async_create_access_token(refresh_token: models.RefreshToken, remote_ip: str | None = None) → str Create a new access token. async async_create_refresh_token(user: models.User, client_id: str | None = None, client_name: str | None = None, client_icon: str | None = None, token_type: str | None = None, access_token_expiration: timedelta = datetime.timedelta(seconds=1800), credential: models.Credentials | None = None) → mod- els.RefreshToken Create a new refresh token for a user. async async_create_system_user(name: str, group_ids: list[str] | None = None) → mod- els.User Create a system user. async async_create_user(name: str, group_ids: list[str] | None = None) → models.User Create a user. async async_deactivate_user(user: homeassistant.auth.models.User) → None Deactivate a user. async async_disable_user_mfa(user: homeassistant.auth.models.User, mfa_module_id: str) → None Disable a multi-factor auth module for user. async async_enable_user_mfa(user: homeassistant.auth.models.User, mfa_module_id: str, data: Any) → None Enable a multi-factor auth module for user. async async_get_enabled_mfa(user: models.User) → dict[str, str] List enabled mfa modules for user.

3 Home Assistant Documentation, Release 2021.10.0.dev0

async async_get_group(group_id: str) → models.Group | None Retrieve all groups. async async_get_or_create_user(credentials: homeassistant.auth.models.Credentials) → homeassistant.auth.models.User Get or create a user. async async_get_owner() → models.User | None Retrieve the owner. async async_get_refresh_token(token_id: str) → models.RefreshToken | None Get refresh token by id. async async_get_refresh_token_by_token(token: str) → models.RefreshToken | None Get refresh token by token. async async_get_user(user_id: str) → models.User | None Retrieve a user. async async_get_user_by_credentials(credentials: models.Credentials) → models.User | None Get a user by credential, return None if not found. async async_get_users() → list[models.User] Retrieve all users. async async_link_user(user: homeassistant.auth.models.User, credentials: homeassis- tant.auth.models.Credentials) → None Link credentials to an existing user. async async_remove_credentials(credentials: homeassistant.auth.models.Credentials) → None Remove credentials. async async_remove_refresh_token(refresh_token: homeassis- tant.auth.models.RefreshToken) → None Delete a refresh token. async async_remove_user(user: homeassistant.auth.models.User) → None Remove a user. async async_update_user(user: models.User, name: str | None = None, is_active: bool | None = None, group_ids: list[str] | None = None) → None Update a user. async async_validate_access_token(token: str) → models.RefreshToken | None Return refresh token if an access token is valid. async_validate_refresh_token(refresh_token: models.RefreshToken, remote_ip: str | None = None) → None Validate that a refresh token is usable. Will raise InvalidAuthError on errors. property auth_mfa_modules Return a list of available auth modules. property auth_providers Return a list of available auth providers. get_auth_mfa_module(module_id: str) → MultiFactorAuthModule | None Return a multi-factor auth module, None if not found. get_auth_provider(provider_type: str, provider_id: str | None) → AuthProvider | None Return an auth provider, None if not found.

4 Chapter 1. homeassistant.auth Home Assistant Documentation, Release 2021.10.0.dev0

get_auth_providers(provider_type: str) → list[AuthProvider] Return a List of auth provider of one type, Empty if not found. class homeassistant.auth.AuthManagerFlowManager(hass: homeassis- tant.core.HomeAssistant, auth_manager: homeassis- tant.auth.AuthManager) Manage authentication flows. async async_create_flow(handler_key: Any, *, context: dict[str, Any] | None = None, data: dict[str, Any] | None = None) → data_entry_flow.FlowHandler Create a login flow. async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, result: homeassistant.data_entry_flow.FlowResult) → homeassis- tant.data_entry_flow.FlowResult Return a user as result of login flow. exception homeassistant.auth.InvalidAuthError Raised when a authentication error occurs. exception homeassistant.auth.InvalidProvider Authentication provider not found. async homeassistant.auth.auth_manager_from_config(hass: HomeAssistant, provider_configs: list[dict[str, Any]], module_configs: list[dict[str, Any]]) → AuthManager Initialize an auth manager from config. CORE_CONFIG_SCHEMA will make sure do duplicated auth providers or mfa modules exist in configs.

1.1 homeassistant.auth.auth_store

Storage for auth models. class homeassistant.auth.auth_store.AuthStore(hass: homeassis- tant.core.HomeAssistant) Bases: object Stores authentication info. Any mutation to an object should happen inside the auth store. The auth store is lazy. It won’t load the data from disk until a method is called that needs it. async async_activate_user(user: homeassistant.auth.models.User) → None Activate a user. async async_create_refresh_token(user: models.User, client_id: str | None = None, client_name: str | None = None, client_icon: str | None = None, token_type: str = 'nor- mal', access_token_expiration: timedelta = datetime.timedelta(seconds=1800), credential: models.Credentials | None = None) → mod- els.RefreshToken Create a new token for a user.

1.1. homeassistant.auth.auth_store 5 Home Assistant Documentation, Release 2021.10.0.dev0

async async_create_user(name: str | None, is_owner: bool | None = None, is_active: bool | None = None, system_generated: bool | None = None, credentials: models.Credentials | None = None, group_ids: list[str] | None = None) → models.User Create a new user. async async_deactivate_user(user: homeassistant.auth.models.User) → None Activate a user. async async_get_group(group_id: str) → models.Group | None Retrieve all users. async async_get_groups() → list[models.Group] Retrieve all users. async async_get_refresh_token(token_id: str) → models.RefreshToken | None Get refresh token by id. async async_get_refresh_token_by_token(token: str) → models.RefreshToken | None Get refresh token by token. async async_get_user(user_id: str) → models.User | None Retrieve a user by id. async async_get_users() → list[models.User] Retrieve all users. async async_link_user(user: homeassistant.auth.models.User, credentials: homeassis- tant.auth.models.Credentials) → None Add credentials to an existing user. async_log_refresh_token_usage(refresh_token: models.RefreshToken, remote_ip: str | None = None) → None Update refresh token last used information. async async_remove_credentials(credentials: homeassistant.auth.models.Credentials) → None Remove credentials. async async_remove_refresh_token(refresh_token: homeassis- tant.auth.models.RefreshToken) → None Remove a refresh token. async async_remove_user(user: homeassistant.auth.models.User) → None Remove a user. async async_update_user(user: models.User, name: str | None = None, is_active: bool | None = None, group_ids: list[str] | None = None) → None Update a user.

1.2 homeassistant.auth.const

Constants for the auth module.

6 Chapter 1. homeassistant.auth Home Assistant Documentation, Release 2021.10.0.dev0

1.3 homeassistant.auth.models

Auth models. class homeassistant.auth.models.Credentials(auth_provider_type: str, auth_provider_id: str | None, data: dict, id: str = NOTHING, is_new: bool = True) Bases: object Credentials for a user on an auth provider. auth_provider_id auth_provider_type data id is_new class homeassistant.auth.models.Group(name: str | None, policy: perm_mdl.PolicyType, id: str = NOTHING, system_generated: bool = False) Bases: object A group. id name policy system_generated class homeassistant.auth.models.RefreshToken(user: User, client_id: str | None, access_token_expiration: timedelta, client_name: str | None = None, client_icon: str | None = None, token_type: str = 'normal', id: str = NOTHING, cre- ated_at: datetime = NOTHING, token: str = NOTHING, jwt_key: str = NOTHING, last_used_at: datetime | None = None, last_used_ip: str | None = None, creden- tial: Credentials | None = None, version: str | None = '2021.10.0.dev0') Bases: object RefreshToken for a user to grant new access tokens. access_token_expiration client_icon client_id client_name created_at credential id jwt_key

1.3. homeassistant.auth.models 7 Home Assistant Documentation, Release 2021.10.0.dev0

last_used_at last_used_ip token token_type user version class homeassistant.auth.models.User(name: str | None, perm_lookup: perm_mdl.PermissionLookup, id: str = NOTH- ING, is_owner: bool = False, is_active: bool = False, system_generated: bool = False, groups: list[Group] = NOTHING, credentials: list[Credentials] = NOTHING, refresh_tokens: dict[str, RefreshToken] = NOTHING) Bases: object A user. credentials groups id invalidate_permission_cache() → None Invalidate permission cache. is_active property is_admin Return if user is part of the admin group. is_owner name perm_lookup property permissions Return permissions object for user. refresh_tokens system_generated class homeassistant.auth.models.UserMeta Bases: tuple User metadata. is_active Alias for field number 1 name Alias for field number 0

8 Chapter 1. homeassistant.auth CHAPTER TWO

HOMEASSISTANT.BOOTSTRAP

Provide methods to bootstrap a Home Assistant instance. homeassistant.bootstrap.async_enable_logging(hass: core.HomeAssistant, verbose: bool = False, log_rotate_days: int | None = None, log_file: str | None = None, log_no_color: bool = False) → None Set up the logging. This method must be run in the event loop. async homeassistant.bootstrap.async_from_config_dict(config: ConfigType, hass: core.HomeAssistant) → core.HomeAssistant | None Try to configure Home Assistant from a configuration dictionary. Dynamically loads required components and its dependencies. This method is a coroutine. async homeassistant.bootstrap.async_mount_local_lib_path(config_dir: str) → str Add local library to Python Path. This function is a coroutine. async homeassistant.bootstrap.async_setup_hass(runtime_config: RuntimeConfig) → core.HomeAssistant | None Set up Home Assistant. async homeassistant.bootstrap.async_setup_multi_components(hass: core.HomeAssistant, domains: set[str], config: dict[str, Any]) → None Set up multiple domains. Log on failure. homeassistant.bootstrap.open_hass_ui(hass: homeassistant.core.HomeAssistant) → None Open the UI.

9 Home Assistant Documentation, Release 2021.10.0.dev0

10 Chapter 2. homeassistant.bootstrap CHAPTER THREE

HOMEASSISTANT.COMPONENTS

3.1 air_quality

Component for handling Air Quality data for your location. class homeassistant.components.air_quality.AirQualityEntity Bases: homeassistant.helpers.entity.Entity ABC for air quality data. property air_quality_index Return the Air Quality Index (AQI). property attribution Return the attribution. property carbon_dioxide Return the CO2 (carbon dioxide) level. property carbon_monoxide Return the CO (carbon monoxide) level. entity_description = None property nitrogen_dioxide Return the NO2 (nitrogen dioxide) level. property nitrogen_monoxide Return the NO (nitrogen monoxide) level. property nitrogen_oxide Return the N2O (nitrogen oxide) level. property ozone Return the O3 (ozone) level. property particulate_matter_0_1 Return the particulate matter 0.1 level. property particulate_matter_10 Return the particulate matter 10 level. property particulate_matter_2_5 Return the particulate matter 2.5 level. property state Return the current state.

11 Home Assistant Documentation, Release 2021.10.0.dev0

property state_attributes Return the state attributes. property sulphur_dioxide Return the SO2 (sulphur dioxide) level. property unit_of_measurement Return the unit of measurement of this entity. async homeassistant.components.air_quality.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Set up the air quality component. async homeassistant.components.air_quality.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.air_quality.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.2 alarm_control_panel

Component to interface with an alarm control panel. class homeassistant.components.alarm_control_panel.AlarmControlPanel Bases: homeassistant.components.alarm_control_panel.AlarmControlPanelEntity An abstract class for alarm control entities (for backwards compatibility). entity_description = None class homeassistant.components.alarm_control_panel.AlarmControlPanelEntity Bases: homeassistant.helpers.entity.Entity An abstract class for alarm control entities. alarm_arm_away(code: str | None = None) → None Send arm away command. alarm_arm_custom_bypass(code: str | None = None) → None Send arm custom bypass command. alarm_arm_home(code: str | None = None) → None Send arm home command. alarm_arm_night(code: str | None = None) → None Send arm night command. alarm_arm_vacation(code: str | None = None) → None Send arm vacation command.

12 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

alarm_disarm(code: str | None = None) → None Send disarm command. alarm_trigger(code: str | None = None) → None Send alarm trigger command. async async_alarm_arm_away(code: str | None = None) → None Send arm away command. async async_alarm_arm_custom_bypass(code: str | None = None) → None Send arm custom bypass command. async async_alarm_arm_home(code: str | None = None) → None Send arm home command. async async_alarm_arm_night(code: str | None = None) → None Send arm night command. async async_alarm_arm_vacation(code: str | None = None) → None Send arm vacation command. async async_alarm_disarm(code: str | None = None) → None Send disarm command. async async_alarm_trigger(code: str | None = None) → None Send alarm trigger command. property changed_by Last change triggered by. property code_arm_required Whether the code is required for arm actions. property code_format Regex for code format or None if no code is required. entity_description = None property state_attributes Return the state attributes. property supported_features Return the list of supported features.

3.2. alarm_control_panel 13 Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.alarm_control_panel.AlarmControlPanelEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes alarm control panel entities. key = None async homeassistant.components.alarm_control_panel.async_setup(hass: home- assis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for sensors.

14 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.alarm_control_panel.async_setup_entry(hass: home- assis- tant.core.HomeAssistant, entry: home- assis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.alarm_control_panel.async_unload_entry(hass: home- assis- tant.core.HomeAssistant, entry: home- assis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.3 binary_sensor

Component to interface with binary sensors. class homeassistant.components.binary_sensor.BinarySensorDevice Bases: homeassistant.components.binary_sensor.BinarySensorEntity Represent a binary sensor (for backwards compatibility). entity_description = None class homeassistant.components.binary_sensor.BinarySensorEntity Bases: homeassistant.helpers.entity.Entity Represent a binary sensor. entity_description = None property is_on Return true if the binary sensor is on. property state Return the state of the binary sensor.

3.3. binary_sensor 15 Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.binary_sensor.BinarySensorEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes binary sensor entities. key = None async homeassistant.components.binary_sensor.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for binary sensors. async homeassistant.components.binary_sensor.async_setup_entry(hass: home- assis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry.

16 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.binary_sensor.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.4 camera

Component to interface with cameras. class homeassistant.components.camera.Camera Bases: homeassistant.helpers.entity.Entity The base class for camera entities. async async_camera_image(width: int | None = None, height: int | None = None) → bytes | None Return bytes of camera image. async async_disable_motion_detection() → None Call the job and disable motion detection. async async_enable_motion_detection() → None Call the job and enable motion detection. async async_turn_off() → None Turn off camera. async async_turn_on() → None Turn off camera. async_update_token() → None Update the used token. async_warn_old_async_camera_image_signature() → None Warn once when calling async_camera_image with the function old signature. property brand Return the camera brand. camera_image(width: int | None = None, height: int | None = None) → bytes | None Return bytes of camera image. async create_stream() → Stream | None Create a Stream for stream_source. disable_motion_detection() → None Disable motion detection in camera. enable_motion_detection() → None Enable motion detection in the camera. entity_description = None property entity_picture Return a link to the camera feed as entity picture.

3.4. camera 17 Home Assistant Documentation, Release 2021.10.0.dev0

property frame_interval Return the interval between frames of the mjpeg stream. async handle_async_mjpeg_stream(request: web.Request) → web.StreamResponse | None Serve an HTTP MJPEG stream from the camera. This method can be overridden by camera platforms to proxy a direct stream from the camera. async handle_async_still_stream(request: aiohttp.web_request.Request, interval: float) → aiohttp.web_response.StreamResponse Generate an HTTP MJPEG stream from camera images. property is_on Return true if on. property is_recording Return true if the device is recording. property model Return the camera model. property motion_detection_enabled Return the camera motion detection status. property should_poll No need to poll cameras. property state Return the camera state. property state_attributes Return the camera state attributes. async stream_source() → str | None Return the source of the stream. property supported_features Flag supported features. turn_off() → None Turn off camera. turn_on() → None Turn off camera. class homeassistant.components.camera.CameraEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes camera entities. key = None

18 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.camera.CameraImageView(component: homeassis- tant.helpers.entity_component.EntityComponent) Bases: homeassistant.components.camera.CameraView Camera view to serve an image. async handle(request: aiohttp.web_request.Request, camera: homeassis- tant.components.camera.Camera) → aiohttp.web_response.Response Serve camera image. name = 'api:camera:image' url: str | None = '/api/camera_proxy/{entity_id}' class homeassistant.components.camera.CameraMjpegStream(component: homeassis- tant.helpers.entity_component.EntityComponent) Bases: homeassistant.components.camera.CameraView Camera View to serve an MJPEG stream. async handle(request: aiohttp.web_request.Request, camera: homeassis- tant.components.camera.Camera) → aiohttp.web_response.StreamResponse Serve camera stream, possibly with interval. name = 'api:camera:stream' url: str | None = '/api/camera_proxy_stream/{entity_id}' class homeassistant.components.camera.CameraView(component: homeassis- tant.helpers.entity_component.EntityComponent) Bases: homeassistant.components.http.view.HomeAssistantView Base CameraView. async get(request: aiohttp.web_request.Request, entity_id: str) → aio- http.web_response.StreamResponse Start a GET request. async handle(request: aiohttp.web_request.Request, camera: homeassis- tant.components.camera.Camera) → aiohttp.web_response.StreamResponse Handle the camera request. requires_auth = False class homeassistant.components.camera.Image(content_type: str, content: bytes) Bases: object Represent an image. content = None content_type = None async homeassistant.components.camera.async_get_image(hass: HomeAssistant, en- tity_id: str, timeout: int = 10, width: int | None = None, height: int | None = None) → Image Fetch an image from a camera entity. width and height will be passed to the underlying camera.

3.4. camera 19 Home Assistant Documentation, Release 2021.10.0.dev0 async homeassistant.components.camera.async_get_mjpeg_stream(hass: HomeAs- sistant, request: web.Request, entity_id: str) → web.StreamResponse | None Fetch an mjpeg stream from a camera entity. async homeassistant.components.camera.async_get_still_stream(request: web.Request, image_cb: Callable[[], Awaitable[bytes | None]], con- tent_type: str, interval: float) → web.StreamResponse Generate an HTTP MJPEG stream from camera images. This method must be run in the event loop. async homeassistant.components.camera.async_get_stream_source(hass: HomeAs- sistant, entity_id: str) → str | None Fetch the stream source for a camera entity. async homeassistant.components.camera.async_handle_play_stream_service(camera: home- as- sis- tant.components.camera.Camera, ser- vice_call: home- as- sis- tant.core.ServiceCall) → None Handle play stream services calls. async homeassistant.components.camera.async_handle_record_service(camera: homeassis- tant.components.camera.Camera, ser- vice_call: homeassis- tant.core.ServiceCall) → None Handle stream recording service calls.

20 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0 async homeassistant.components.camera.async_handle_snapshot_service(camera: home- assis- tant.components.camera.Camera, ser- vice_call: home- assis- tant.core.ServiceCall) → None Handle snapshot services calls. async homeassistant.components.camera.async_request_stream(hass: homeassis- tant.core.HomeAssistant, entity_id: str, fmt: str) → str Request a stream for a camera entity. async homeassistant.components.camera.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Set up the camera component. async homeassistant.components.camera.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.camera.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.camera.websocket_camera_thumbnail(hass: homeassis- tant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Handle get camera thumbnail websocket command. Async friendly. homeassistant.components.camera.websocket_get_prefs(hass: homeassis- tant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Handle request for account info. homeassistant.components.camera.websocket_update_prefs(hass: homeassis- tant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Handle request for account info.

3.4. camera 21 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.components.camera.ws_camera_stream(hass: homeassis- tant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Handle get camera stream websocket command. Async friendly.

3.5 calendar

Support for Google Calendar event device sensors. class homeassistant.components.calendar.CalendarEventDevice Bases: homeassistant.helpers.entity.Entity Base class for calendar event entities. async async_get_events(hass, start_date, end_date) Return calendar events within a datetime range. entity_description = None property event Return the next upcoming event. property state Return the state of the calendar event. property state_attributes Return the entity state attributes. class homeassistant.components.calendar.CalendarEventView(component: homeassis- tant.helpers.entity_component.EntityComponent) Bases: homeassistant.components.http.view.HomeAssistantView View to retrieve calendar content. async get(request, entity_id) Return calendar events. name = 'api:calendars:calendar' url: str | None = '/api/calendars/{entity_id}' class homeassistant.components.calendar.CalendarListView(component: homeassis- tant.helpers.entity_component.EntityComponent) Bases: homeassistant.components.http.view.HomeAssistantView View to retrieve calendar list. async get(request: aiohttp.web_request.Request) → aiohttp.web_response.Response Retrieve calendar list. name = 'api:calendars' url: str | None = '/api/calendars' async homeassistant.components.calendar.async_setup(hass, config) Track states and offer events for calendars.

22 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.calendar.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.calendar.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.calendar.calculate_offset(event, offset) Calculate event offset. Return the updated event with the offset_time included. homeassistant.components.calendar.get_date(date) Get the dateTime from date or dateTime as a local. homeassistant.components.calendar.is_offset_reached(event) Have we reached the offset time specified in the event title. homeassistant.components.calendar.normalize_event(event) Normalize a calendar event.

3.6 climate

Provides functionality to interact with climate devices. class homeassistant.components.climate.ClimateDevice Bases: homeassistant.components.climate.ClimateEntity Representation of a climate entity (for backwards compatibility). entity_description = None class homeassistant.components.climate.ClimateEntity Bases: homeassistant.helpers.entity.Entity Base class for climate entities. async async_set_fan_mode(fan_mode: str) → None Set new target fan mode. async async_set_humidity(humidity: int) → None Set new target humidity. async async_set_hvac_mode(hvac_mode: str) → None Set new target hvac mode. async async_set_preset_mode(preset_mode: str) → None Set new preset mode. async async_set_swing_mode(swing_mode: str) → None Set new target swing operation. async async_set_temperature(**kwargs) → None Set new target temperature.

3.6. climate 23 Home Assistant Documentation, Release 2021.10.0.dev0

async async_turn_aux_heat_off() → None Turn auxiliary heater off. async async_turn_aux_heat_on() → None Turn auxiliary heater on. async async_turn_off() → None Turn the entity off. async async_turn_on() → None Turn the entity on. property capability_attributes Return the capability attributes. property current_humidity Return the current humidity. property current_temperature Return the current temperature. entity_description = None property fan_mode Return the fan setting. Requires SUPPORT_FAN_MODE. property fan_modes Return the list of available fan modes. Requires SUPPORT_FAN_MODE. property hvac_action Return the current running hvac operation if supported. Need to be one of CURRENT_HVAC_*. property hvac_mode Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*. property hvac_modes Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES. property is_aux_heat Return true if aux heater. Requires SUPPORT_AUX_HEAT. property max_humidity Return the maximum humidity. property max_temp Return the maximum temperature. property min_humidity Return the minimum humidity. property min_temp Return the minimum temperature.

24 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property precision Return the precision of the system. property preset_mode Return the current preset mode, e.g., home, away, temp. Requires SUPPORT_PRESET_MODE. property preset_modes Return a list of available preset modes. Requires SUPPORT_PRESET_MODE. set_fan_mode(fan_mode: str) → None Set new target fan mode. set_humidity(humidity: int) → None Set new target humidity. set_hvac_mode(hvac_mode: str) → None Set new target hvac mode. set_preset_mode(preset_mode: str) → None Set new preset mode. set_swing_mode(swing_mode: str) → None Set new target swing operation. set_temperature(**kwargs) → None Set new target temperature. property state Return the current state. property state_attributes Return the optional state attributes. property supported_features Return the list of supported features. property swing_mode Return the swing setting. Requires SUPPORT_SWING_MODE. property swing_modes Return the list of available swing modes. Requires SUPPORT_SWING_MODE. property target_humidity Return the humidity we try to reach. property target_temperature Return the temperature we try to reach. property target_temperature_high Return the highbound target temperature we try to reach. Requires SUPPORT_TARGET_TEMPERATURE_RANGE. property target_temperature_low Return the lowbound target temperature we try to reach. Requires SUPPORT_TARGET_TEMPERATURE_RANGE.

3.6. climate 25 Home Assistant Documentation, Release 2021.10.0.dev0

property target_temperature_step Return the supported step of target temperature. property temperature_unit Return the unit of measurement used by the platform. turn_aux_heat_off() → None Turn auxiliary heater off. turn_aux_heat_on() → None Turn auxiliary heater on. class homeassistant.components.climate.ClimateEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes climate entities. key = None async homeassistant.components.climate.async_service_aux_heat(entity: homeassis- tant.components.climate.ClimateEntity, service_call: homeassis- tant.core.ServiceCall) → None Handle aux heat service. async homeassistant.components.climate.async_service_temperature_set(entity: home- assis- tant.components.climate.ClimateEntity, ser- vice_call: home- assis- tant.core.ServiceCall) → None Handle set temperature service. async homeassistant.components.climate.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Set up climate entities.

26 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.climate.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.climate.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.7 conversation

Support for functionality to have conversations with Home Assistant. class homeassistant.components.conversation.ConversationProcessView Bases: homeassistant.components.http.view.HomeAssistantView View to process text. name = 'api:conversation:process' async post(request, data) Send a request for processing. url: str | None = '/api/conversation/process' homeassistant.components.conversation.async_set_agent(hass: homeassis- tant.core.HomeAssistant, agent: homeassis- tant.components.conversation.agent.AbstractConversationAgent) Set the agent to handle the conversations. async homeassistant.components.conversation.async_setup(hass, config) Register the process service. homeassistant.components.conversation.websocket_get_agent_info(hass, connec- tion, msg) Do we need onboarding. homeassistant.components.conversation.websocket_process(hass, connection, msg) Process text. homeassistant.components.conversation.websocket_set_onboarding(hass, connec- tion, msg) Set onboarding status.

3.7. conversation 27 Home Assistant Documentation, Release 2021.10.0.dev0

3.8 cover

Support for Cover devices. class homeassistant.components.cover.CoverDevice Bases: homeassistant.components.cover.CoverEntity Representation of a cover (for backwards compatibility). entity_description = None class homeassistant.components.cover.CoverEntity Bases: homeassistant.helpers.entity.Entity Base class for cover entities. async async_close_cover(**kwargs) Close cover. async async_close_cover_tilt(**kwargs) Close the cover tilt. async async_open_cover(**kwargs) Open the cover. async async_open_cover_tilt(**kwargs) Open the cover tilt. async async_set_cover_position(**kwargs) Move the cover to a specific position. async async_set_cover_tilt_position(**kwargs) Move the cover tilt to a specific position. async async_stop_cover(**kwargs) Stop the cover. async async_stop_cover_tilt(**kwargs) Stop the cover. async async_toggle(**kwargs) Toggle the entity. async async_toggle_tilt(**kwargs) Toggle the entity. close_cover(**kwargs: Any) → None Close cover. close_cover_tilt(**kwargs: Any) → None Close the cover tilt. property current_cover_position Return current position of cover. None is unknown, 0 is closed, 100 is fully open. property current_cover_tilt_position Return current position of cover tilt. None is unknown, 0 is closed, 100 is fully open. entity_description = None

28 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property is_closed Return if the cover is closed or not. property is_closing Return if the cover is closing or not. property is_opening Return if the cover is opening or not. open_cover(**kwargs: Any) → None Open the cover. open_cover_tilt(**kwargs: Any) → None Open the cover tilt. set_cover_position(**kwargs) Move the cover to a specific position. set_cover_tilt_position(**kwargs) Move the cover tilt to a specific position. property state Return the state of the cover. property state_attributes Return the state attributes. stop_cover(**kwargs) Stop the cover. stop_cover_tilt(**kwargs) Stop the cover. property supported_features Flag supported features. toggle(**kwargs: Any) → None Toggle the entity. toggle_tilt(**kwargs: Any) → None Toggle the entity. class homeassistant.components.cover.CoverEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes cover entities. key = None async homeassistant.components.cover.async_setup(hass, config) Track states and offer events for covers.

3.8. cover 29 Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.cover.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.cover.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.cover.is_closed(hass, entity_id) Return if the cover is closed based on the statemachine.

3.9 device_tracker

Provide functionality to keep track of devices. async homeassistant.components.device_tracker.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Set up the device tracker. homeassistant.components.device_tracker.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool Return the state if any or a specified device is home.

3.10 fan

Provides functionality to interact with fans. class homeassistant.components.fan.FanEntity Bases: homeassistant.helpers.entity.ToggleEntity Base class for fan entities. async async_decrease_speed(percentage_step: int | None = None) → None Decrease the speed of the fan. async async_increase_speed(percentage_step: int | None = None) → None Increase the speed of the fan. async async_oscillate(oscillating: bool) Oscillate the fan. async async_set_direction(direction: str) Set the direction of the fan. async async_set_percentage(percentage: int) → None Set the speed of the fan, as a percentage. async async_set_preset_mode(preset_mode: str) → None Set new preset mode.

30 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async async_set_speed(speed: str) Set the speed of the fan. async async_set_speed_deprecated(speed: str) Set the speed of the fan. async async_turn_on(speed: str | None = None, percentage: int | None = None, preset_mode: str | None = None, **kwargs) → None Turn on the fan. async async_turn_on_compat(speed: str | None = None, percentage: int | None = None, pre- set_mode: str | None = None, **kwargs) → None Turn on the fan. This _compat version wraps async_turn_on with backwards and forward compatibility. After the transition to percentage and preset_modes concludes, it should be removed. property capability_attributes Return capability attributes. property current_direction Return the current direction of the fan. entity_description: FanEntityDescription = None property is_on Return true if the entity is on. oscillate(oscillating: bool) → None Oscillate the fan. property oscillating Return whether or not the fan is currently oscillating. property percentage Return the current speed as a percentage. property percentage_step Return the step size for percentage. percentage_to_speed(percentage: int) → str Map a percentage onto self.speed_list. Officially, this should only have to deal with 4 pre-defined speeds. if value == 0: return SPEED_OFF elif value <= 33: return SPEED_LOW elif value <= 66: return SPEED_MEDIUM else: return SPEED_HIGH Unfortunately there is currently a high degree of non-conformancy. Until fans have been corrected a more complicated and dynamic mapping is used. property preset_mode Return the current preset mode, e.g., auto, smart, interval, favorite. Requires SUPPORT_SET_SPEED. property preset_modes Return a list of available preset modes. Requires SUPPORT_SET_SPEED.

3.10. fan 31 Home Assistant Documentation, Release 2021.10.0.dev0

set_direction(direction: str) → None Set the direction of the fan. set_percentage(percentage: int) → None Set the speed of the fan, as a percentage. set_preset_mode(preset_mode: str) → None Set new preset mode. set_speed(speed: str) → None Set the speed of the fan. property speed Return the current speed. property speed_count Return the number of speeds the fan supports. property speed_list Get the list of available speeds. speed_to_percentage(speed: str) → int Map a speed to a percentage. Officially this should only have to deal with the 4 pre-defined speeds: return { SPEED_OFF: 0, SPEED_LOW: 33, SPEED_MEDIUM: 66, SPEED_HIGH: 100, }[speed] Unfortunately lots of fans make up their own speeds. So the default mapping is more dynamic. property state_attributes Return optional state attributes. property supported_features Flag supported features. turn_on(speed: str | None = None, percentage: int | None = None, preset_mode: str | None = None, **kwargs) → None Turn on the fan. class homeassistant.components.fan.FanEntityDescription(key: str, device_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.ToggleEntityDescription A class that describes fan entities. key = None exception homeassistant.components.fan.NoValidSpeedsError Bases: ValueError Exception class when there are no valid speeds. exception homeassistant.components.fan.NotValidPresetModeError Bases: ValueError

32 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

Exception class when the preset_mode in not in the preset_modes list. exception homeassistant.components.fan.NotValidSpeedError Bases: ValueError Exception class when the speed in not in the speed list. async homeassistant.components.fan.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Expose fan control via statemachine and services. async homeassistant.components.fan.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.fan.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.fan.is_on(hass, entity_id: str) → bool Return if the fans are on based on the statemachine. homeassistant.components.fan.preset_modes_from_speed_list(speed_list: list) Filter out non-preset modes from the speed list. The goal is to return only preset modes. Examples: input: [“off”, “low”, “low-medium”, “medium”, “medium-high”, “high”, “auto”] output: [“auto”] input: [“off”, “auto”, “low”, “medium”, “high”] output: [“auto”] input: [“off”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “smart”] output: [“smart”] input: [“Auto”, “Silent”, “Favorite”, “Idle”, “Medium”, “High”, “Strong”] output: [“Auto”, “Silent”, “Fa- vorite”, “Idle”] homeassistant.components.fan.speed_list_without_preset_modes(speed_list: list) Filter out non-speeds from the speed list. The goal is to get the speeds in a list from lowest to highest by removing speeds that are not valid or out of order so we can map them to percentages. Examples: input: [“off”, “low”, “low-medium”, “medium”, “medium-high”, “high”, “auto”] output: [“low”, “low-medium”, “medium”, “medium-high”, “high”] input: [“off”, “auto”, “low”, “medium”, “high”] output: [“low”, “medium”, “high”] input: [“off”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “smart”] output: [“1”, “2”, “3”, “4”, “5”, “6”, “7”] input: [“Auto”, “Silent”, “Favorite”, “Idle”, “Medium”, “High”, “Strong”] output: [“Medium”, “High”, “Strong”]

3.10. fan 33 Home Assistant Documentation, Release 2021.10.0.dev0

3.11 light

Provides functionality to interact with lights. class homeassistant.components.light.Light Bases: homeassistant.components.light.LightEntity Representation of a light (for backwards compatibility). entity_description = None class homeassistant.components.light.LightEntity Bases: homeassistant.helpers.entity.ToggleEntity Base class for light entities. property brightness Return the brightness of this light between 0..255. property capability_attributes Return capability attributes. property color_mode Return the color mode of the light. property color_temp Return the CT color value in mireds. property effect Return the current effect. property effect_list Return the list of supported effects. entity_description = None property hs_color Return the hue and saturation color value [float, float]. property max_mireds Return the warmest color_temp that this light supports. property min_mireds Return the coldest color_temp that this light supports. property rgb_color Return the rgb color value [int, int, int]. property rgbw_color Return the rgbw color value [int, int, int, int]. property rgbww_color Return the rgbww color value [int, int, int, int, int]. property state_attributes Return state attributes. property supported_color_modes Flag supported color modes. property supported_features Flag supported features.

34 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property white_value Return the white value of this light between 0..255. property xy_color Return the xy color value [float, float]. class homeassistant.components.light.LightEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.ToggleEntityDescription A class that describes binary sensor entities. key = None class homeassistant.components.light.Profile(name: str, color_x: float | None, color_y: float | None, brightness: int | None, transi- tion: int | None = None) Bases: object Representation of a profile. SCHEMA = , Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), , msg=None), Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), , msg=None), Any(All(Coerce(int, msg=None), Range(min=0, max=255, min_included=True, max_included=True, msg=None), msg=None), , msg=None)]), ExactSequence([, Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), , msg=None), Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), , msg=None), Any(All(Coerce(int, msg=None), Range(min=0, max=255, min_included=True, max_included=True, msg=None), msg=None), , msg=None), Any(All(Coerce(float, msg=None), Clamp(min=0, max=6553), msg=None), , msg=None)]), msg=None), extra=PREVENT_EXTRA, required=False) object> brightness = None color_x = None color_y = None classmethod from_csv_row(csv_row: list[str]) → Profile Create profile from a CSV row tuple. hs_color = None name = None transition: int | None = None class homeassistant.components.light.Profiles(hass: homeassis- tant.core.HomeAssistant) Bases: object Representation of available color profiles. apply_default(entity_id: str, state_on: bool, params: dict) → None Return the default profile for the given light. apply_profile(name: str, params: dict) → None Apply a profile. async async_initialize() → None Load and cache profiles. async homeassistant.components.light.async_setup(hass, config) Expose light control via state machine and services.

3.11. light 35 Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.light.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.light.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.light.brightness_supported(color_modes: Iterable[str] | None) → bool Test if brightness is supported. homeassistant.components.light.color_supported(color_modes: Iterable[str] | None) → bool Test if color is supported. homeassistant.components.light.color_temp_supported(color_modes: Iterable[str] | None) → bool Test if color temperature is supported. homeassistant.components.light.filter_turn_off_params(light, params) Filter out params not used in turn off or not supported by the light. homeassistant.components.light.filter_turn_on_params(light, params) Filter out params not supported by the light. homeassistant.components.light.get_supported_color_modes(hass: HomeAssistant, en- tity_id: str) → set | None Get supported color modes for a light entity. First try the statemachine, then entity registry. This is the equivalent of entity helper get_supported_features. homeassistant.components.light.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool Return if the lights are on based on the statemachine. homeassistant.components.light.legacy_supported_features(supported_features: int, supported_color_modes: list[str] | None) → int Calculate supported features with backwards compatibility. homeassistant.components.light.preprocess_turn_on_alternatives(hass, params) Process extra data for turn light on request. Async friendly. homeassistant.components.light.valid_supported_color_modes(color_modes: Iter- able[str]) → set[str] Validate the given color modes.

36 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

3.12 lock

Component to interface with locks that can be controlled remotely. class homeassistant.components.lock.LockDevice Bases: homeassistant.components.lock.LockEntity Representation of a lock (for backwards compatibility). entity_description = None class homeassistant.components.lock.LockEntity Bases: homeassistant.helpers.entity.Entity Base class for lock entities. async async_lock(**kwargs: Any) → None Lock the lock. async async_open(**kwargs: Any) → None Open the door latch. async async_unlock(**kwargs: Any) → None Unlock the lock. property changed_by Last change triggered by. property code_format Regex for code format or None if no code is required. entity_description = None property is_jammed Return true if the lock is jammed (incomplete locking). property is_locked Return true if the lock is locked. property is_locking Return true if the lock is locking. property is_unlocking Return true if the lock is unlocking. lock(**kwargs: Any) → None Lock the lock. open(**kwargs: Any) → None Open the door latch. property state Return the state. property state_attributes Return the state attributes. unlock(**kwargs: Any) → None Unlock the lock.

3.12. lock 37 Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.lock.LockEntityDescription(key: str, device_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes lock entities. key = None async homeassistant.components.lock.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for locks. async homeassistant.components.lock.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.lock.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.13 media_player

Component to interface with various media players. class homeassistant.components.media_player.BrowseMedia(*, media_class: str, me- dia_content_id: str, me- dia_content_type: str, ti- tle: str, can_play: bool, can_expand: bool, chil- dren: list[BrowseMedia] | None = None, chil- dren_media_class: str | None = None, thumbnail: str | None = None) Bases: object Represent a browsable media file. as_dict(*, parent: bool = True) → dict Convert Media class to browse media dictionary. calculate_children_class() → None Count the children media classes and calculate the correct class.

38 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.components.media_player.MediaPlayerDevice Bases: homeassistant.components.media_player.MediaPlayerEntity ABC for media player devices (for backwards compatibility). entity_description = None class homeassistant.components.media_player.MediaPlayerEntity Bases: homeassistant.helpers.entity.Entity ABC for media player entities. property access_token Access token for this media player. property app_id ID of the current running app. property app_name Name of the current running app. async async_browse_media(media_content_type: str | None = None, media_content_id: str | None = None) → BrowseMedia Return a BrowseMedia instance. The BrowseMedia instance will be used by the “media_player/browse_media” websocket command. async async_clear_playlist() Clear players playlist. async async_get_browse_image(media_content_type: str, media_content_id: str, me- dia_image_id: str | None = None) → tuple[str | None, str | None] Optionally fetch internally accessible image for media browser. Must be implemented by integration. async async_get_media_image() Fetch media image of current playing image. async async_join_players(group_members) Join group_members as a player group with the current player. async async_media_next_track() Send next track command. async async_media_pause() Send pause command. async async_media_play() Send play command. async async_media_play_pause() Play or pause the media player. async async_media_previous_track() Send previous track command. async async_media_seek(position) Send seek command. async async_media_stop() Send stop command.

3.13. media_player 39 Home Assistant Documentation, Release 2021.10.0.dev0

async async_mute_volume(mute) Mute the volume. async async_play_media(media_type, media_id, **kwargs) Play a piece of media. async async_select_sound_mode(sound_mode) Select sound mode. async async_select_source(source) Select input source. async async_set_repeat(repeat) Set repeat mode. async async_set_shuffle(shuffle) Enable/disable shuffle mode. async async_set_volume_level(volume) Set volume level, range 0..1. async async_toggle() Toggle the power on the media player. async async_turn_off() Turn the media player off. async async_turn_on() Turn the media player on. async async_unjoin_player() Remove this player from any group. async async_volume_down() Turn volume down for media player. This method is a coroutine. async async_volume_up() Turn volume up for media player. This method is a coroutine. property capability_attributes Return capability attributes. clear_playlist() Clear players playlist. entity_description = None property entity_picture Return image of the media playing. get_browse_image_url(media_content_type: str, media_content_id: str, media_image_id: str | None = None) → str Generate an url for a media browser image. property group_members List of members which are currently grouped together. property is_volume_muted Boolean if volume is currently muted.

40 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

join_players(group_members) Join group_members as a player group with the current player. property media_album_artist Album artist of current playing media, music track only. property media_album_name Album name of current playing media, music track only. property media_artist Artist of current playing media, music track only. property media_channel Channel currently playing. property media_content_id Content ID of current playing media. property media_content_type Content type of current playing media. property media_duration Duration of current playing media in seconds. property media_episode Episode of current playing media, TV show only. property media_image_hash Hash value for media image. property media_image_local Return local url to media image. property media_image_remotely_accessible If the image url is remotely accessible. property media_image_url Image url of current playing media. media_next_track() Send next track command. media_pause() Send pause command. media_play() Send play command. property media_playlist Title of Playlist currently playing. property media_position Position of current playing media in seconds. property media_position_updated_at When was the position of the current playing media valid. Returns value from homeassistant.util.dt.utcnow(). media_previous_track() Send previous track command. property media_season Season of current playing media, TV show only.

3.13. media_player 41 Home Assistant Documentation, Release 2021.10.0.dev0

media_seek(position) Send seek command. property media_series_title Title of series of current playing media, TV show only. media_stop() Send stop command. property media_title Title of current playing media. property media_track Track number of current playing media, music track only. mute_volume(mute) Mute the volume. play_media(media_type, media_id, **kwargs) Play a piece of media. property repeat Return current repeat mode. select_sound_mode(sound_mode) Select sound mode. select_source(source) Select input source. set_repeat(repeat) Set repeat mode. set_shuffle(shuffle) Enable/disable shuffle mode. set_volume_level(volume) Set volume level, range 0..1. property shuffle Boolean if shuffle is enabled. property sound_mode Name of the current sound mode. property sound_mode_list List of available sound modes. property source Name of the current input source. property source_list List of available input sources. property state State of the player. property state_attributes Return the state attributes. property support_clear_playlist Boolean if clear playlist command supported.

42 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property support_grouping Boolean if player grouping is supported. property support_next_track Boolean if next track command supported. property support_pause Boolean if pause is supported. property support_play Boolean if play is supported. property support_play_media Boolean if play media command supported. property support_previous_track Boolean if previous track command supported. property support_seek Boolean if seek is supported. property support_select_sound_mode Boolean if select sound mode command supported. property support_select_source Boolean if select source command supported. property support_shuffle_set Boolean if shuffle is supported. property support_stop Boolean if stop is supported. property support_volume_mute Boolean if muting volume is supported. property support_volume_set Boolean if setting volume is supported. property supported_features Flag media player features that are supported. turn_off() Turn the media player off. turn_on() Turn the media player on. unjoin_player() Remove this player from any group. property volume_level Volume level of the media player (0..1).

3.13. media_player 43 Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.media_player.MediaPlayerEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes media player entities. key = None class homeassistant.components.media_player.MediaPlayerImageView(component) Bases: homeassistant.components.http.view.HomeAssistantView Media player view to serve an image. extra_urls: list[str] = ['/api/media_player_proxy/{entity_id}/browse_media/{media_content_type}/{media_content_id}'] async get(request: web.Request, entity_id: str, media_content_type: str | None = None, me- dia_content_id: str | None = None) → web.Response Start a get request. name = 'api:media_player:image' requires_auth = False url: str | None = '/api/media_player_proxy/{entity_id}'

44 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.media_player.async_setup(hass, config) Track states and offer events for media_players. async homeassistant.components.media_player.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.media_player.async_unload_entry(hass: home- assis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.media_player.is_on(hass, entity_id=None) Return true if specified media player entity_id is on. Check all media player if no entity_id specified. homeassistant.components.media_player.websocket_browse_media(hass, connection, msg) Browse media available to the media_player entity. To use, media_player integrations can implement MediaPlayerEntity.async_browse_media() homeassistant.components.media_player.websocket_handle_thumbnail(hass, connec- tion, msg) Handle get media player cover command. Async friendly.

3.14 notify

Provides functionality to notify people. class homeassistant.components.notify.BaseNotificationService Bases: object An abstract class for notification services. async async_register_services() → None Create or update the notify services. async async_send_message(message: Any, **kwargs: Any) → None Send a message. kwargs can contain ATTR_TITLE to specify a title. async async_setup(hass: homeassistant.core.HomeAssistant, service_name: str, tar- get_service_name_prefix: str) → None Store the data for the notify service. async async_unregister_services() → None Unregister the notify services. hass: HomeAssistant = None

3.14. notify 45 Home Assistant Documentation, Release 2021.10.0.dev0

registered_targets: dict[str, str] = None send_message(message, **kwargs) Send a message. kwargs can contain ATTR_TITLE to specify a title. async homeassistant.components.notify.async_reload(hass: homeassis- tant.core.HomeAssistant, inte- gration_name: str) → None Register notify services for an integration. async homeassistant.components.notify.async_reset_platform(hass: homeassis- tant.core.HomeAssistant, integration_name: str) → None Unregister notify services for an integration. async homeassistant.components.notify.async_setup(hass, config) Set up the notify services.

3.15 remote

Support to interface with universal remote control devices. class homeassistant.components.remote.RemoteDevice Bases: homeassistant.components.remote.RemoteEntity Representation of a remote (for backwards compatibility). entity_description = None class homeassistant.components.remote.RemoteEntity Bases: homeassistant.helpers.entity.ToggleEntity Base class for remote entities. property activity_list List of available activities. async async_delete_command(**kwargs: Any) → None Delete commands from the database. async async_learn_command(**kwargs: Any) → None Learn a command from a device. async async_send_command(command: Iterable[str], **kwargs: Any) → None Send commands to a device. property current_activity Active activity. delete_command(**kwargs: Any) → None Delete commands from the database. entity_description = None learn_command(**kwargs: Any) → None Learn a command from a device. send_command(command: Iterable[str], **kwargs: Any) → None Send commands to a device.

46 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property state_attributes Return optional state attributes. property supported_features Flag supported features. class homeassistant.components.remote.RemoteEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.ToggleEntityDescription A class that describes remote entities. key = None async homeassistant.components.remote.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for remotes. async homeassistant.components.remote.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.remote.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.remote.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool Return if the remote is on based on the statemachine.

3.16 switch

Component to interface with switches that can be controlled remotely. class homeassistant.components.switch.SwitchDevice Bases: homeassistant.components.switch.SwitchEntity Representation of a switch (for backwards compatibility). entity_description = None

3.16. switch 47 Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.components.switch.SwitchEntity Bases: homeassistant.helpers.entity.ToggleEntity Base class for switch entities. property current_power_w Return the current power usage in W. entity_description = None property state_attributes Return the optional state attributes. property today_energy_kwh Return the today total energy usage in kWh. class homeassistant.components.switch.SwitchEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.ToggleEntityDescription A class that describes switch entities. key = None async homeassistant.components.switch.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for switches. async homeassistant.components.switch.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.switch.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry. homeassistant.components.switch.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool Return if the switch is on based on the statemachine. Async friendly.

48 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

3.17 sensor

Component to interface with various sensors that can be monitored. class homeassistant.components.sensor.SensorEntity Bases: homeassistant.helpers.entity.Entity Base class for sensor entities. property capability_attributes Return the capability attributes. entity_description = None property last_reset Return the time when the sensor was last reset, if any. property native_unit_of_measurement Return the unit of measurement of the sensor, if any. property native_value Return the value reported by the sensor. property state Return the state of the sensor and perform unit conversions, if needed. property state_attributes Return state attributes. property state_class Return the state class of this entity, from STATE_CLASSES, if any. property unit_of_measurement Return the unit of measurement of the entity, after unit conversion. class homeassistant.components.sensor.SensorEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: None = None, last_reset: date- time | None = None, na- tive_unit_of_measurement: str | None = None, state_class: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes sensor entities. last_reset: datetime | None = None native_unit_of_measurement: str | None = None

3.17. sensor 49 Home Assistant Documentation, Release 2021.10.0.dev0

state_class: str | None = None unit_of_measurement: None = None async homeassistant.components.sensor.async_setup(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → bool Track states and offer events for sensors. async homeassistant.components.sensor.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.sensor.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.18 vacuum

Support for vacuum cleaner robots (botvacs). class homeassistant.components.vacuum.StateVacuumDevice Bases: homeassistant.components.vacuum.StateVacuumEntity Representation of a vacuum (for backwards compatibility). entity_description = None class homeassistant.components.vacuum.StateVacuumEntity Bases: homeassistant.components.vacuum._BaseVacuum Representation of a vacuum cleaner robot that supports states. async async_pause() Pause the cleaning task. This method must be run in the event loop. async async_start() Start or resume the cleaning task. This method must be run in the event loop. async async_toggle(**kwargs) Not supported. async async_turn_off(**kwargs) Not supported. async async_turn_on(**kwargs) Not supported. property battery_icon Return the battery icon for the vacuum cleaner. entity_description: StateVacuumEntityDescription = None

50 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

pause() Pause the cleaning task. start() Start or resume the cleaning task. property state Return the state of the vacuum cleaner. class homeassistant.components.vacuum.StateVacuumEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes vacuum entities. key = None class homeassistant.components.vacuum.VacuumDevice Bases: homeassistant.components.vacuum.VacuumEntity Representation of a vacuum (for backwards compatibility). entity_description = None class homeassistant.components.vacuum.VacuumEntity Bases: homeassistant.components.vacuum._BaseVacuum, homeassistant.helpers. entity.ToggleEntity Representation of a vacuum cleaner robot. async async_pause() Not supported. async async_start() Not supported. async async_start_pause(**kwargs) Start, pause or resume the cleaning task. This method must be run in the event loop. async async_turn_off(**kwargs) Turn the vacuum off stopping the cleaning and returning home.

3.18. vacuum 51 Home Assistant Documentation, Release 2021.10.0.dev0

This method must be run in the event loop. async async_turn_on(**kwargs) Turn the vacuum on and start cleaning. This method must be run in the event loop. property battery_icon Return the battery icon for the vacuum cleaner. entity_description: VacuumEntityDescription = None start_pause(**kwargs) Start, pause or resume the cleaning task. property state_attributes Return the state attributes of the vacuum cleaner. property status Return the status of the vacuum cleaner. turn_off(**kwargs) Turn the vacuum off stopping the cleaning and returning home. turn_on(**kwargs) Turn the vacuum on and start cleaning. class homeassistant.components.vacuum.VacuumEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.ToggleEntityDescription A class that describes vacuum entities. key = None async homeassistant.components.vacuum.async_setup(hass, config) Set up the vacuum component. async homeassistant.components.vacuum.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.vacuum.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

52 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.components.vacuum.is_on(hass, entity_id) Return if the vacuum is on based on the statemachine.

3.19 water_heater

Support for water heater devices. class homeassistant.components.water_heater.WaterHeaterDevice Bases: homeassistant.components.water_heater.WaterHeaterEntity Representation of a water heater (for backwards compatibility). entity_description = None class homeassistant.components.water_heater.WaterHeaterEntity Bases: homeassistant.helpers.entity.Entity Base class for water heater entities. async async_set_operation_mode(operation_mode) Set new target operation mode. async async_set_temperature(**kwargs) Set new target temperature. async async_turn_away_mode_off() Turn away mode off. async async_turn_away_mode_on() Turn away mode on. property capability_attributes Return capability attributes. property current_operation Return current operation ie. eco, electric, performance, . . . property current_temperature Return the current temperature. entity_description = None property is_away_mode_on Return true if away mode is on. property max_temp Return the maximum temperature. property min_temp Return the minimum temperature. property operation_list Return the list of available operation modes. property precision Return the precision of the system. set_operation_mode(operation_mode) Set new target operation mode. set_temperature(**kwargs) Set new target temperature.

3.19. water_heater 53 Home Assistant Documentation, Release 2021.10.0.dev0

property state Return the current state. property state_attributes Return the optional state attributes. property target_temperature Return the temperature we try to reach. property target_temperature_high Return the highbound target temperature we try to reach. property target_temperature_low Return the lowbound target temperature we try to reach. property temperature_unit Return the unit of measurement used by the platform. turn_away_mode_off() Turn away mode off. turn_away_mode_on() Turn away mode on.

54 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.components.water_heater.WaterHeaterEntityEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes water heater entities. key = None async homeassistant.components.water_heater.async_service_away_mode(entity, service) Handle away mode service. async homeassistant.components.water_heater.async_service_temperature_set(entity, ser- vice) Handle set temperature service. async homeassistant.components.water_heater.async_setup(hass, config) Set up water_heater devices.

3.19. water_heater 55 Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.components.water_heater.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry. async homeassistant.components.water_heater.async_unload_entry(hass: home- assis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.20 weather

Weather component that handles meteorological data for your location. class homeassistant.components.weather.Forecast Bases: dict Typed weather forecast dict. condition = None datetime = None precipitation = None precipitation_probability = None pressure = None temperature = None templow = None wind_bearing = None wind_speed = None class homeassistant.components.weather.WeatherEntity Bases: homeassistant.helpers.entity.Entity ABC for weather data. property attribution Return the attribution. property condition Return the current condition. entity_description = None property forecast Return the forecast. property humidity Return the humidity.

56 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0

property ozone Return the ozone level. property precision Return the precision of the temperature value. property pressure Return the pressure. property state Return the current state. property state_attributes Return the state attributes. property temperature Return the platform temperature. property temperature_unit Return the unit of measurement. property visibility Return the visibility. property wind_bearing Return the wind bearing. property wind_speed Return the wind speed. class homeassistant.components.weather.WeatherEntityDescription(key: str, de- vice_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes weather entities. key = None async homeassistant.components.weather.async_setup(hass, config) Set up the weather component. async homeassistant.components.weather.async_setup_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Set up a config entry.

3.20. weather 57 Home Assistant Documentation, Release 2021.10.0.dev0 async homeassistant.components.weather.async_unload_entry(hass: homeassis- tant.core.HomeAssistant, entry: homeassis- tant.config_entries.ConfigEntry) → bool Unload a config entry.

3.21 webhook

Webhooks for Home Assistant. class homeassistant.components.webhook.WebhookView Bases: homeassistant.components.http.view.HomeAssistantView Handle incoming webhook requests. cors_allowed = True async head(request: aiohttp.web_request.Request, webhook_id) Handle webhook call. name = 'api:webhook' async post(request: aiohttp.web_request.Request, webhook_id) Handle webhook call. async put(request: aiohttp.web_request.Request, webhook_id) Handle webhook call. requires_auth = False url: str | None = '/api/webhook/{webhook_id}' homeassistant.components.webhook.async_generate_id() → str Generate a webhook_id. homeassistant.components.webhook.async_generate_path(webhook_id: str) → str Generate the path component for a webhook_id. homeassistant.components.webhook.async_generate_url(hass: homeassis- tant.core.HomeAssistant, web- hook_id: str) → str Generate the full URL for a webhook_id. async homeassistant.components.webhook.async_handle_webhook(hass, webhook_id, request) Handle a webhook. homeassistant.components.webhook.async_register(hass: HomeAssistant, domain: str, name: str, webhook_id: str, handler: Callable[[HomeAssistant, str, Re- quest], Awaitable[Response | None]]) → None Register a webhook. async homeassistant.components.webhook.async_setup(hass, config) Initialize the webhook component. homeassistant.components.webhook.async_unregister(hass: homeassis- tant.core.HomeAssistant, web- hook_id: str) → None Remove a webhook.

58 Chapter 3. homeassistant.components Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.components.webhook.websocket_list(hass, connection, msg) Return a list of webhooks.

3.21. webhook 59 Home Assistant Documentation, Release 2021.10.0.dev0

60 Chapter 3. homeassistant.components CHAPTER FOUR

HOMEASSISTANT.CONFIG_ENTRIES

Manage config entries in Home Assistant. class homeassistant.config_entries.ConfigEntries(hass: homeassis- tant.core.HomeAssistant, hass_config: Dict[str, Any]) Manage the configuration entries. An instance of this object is available via hass.config_entries. async async_add(entry: homeassistant.config_entries.ConfigEntry) → None Add and setup an entry. async_domains(include_ignore: bool = False, include_disabled: bool = False) → list[str] Return domains for which we have entries. async_entries(domain: str | None = None) → list[ConfigEntry] Return all entries or entries for a specific domain. async async_forward_entry_setup(entry: homeassistant.config_entries.ConfigEntry, do- main: str) → bool Forward the setup of an entry to a different component. By default an entry is setup with the component it belongs to. If that component also has related platforms, the component will have to forward the entry to be setup by that component. You don’t want to await this coroutine if it is called as part of the setup of a component, because it can cause a deadlock. async async_forward_entry_unload(entry: homeassistant.config_entries.ConfigEntry, do- main: str) → bool Forward the unloading of an entry to a different component. async_get_entry(entry_id: str) → ConfigEntry | None Return entry with matching entry_id. async async_initialize() → None Initialize config entry config. async async_reload(entry_id: str) → bool Reload an entry. If an entry was not loaded, will just load. async async_remove(entry_id: str) → dict[str, Any] Remove an entry. async async_set_disabled_by(entry_id: str, disabled_by: str | None) → bool Disable an entry. If disabled_by is changed, the config entry will be reloaded.

61 Home Assistant Documentation, Release 2021.10.0.dev0

async async_setup(entry_id: str) → bool Set up a config entry. Return True if entry has been successfully loaded. async_setup_platforms(entry: ConfigEntry, platforms: Iterable[str]) → None Forward the setup of an entry to platforms. async async_unload(entry_id: str) → bool Unload a config entry. async async_unload_platforms(entry: ConfigEntry, platforms: Iterable[str]) → bool Forward the unloading of an entry to platforms. async_update_entry(entry: ConfigEntry, *, unique_id: str | None | UndefinedType = , title: str | UndefinedType = , data: dict | UndefinedType = , op- tions: Mapping[str, Any] | UndefinedType = , pref_disable_new_entities: bool | UndefinedType = , pref_disable_polling: bool | UndefinedType = ) → bool Update a config entry. If the entry was changed, the update_listeners are fired and this function returns True If the entry was not changed, the update_listeners are not fired and this function returns False class homeassistant.config_entries.ConfigEntriesFlowManager(hass: homeassis- tant.core.HomeAssistant, config_entries: homeassis- tant.config_entries.ConfigEntries, hass_config: Dict[str, Any]) Manage all the config entry flows that are in progress. async async_create_flow(handler_key: Any, *, context: dict | None = None, data: Any = None) → ConfigFlow Create a flow for specified handler. Handler key is the domain of the component that we want to set up. async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, result: homeassistant.data_entry_flow.FlowResult) → homeassis- tant.data_entry_flow.FlowResult Finish a config flow and add an entry. async async_post_init(flow: homeassistant.data_entry_flow.FlowHandler, result: homeassis- tant.data_entry_flow.FlowResult) → None After a flow is initialised trigger new flow notifications. class homeassistant.config_entries.ConfigEntry(version: int, domain: str, title: str, data: Mapping[str, Any], source: str, pref_disable_new_entities: bool | None = None, pref_disable_polling: bool | None = None, options: Mapping[str, Any] | None = None, unique_id: str | None = None, entry_id: str | None = None, state: ConfigEntryState = , disabled_by: str | None = None)

62 Chapter 4. homeassistant.config_entries Home Assistant Documentation, Release 2021.10.0.dev0

Hold a configuration entry. add_update_listener(listener: Callable[[homeassistant.core.HomeAssistant, ConfigEntry], Any]) → Callable[[], None] Listen for when entry is updated. Returns function to unlisten. as_dict() → dict[str, Any] Return dictionary version of this entry. async_cancel_retry_setup() → None Cancel retry setup. async async_migrate(hass: homeassistant.core.HomeAssistant) → bool Migrate an entry. Returns True if config entry is up-to-date or has been migrated. async_on_unload(func: Callable[[], None]) → None Add a function to call when config entry is unloaded. async async_remove(hass: homeassistant.core.HomeAssistant) → None remove callback on component. async async_setup(hass: HomeAssistant, *, integration: loader.Integration | None = None, tries: int = 0) → None Set up an entry. async async_shutdown() → None Call when Home Assistant is stopping. async_start_reauth(hass: homeassistant.core.HomeAssistant) → None Start a reauth flow. async async_unload(hass: HomeAssistant, *, integration: loader.Integration | None = None) → bool Unload an entry. Returns if unload is possible and was successful. class homeassistant.config_entries.ConfigEntryState Config entry state. property recoverable Get if the state is recoverable. exception homeassistant.config_entries.ConfigError Error while configuring an account. class homeassistant.config_entries.ConfigFlow Base class for config flows with some helpers. async_abort(*, reason: str, description_placeholders: dict | None = None) → data_entry_flow.FlowResult Abort the config flow. async_create_entry(*, title: str, data: Mapping[str, Any], description: str | None = None, descrip- tion_placeholders: dict | None = None, options: Mapping[str, Any] | None = None) → data_entry_flow.FlowResult Finish config flow and create a config entry. static async_get_options_flow(config_entry: homeassistant.config_entries.ConfigEntry) → homeassistant.config_entries.OptionsFlow Get the options flow for this handler.

63 Home Assistant Documentation, Release 2021.10.0.dev0

async async_set_unique_id(unique_id: str | None = None, *, raise_on_progress: bool = True) → ConfigEntry | None Set a unique ID for the config flow. Returns optionally existing config entry with same ID. async async_step_dhcp(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by DHCP discovery. async async_step_discovery(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_hassio(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by HASS IO discovery. async async_step_homekit(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by Homekit discovery. async async_step_ignore(user_input: dict[str, Any]) → data_entry_flow.FlowResult Ignore this config flow. async async_step_mqtt(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by MQTT discovery. async async_step_ssdp(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by SSDP discovery. async async_step_unignore(user_input: dict[str, Any]) → data_entry_flow.FlowResult Rediscover a config entry by it’s unique_id. async async_step_usb(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by USB discovery. async async_step_user(user_input: dict[str, Any] | None = None) → data_entry_flow.FlowResult Handle a flow initiated by the user. async async_step_zeroconf(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by Zeroconf discovery. property unique_id Return unique ID if available. class homeassistant.config_entries.EntityRegistryDisabledHandler(hass: homeassis- tant.core.HomeAssistant) Handler to handle when entities related to config entries updating disabled_by. async_setup() → None Set up the disable handler. exception homeassistant.config_entries.OperationNotAllowed Raised when a config entry operation is not allowed. class homeassistant.config_entries.OptionsFlow Base class for config option flows.

64 Chapter 4. homeassistant.config_entries Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.config_entries.OptionsFlowManager(hass: homeassis- tant.core.HomeAssistant) Flow to set options for a configuration entry. async async_create_flow(handler_key: Any, *, context: dict[str, Any] | None = None, data: dict[str, Any] | None = None) → OptionsFlow Create an options flow for a config entry. Entry_id and flow.handler is the same thing to map entry with flow. async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, result: homeassistant.data_entry_flow.FlowResult) → homeassis- tant.data_entry_flow.FlowResult Finish an options flow and update options for configuration entry. Flow.handler and entry_id is the same thing to map flow with entry. exception homeassistant.config_entries.UnknownEntry Unknown entry specified. async homeassistant.config_entries.support_entry_unload(hass: homeassis- tant.core.HomeAssistant, domain: str) → bool Test if a domain supports entry unloading.

65 Home Assistant Documentation, Release 2021.10.0.dev0

66 Chapter 4. homeassistant.config_entries CHAPTER FIVE

HOMEASSISTANT.CORE

Core components of Home Assistant. Home Assistant is a framework for observing the state of entities and react to changes. class homeassistant.core.Config(hass: homeassistant.core.HomeAssistant) Configuration settings for Home Assistant. as_dict() → dict Create a dictionary representation of the configuration. Async friendly. async async_load() → None Load [homeassistant] core config. async async_store() → None Store [homeassistant] core config. async async_update(**kwargs: Any) → None Update the configuration from a dictionary. distance(lat: float, lon: float) → float | None Calculate distance from Home Assistant. Async friendly. is_allowed_external_url(url: str) → bool Check if an external URL is allowed. is_allowed_path(path: str) → bool Check if the path is valid for access from outside. path(*path: str) → str Generate path to the file within the configuration directory. Async friendly. set_time_zone(time_zone_str: str) → None Help to set the time zone. class homeassistant.core.Context(user_id: str = None, parent_id: str | None = None, id: str = NOTHING) The context that triggered something. as_dict() → dict[str, str | None] Return a dictionary representation of the context. class homeassistant.core.CoreState Represent the current state of Home Assistant.

67 Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.core.Event(event_type: str, data: dict[str, Any] | None = None, origin: EventOrigin = , time_fired: date- time.datetime | None = None, context: Context | None = None) Representation of an event within the bus. as_dict() → dict[str, Any] Create a dict representation of this Event. Async friendly. class homeassistant.core.EventBus(hass: homeassistant.core.HomeAssistant) Allow the firing of and listening for events. async_fire(event_type: str, event_data: dict[str, Any] | None = None, origin: EventOrigin = , context: Context | None = None, time_fired: datetime.datetime | None = None) → None Fire an event. This method must be run in the event loop. async_listen(event_type: str, listener: Callable, event_filter: Callable | None = None) → CALL- BACK_TYPE Listen for all events or events of a specific type. To listen to all events specify the constant MATCH_ALL as event_type. An optional event_filter, which must be a callable decorated with @callback that returns a boolean value, determines if the listener callable should run. This method must be run in the event loop. async_listen_once(event_type: str, listener: Callable) → Callable[[], None] Listen once for event of a specific type. To listen to all events specify the constant MATCH_ALL as event_type. Returns registered listener that can be used with remove_listener. This method must be run in the event loop. async_listeners() → dict[str, int] Return dictionary with events and the number of listeners. This method must be run in the event loop. fire(event_type: str, event_data: dict | None = None, origin: EventOrigin = , context: Context | None = None) → None Fire an event. listen(event_type: str, listener: Callable) → Callable[[], None] Listen for all events or events of a specific type. To listen to all events specify the constant MATCH_ALL as event_type. listen_once(event_type: str, listener: Callable[[homeassistant.core.Event], None]) → Callable[[], None] Listen once for event of a specific type. To listen to all events specify the constant MATCH_ALL as event_type. Returns function to unsubscribe the listener. property listeners Return dictionary with events and the number of listeners. class homeassistant.core.EventOrigin Represent the origin of an event.

68 Chapter 5. homeassistant.core Home Assistant Documentation, Release 2021.10.0.dev0

class homeassistant.core.HassJob(target: Callable) Represent a job to be run later. We check the callable type in advance so we can avoid checking it every time we run the job. class homeassistant.core.HassJobType Represent a job type. class homeassistant.core.HomeAssistant Root object of the Home Assistant home automation. add_job(target: Callable[[...], Any], *args: Any) → None Add job to the executor pool. target: target to call. args: parameters for method to call. async_add_executor_job(target: Callable[..., T], *args: Any) → Awaitable[T] Add an executor job from within the event loop. async_add_hass_job(hassjob: HassJob, *args: Any) → asyncio.Future | None Add a HassJob from within the event loop. This method must be run in the event loop. hassjob: HassJob to call. args: parameters for method to call. async_add_job(target: Callable[..., Any], *args: Any) → asyncio.Future | None Add a job from within the event loop. This method must be run in the event loop. target: target to call. args: parameters for method to call. async async_block_till_done() → None Block until all pending work is done. async_create_task(target: collections.abc.Awaitable) → _asyncio.Task Create a task from within the eventloop. This method must be run in the event loop. target: target to call. async async_run(*, attach_signals: bool = True) → int Home Assistant main entry point. Start Home Assistant and block until stopped. This method is a coroutine. async_run_hass_job(hassjob: HassJob, *args: Any) → asyncio.Future | None Run a HassJob from within the event loop. This method must be run in the event loop. hassjob: HassJob args: parameters for method to call. async_run_job(target: Callable[..., None | Awaitable], *args: Any) → asyncio.Future | None Run a job from within the event loop. This method must be run in the event loop. target: target to call. args: parameters for method to call. async async_start() → None Finalize startup from inside the event loop. This method is a coroutine.

69 Home Assistant Documentation, Release 2021.10.0.dev0

async async_stop(exit_code: int = 0, *, force: bool = False) → None Stop Home Assistant and shuts down all threads. The “force” flag commands async_stop to proceed regardless of Home Assistant’s current state. You should not set this flag unless you’re testing. This method is a coroutine. async_stop_track_tasks() → None Stop track tasks so you can’t wait for all tasks to be done. async_track_tasks() → None Track tasks so you can wait for all tasks to be done. block_till_done() → None Block until all pending work is done. create_task(target: collections.abc.Awaitable) → None Add task to the executor pool. target: target to call. property is_running Return if Home Assistant is running. property is_stopping Return if Home Assistant is stopping. start() → int Start Home Assistant. Note: This function is only used for testing. For regular use, use “await hass.run()”. stop() → None Stop Home Assistant and shuts down all threads. class homeassistant.core.Service(func: Callable, schema: vol.Schema | None, context: Context | None = None) Representation of a callable service. class homeassistant.core.ServiceCall(domain: str, service: str, data: dict | None = None, context: Context | None = None) Representation of a call to a service. class homeassistant.core.ServiceRegistry(hass: homeassistant.core.HomeAssistant) Offer the services over the eventbus. async async_call(domain: str, service: str, service_data: dict | None = None, blocking: bool = False, context: Context | None = None, limit: float | None = 10, target: dict | None = None) → bool | None Call a service. Specify blocking=True to wait until service is executed. Waits a maximum of limit, which may be None for no timeout. If blocking = True, will return boolean if service executed successfully within limit. This method will fire an event to indicate the service has been called. Because the service is sent as an event you are not allowed to use the keys ATTR_DOMAIN and ATTR_SERVICE in your service_data. This method is a coroutine.

70 Chapter 5. homeassistant.core Home Assistant Documentation, Release 2021.10.0.dev0

async_register(domain: str, service: str, service_func: Callable, schema: vol.Schema | None = None) → None Register a service. Schema is called to coerce and validate the service data. This method must be run in the event loop. async_remove(domain: str, service: str) → None Remove a registered service from service handler. This method must be run in the event loop. async_services() → dict[str, dict[str, Service]] Return dictionary with per domain a list of available services. This method must be run in the event loop. call(domain: str, service: str, service_data: dict | None = None, blocking: bool = False, context: Context | None = None, limit: float | None = 10, target: dict | None = None) → bool | None Call a service. See description of async_call for details. has_service(domain: str, service: str) → bool Test if specified service exists. Async friendly. register(domain: str, service: str, service_func: Callable, schema: vol.Schema | None = None) → None Register a service. Schema is called to coerce and validate the service data. remove(domain: str, service: str) → None Remove a registered service from service handler. property services Return dictionary with per domain a list of available services. class homeassistant.core.State(entity_id: str, state: str, attributes: Mapping[str, Any] | None = None, last_changed: datetime.datetime | None = None, last_updated: datetime.datetime | None = None, context: Con- text | None = None, validate_entity_id: bool | None = True) Object to represent a state within the state machine. entity_id: the entity that is represented. state: the state of the entity attributes: extra information on entity and state last_changed: last time the state was changed, not the attributes. last_updated: last time this object was updated. context: Context in which it was created domain: Domain of this state. object_id: Object id of this state. as_dict() → dict Return a dict representation of the State. Async friendly. To be used for JSON serialization. Ensures: state == State.from_dict(state.as_dict()) classmethod from_dict(json_dict: dict) → Any Initialize a state from a dict. Async friendly. Ensures: state == State.from_json_dict(state.to_json_dict())

71 Home Assistant Documentation, Release 2021.10.0.dev0

property name Name of this state. class homeassistant.core.StateMachine(bus: homeassistant.core.EventBus, loop: asyn- cio.events.AbstractEventLoop) Helper class that tracks the state of different entities. all(domain_filter: str | Iterable | None = None) → list[State] Create a list of all states. async_all(domain_filter: str | Iterable | None = None) → list[State] Create a list of all states matching the filter. This method must be run in the event loop. async_available(entity_id: str) → bool Check to see if an entity_id is available to be used. async_entity_ids(domain_filter: str | Iterable | None = None) → list[str] List of entity ids that are being tracked. This method must be run in the event loop. async_entity_ids_count(domain_filter: str | Iterable | None = None) → int Count the entity ids that are being tracked. This method must be run in the event loop. async_remove(entity_id: str, context: Context | None = None) → bool Remove the state of an entity. Returns boolean to indicate if an entity was removed. This method must be run in the event loop. async_reserve(entity_id: str) → None Reserve a state in the state machine for an entity being added. This must not fire an event when the state is reserved. This avoids a race condition where multiple entities with the same entity_id are added. async_set(entity_id: str, new_state: str, attributes: Mapping[str, Any] | None = None, force_update: bool = False, context: Context | None = None) → None Set the state of an entity, add entity if it does not exist. Attributes is an optional dict to specify attributes of this state. If you just update the attributes and not the state, last changed will not be affected. This method must be run in the event loop. entity_ids(domain_filter: str | None = None) → list[str] List of entity ids that are being tracked. get(entity_id: str) → State | None Retrieve state of entity_id or None if not found. Async friendly. is_state(entity_id: str, state: str) → bool Test if entity exists and is in specified state. Async friendly.

72 Chapter 5. homeassistant.core Home Assistant Documentation, Release 2021.10.0.dev0

remove(entity_id: str) → bool Remove the state of an entity. Returns boolean to indicate if an entity was removed. set(entity_id: str, new_state: str, attributes: Mapping[str, Any] | None = None, force_update: bool = False, context: Context | None = None) → None Set the state of an entity, add entity if it does not exist. Attributes is an optional dict to specify attributes of this state. If you just update the attributes and not the state, last changed will not be affected. homeassistant.core.callback(func: CALLABLE_T) → CALLABLE_T Annotation to mark method as safe to call from within the event loop. homeassistant.core.is_callback(func: Callable[[...], Any]) → bool Check if function is safe to be called in the event loop. homeassistant.core.split_entity_id(entity_id: str) → list[str] Split a state entity ID into domain and object ID. homeassistant.core.valid_entity_id(entity_id: str) → bool Test if an entity ID is a valid format. Format: . where both are slugs. homeassistant.core.valid_state(state: str) → bool Test if a state is valid.

73 Home Assistant Documentation, Release 2021.10.0.dev0

74 Chapter 5. homeassistant.core CHAPTER SIX

HOMEASSISTANT.DATA_ENTRY_FLOW

Classes to help gather user submissions. exception homeassistant.data_entry_flow.AbortFlow(reason: str, descrip- tion_placeholders: dict | None = None) Exception to indicate a flow needs to be aborted. exception homeassistant.data_entry_flow.FlowError Error while configuring an account. class homeassistant.data_entry_flow.FlowHandler Handle the configuration flow of a component. async_abort(*, reason: str, description_placeholders: dict | None = None) → FlowResult Abort the config flow. async_create_entry(*, title: str, data: Mapping[str, Any], description: str | None = None, descrip- tion_placeholders: dict | None = None) → FlowResult Finish config flow and create a config entry. async_external_step(*, step_id: str, url: str, description_placeholders: dict | None = None) → FlowResult Return the definition of an external step for the user to take. async_external_step_done(*, next_step_id: str) → homeassistant.data_entry_flow.FlowResult Return the definition of an external step for the user to take. async_show_form(*, step_id: str, data_schema: vol.Schema = None, errors: dict[str, str] | None = None, description_placeholders: dict[str, Any] | None = None, last_step: bool | None = None) → FlowResult Return the definition of a form to gather user input. async_show_progress(*, step_id: str, progress_action: str, description_placeholders: dict | None = None) → FlowResult Show a progress message to the user, without user input allowed. async_show_progress_done(*, next_step_id: str) → homeassistant.data_entry_flow.FlowResult Mark the progress done. property show_advanced_options If we should show advanced options. property source Source that initialized the flow. class homeassistant.data_entry_flow.FlowManager(hass: homeassis- tant.core.HomeAssistant) Manage all the flows that are in progress.

75 Home Assistant Documentation, Release 2021.10.0.dev0

async_abort(flow_id: str) → None Abort a flow. async async_configure(flow_id: str, user_input: dict | None = None) → FlowResult Continue a configuration flow. abstract async async_create_flow(handler_key: Any, *, context: dict[str, Any] | None = None, data: dict[str, Any] | None = None) → FlowHan- dler Create a flow for specified handler. Handler key is the domain of the component that we want to set up. abstract async async_finish_flow(flow: homeassistant.data_entry_flow.FlowHandler, re- sult: homeassistant.data_entry_flow.FlowResult) → homeassistant.data_entry_flow.FlowResult Finish a config flow and add an entry. async async_init(handler: str, *, context: dict[str, Any] | None = None, data: Any = None) → FlowResult Start a configuration flow. async async_post_init(flow: homeassistant.data_entry_flow.FlowHandler, result: homeassis- tant.data_entry_flow.FlowResult) → None Entry has finished executing its first step asynchronously. async_progress(include_uninitialized: bool = False) → list[FlowResult] Return the flows in progress. async async_shutdown() → None Cancel any initializing flows. async async_wait_init_flow_finish(handler: str) → None Wait till all flows in progress are initialized. class homeassistant.data_entry_flow.FlowResult Typed result dict. exception homeassistant.data_entry_flow.UnknownFlow Unknown flow specified. exception homeassistant.data_entry_flow.UnknownHandler Unknown handler specified. exception homeassistant.data_entry_flow.UnknownStep Unknown step specified.

76 Chapter 6. homeassistant.data_entry_flow CHAPTER SEVEN

HOMEASSISTANT.EXCEPTIONS

The exceptions used by Home Assistant. exception homeassistant.exceptions.ConditionError(type: str) Error during condition evaluation. output(indent: int) → Generator[str, None, None] Yield an indented representation. exception homeassistant.exceptions.ConditionErrorContainer(type: str, errors: Se- quence[ConditionError]) Condition error with subconditions. output(indent: int) → Generator[str, None, None] Yield an indented representation. exception homeassistant.exceptions.ConditionErrorIndex(type: str, index: int, total: int, error: homeassis- tant.exceptions.ConditionError) Condition error with index. output(indent: int) → Generator[str, None, None] Yield an indented representation. exception homeassistant.exceptions.ConditionErrorMessage(type: str, message: str) Condition error message. output(indent: int) → Generator[str, None, None] Yield an indented representation. exception homeassistant.exceptions.ConfigEntryAuthFailed Error to indicate that config entry could not authenticate. exception homeassistant.exceptions.ConfigEntryNotReady Error to indicate that config entry is not ready. exception homeassistant.exceptions.HomeAssistantError General Home Assistant exception occurred. exception homeassistant.exceptions.IntegrationError Base class for platform and config entry exceptions. exception homeassistant.exceptions.InvalidEntityFormatError When an invalid formatted entity is encountered. exception homeassistant.exceptions.InvalidStateError When an invalid state is encountered.

77 Home Assistant Documentation, Release 2021.10.0.dev0 exception homeassistant.exceptions.MaxLengthExceeded(value: str, property_name: str, max_length: int) Raised when a property value has exceeded the max character length. exception homeassistant.exceptions.NoEntitySpecifiedError When no entity is specified. exception homeassistant.exceptions.PlatformNotReady Error to indicate that platform is not ready. exception homeassistant.exceptions.RequiredParameterMissing(parameter_names: list[str]) Raised when a required parameter is missing from a function call. exception homeassistant.exceptions.ServiceNotFound(domain: str, service: str) Raised when a service is not found. exception homeassistant.exceptions.TemplateError(exception: Exception) Error during template rendering. exception homeassistant.exceptions.Unauthorized(context: Context | None = None, user_id: str | None = None, entity_id: str | None = None, config_entry_id: str | None = None, perm_category: str | None = None, permission: str | None = None) When an action is unauthorized. exception homeassistant.exceptions.UnknownUser(context: Context | None = None, user_id: str | None = None, entity_id: str | None = None, config_entry_id: str | None = None, perm_category: str | None = None, permission: str | None = None) When call is made with user ID that doesn’t exist.

78 Chapter 7. homeassistant.exceptions CHAPTER EIGHT

HOMEASSISTANT.HELPERS

Helper methods for components within Home Assistant. homeassistant.helpers.config_per_platform(config: ConfigType, domain: str) → Iter- able[tuple[Any, Any]] Break a component config into different platforms. For example, will find ‘switch’, ‘switch 2’, ‘switch 3’, .. etc Async friendly. homeassistant.helpers.extract_domain_configs(config: ConfigType, domain: str) → Se- quence[str] Extract keys from config for given domain name. Async friendly.

8.1 homeassistant.helpers.aiohttp_client

Helper for aiohttp webclient stuff. async homeassistant.helpers.aiohttp_client.async_aiohttp_proxy_stream(hass: Home- Assis- tant, re- quest: web.BaseRequest, stream: aio- http.StreamReader, con- tent_type: str | None, buffer_size: int = 102400, time- out: int = 10) → web.StreamResponse Stream a stream to aiohttp web response.

79 Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.helpers.aiohttp_client.async_aiohttp_proxy_web(hass: HomeAs- sistant, request: web.BaseRequest, web_coro: Await- able[aiohttp.ClientResponse], buffer_size: int = 102400, timeout: int = 10) → web.StreamResponse | None Stream websession request to aiohttp web response. homeassistant.helpers.aiohttp_client.async_create_clientsession(hass: homeassis- tant.core.HomeAssistant, verify_ssl: bool = True, auto_cleanup: bool = True, **kwargs: Any) → aio- http.client.ClientSession Create a new ClientSession with kwargs, i.e. for cookies. If auto_cleanup is False, you need to call detach() after the session returned is no longer used. Default is True, the session will be automatically detached on homeassistant_stop or when being created in config entry setup, the config entry is unloaded. This method must be run in the event loop. homeassistant.helpers.aiohttp_client.async_get_clientsession(hass: homeassis- tant.core.HomeAssistant, verify_ssl: bool = True) → aio- http.client.ClientSession Return default aiohttp ClientSession. This method must be run in the event loop.

8.2 homeassistant.helpers.area_registry

Provide a way to connect devices to one physical location. class homeassistant.helpers.area_registry.AreaEntry(name: str, normalized_name: str, id: str | None = None) Bases: object Area Registry Entry. generate_id(existing_ids: Container[str]) → None Initialize ID.

80 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

id name normalized_name class homeassistant.helpers.area_registry.AreaRegistry(hass: homeassis- tant.core.HomeAssistant) Bases: object Class to hold a registry of areas. async_create(name: str) → homeassistant.helpers.area_registry.AreaEntry Create a new area. async_delete(area_id: str) → None Delete area. async_get_area(area_id: str) → AreaEntry | None Get area by id. async_get_area_by_name(name: str) → AreaEntry | None Get area by name. async_get_or_create(name: str) → homeassistant.helpers.area_registry.AreaEntry Get or create an area. async_list_areas() → Iterable[AreaEntry] Get all areas. async async_load() → None Load the area registry. async_schedule_save() → None Schedule saving the area registry. async_update(area_id: str, name: str) → homeassistant.helpers.area_registry.AreaEntry Update name of area. homeassistant.helpers.area_registry.async_get(hass: homeassis- tant.core.HomeAssistant) → homeassis- tant.helpers.area_registry.AreaRegistry Get area registry. async homeassistant.helpers.area_registry.async_get_registry(hass: homeassis- tant.core.HomeAssistant) → homeassis- tant.helpers.area_registry.AreaRegistry Get area registry. This is deprecated and will be removed in the future. Use async_get instead. async homeassistant.helpers.area_registry.async_load(hass: homeassis- tant.core.HomeAssistant) → None Load area registry. homeassistant.helpers.area_registry.normalize_area_name(area_name: str) → str Normalize an area name by removing whitespace and case folding.

8.2. homeassistant.helpers.area_registry 81 Home Assistant Documentation, Release 2021.10.0.dev0

8.3 homeassistant.helpers.check_config

Helper to check the configuration file. class homeassistant.helpers.check_config.CheckConfigError Bases: tuple Configuration check error. config Alias for field number 2 domain Alias for field number 1 message Alias for field number 0 class homeassistant.helpers.check_config.HomeAssistantConfig Bases: collections.OrderedDict Configuration result with errors attribute. add_error(message: str, domain: str | None = None, config: ConfigType | None = None) → Home- AssistantConfig Add a single error. property error_str Return errors as a string. async homeassistant.helpers.check_config.async_check_ha_config_file(hass: home- assis- tant.core.HomeAssistant) → home- assis- tant.helpers.check_config.HomeAssistantConfig Load and check if Home Assistant configuration file is valid. This method is a coroutine.

8.4 homeassistant.helpers.collection

Helper to deal with YAML + storage. class homeassistant.helpers.collection.CollectionChangeSet(change_type: str, item_id: str, item: Any) Bases: object Class to represent a change set. change_type: One of CHANGE_* item_id: The id of the item item: The item change_type: str = None item: Any = None item_id: str = None

82 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

exception homeassistant.helpers.collection.CollectionError Bases: homeassistant.exceptions.HomeAssistantError Base class for collection related errors. class homeassistant.helpers.collection.IDLessCollection(logger: logging.Logger, id_manager: IDManager | None = None) Bases: homeassistant.helpers.collection.ObservableCollection A collection without IDs. async async_load(data: list[dict]) → None Load the collection. Overrides existing data. counter = 0 class homeassistant.helpers.collection.IDManager Bases: object Keep track of IDs across different collections. add_collection(collection: dict[str, Any]) → None Add a collection to check for ID usage. generate_id(suggestion: str) → str Generate an ID. has_id(item_id: str) → bool Test if the ID exists. exception homeassistant.helpers.collection.ItemNotFound(item_id: str) Bases: homeassistant.helpers.collection.CollectionError Raised when an item is not found. class homeassistant.helpers.collection.ObservableCollection(logger: log- ging.Logger, id_manager: ID- Manager | None = None) Bases: abc.ABC Base collection type that can be observed. async_add_change_set_listener(listener: Callable[[Iterable[homeassistant.helpers.collection.CollectionChangeSet]], Awaitable[None]]) → None Add a listener for a full change set. Will be called with [(change_type, item_id, updated_config), . . . ] async_add_listener(listener: Callable[[str, str, dict], Awaitable[None]]) → None Add a listener. Will be called with (change_type, item_id, updated_config). async_items() → list[dict] Return list of items in collection. async notify_changes(change_sets: Iterable[homeassistant.helpers.collection.CollectionChangeSet]) → None Notify listeners of a change.

8.4. homeassistant.helpers.collection 83 Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.helpers.collection.StorageCollection(store: Store, log- ger: logging.Logger, id_manager: IDManager | None = None) Bases: homeassistant.helpers.collection.ObservableCollection Offer a CRUD interface on top of JSON storage. async async_create_item(data: dict) → dict Create a new item. async async_delete_item(item_id: str) → None Delete item. async async_load() → None Load the storage Manager. async async_update_item(item_id: str, updates: dict) → dict Update item. property hass Home Assistant object. class homeassistant.helpers.collection.StorageCollectionWebsocket(storage_collection: homeassis- tant.helpers.collection.StorageCollection, api_prefix: str, model_name: str, cre- ate_schema: dict, up- date_schema: dict) Bases: object Class to expose storage collection management over websocket. async_setup(hass: homeassistant.core.HomeAssistant, *, create_list: bool = True, create_create: bool = True) → None Set up the websocket commands. property item_id_key Return item ID key. async ws_create_item(hass: homeassistant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Create a item. async ws_delete_item(hass: homeassistant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Delete a item. ws_list_item(hass: homeassistant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None List items. async ws_update_item(hass: homeassistant.core.HomeAssistant, connection: homeassis- tant.components.websocket_api.connection.ActiveConnection, msg: dict) → None Update a item.

84 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.helpers.collection.YamlCollection(logger: logging.Logger, id_manager: IDManager | None = None) Bases: homeassistant.helpers.collection.ObservableCollection Offer a collection based on static data. async async_load(data: list[dict]) → None Load the YAML collection. Overrides existing data. homeassistant.helpers.collection.sync_entity_lifecycle(hass: homeassis- tant.core.HomeAssistant, domain: str, plat- form: str, en- tity_component: homeassis- tant.helpers.entity_component.EntityComponent, collection: homeassis- tant.helpers.collection.ObservableCollection, create_entity: Callable[[dict], homeassis- tant.helpers.entity.Entity]) → None Map a collection to an entity component.

8.5 homeassistant.helpers.condition

Offer reusable conditions. async homeassistant.helpers.condition.async_and_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Op- tional[Mapping[str, Any]]], bool] Create multi condition matcher using ‘AND’. async homeassistant.helpers.condition.async_device_from_config(hass: home- assis- tant.core.HomeAssistant, config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Op- tional[Mapping[str, Any]]], bool] Test a device condition. homeassistant.helpers.condition.async_extract_devices(config: ConfigType | Tem- plate) → set[str] Extract devices from a condition.

8.5. homeassistant.helpers.condition 85 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.condition.async_extract_entities(config: ConfigType | Tem- plate) → set[str] Extract entities from a condition. async homeassistant.helpers.condition.async_from_config(hass: HomeAssistant, con- fig: ConfigType | Template, config_validation: bool = True) → ConditionCheck- erType Turn a condition configuration into a method. Should be run on the event loop. async homeassistant.helpers.condition.async_not_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Op- tional[Mapping[str, Any]]], bool] Create multi condition matcher using ‘NOT’. homeassistant.helpers.condition.async_numeric_state(hass: HomeAssistant, entity: None | str | State, below: float | str | None = None, above: float | str | None = None, value_template: Template | None = None, variables: Template- VarsType = None, attribute: str | None = None) → bool Test a numeric state condition. homeassistant.helpers.condition.async_numeric_state_from_config(config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Op- tional[Mapping[str, Any]]], bool] Wrap action method with state based condition. async homeassistant.helpers.condition.async_or_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], config_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Create multi condition matcher using ‘OR’.

86 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.condition.async_template(hass: homeassis- tant.core.HomeAssistant, value_template: homeassis- tant.helpers.template.Template, vari- ables: Optional[Mapping[str, Any]] = None, trace_result: bool = True) → bool Test if template condition matches. homeassistant.helpers.condition.async_template_from_config(config: Dict[str, Any], config_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap action method with state based condition. async homeassistant.helpers.condition.async_trigger_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Op- tional[Mapping[str, Any]]], bool] Test a trigger condition. async homeassistant.helpers.condition.async_validate_condition_config(hass: Home- Assis- tant, con- fig: Con- fig- Type | Tem- plate) → Con- fig- Type | Tem- plate Validate config. homeassistant.helpers.condition.condition_trace_append(variables: Op- tional[Mapping[str, Any]], path: str) → homeassis- tant.helpers.trace.TraceElement Append a TraceElement to trace[path].

8.5. homeassistant.helpers.condition 87 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.condition.condition_trace_set_result(result: bool, **kwargs: Any) → None Set the result of TraceElement at the top of the stack. homeassistant.helpers.condition.condition_trace_update_result(**kwargs: Any) → None Update the result of TraceElement at the top of the stack. homeassistant.helpers.condition.numeric_state(hass: HomeAssistant, entity: None | str | State, below: float | str | None = None, above: float | str | None = None, value_template: Template | None = None, variables: TemplateVarsType = None) → bool Test a numeric state condition. homeassistant.helpers.condition.state(hass: HomeAssistant, entity: None | str | State, req_state: Any, for_period: timedelta | None = None, attribute: str | None = None) → bool Test if state matches requirements. Async friendly. homeassistant.helpers.condition.state_from_config(config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap action method with state based condition. homeassistant.helpers.condition.sun(hass: HomeAssistant, before: str | None = None, after: str | None = None, before_offset: timedelta | None = None, after_offset: timedelta | None = None) → bool Test if current time matches sun requirements. homeassistant.helpers.condition.sun_from_config(config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap action method with sun based condition. homeassistant.helpers.condition.template(hass: homeassistant.core.HomeAssistant, value_template: homeassis- tant.helpers.template.Template, variables: Optional[Mapping[str, Any]] = None) → bool Test if template condition matches. homeassistant.helpers.condition.time(hass: HomeAssistant, before: dt_util.dt.time | str | None = None, after: dt_util.dt.time | str | None = None, week- day: None | str | Container[str] = None) → bool Test if local time condition matches. Handle the fact that time is continuous and we may be testing for a period that crosses midnight. In that case it is easier to test for the opposite. “(23:59 <= now < 00:01)” would be the same as “not (00:01 <= now < 23:59)”. homeassistant.helpers.condition.time_from_config(config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap action method with time based condition.

88 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.condition.trace_condition(variables: TemplateVarsType) → Gen- erator[TraceElement, None, None] Trace condition evaluation. homeassistant.helpers.condition.trace_condition_function(condition: Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool]) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap a condition function to enable basic tracing. homeassistant.helpers.condition.zone(hass: HomeAssistant, zone_ent: None | str | State, en- tity: None | str | State) → bool Test if zone-condition matches. Async friendly. homeassistant.helpers.condition.zone_from_config(config: Dict[str, Any], con- fig_validation: bool = True) → Callable[[homeassistant.core.HomeAssistant, Optional[Mapping[str, Any]]], bool] Wrap action method with zone based condition.

8.6 homeassistant.helpers.config_entry_flow

Helpers for data entry flows for config entries. class homeassistant.helpers.config_entry_flow.DiscoveryFlowHandler(domain: str, title: str, discov- ery_function: Callable[[homeassistant.core.HomeAssistant], Union[Awaitable[bool], bool]]) Bases: homeassistant.config_entries.ConfigFlow Handle a discovery config flow. VERSION = 1 async async_step_confirm(user_input: dict[str, Any] | None = None) → FlowResult Confirm setup. async async_step_dhcp(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_discovery(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_homekit(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_import(_: dict[str, Any] | None) → FlowResult Handle a flow initialized by import.

8.6. homeassistant.helpers.config_entry_flow 89 Home Assistant Documentation, Release 2021.10.0.dev0

async async_step_mqtt(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_ssdp(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. async async_step_user(user_input: dict[str, Any] | None = None) → FlowResult Handle a flow initialized by the user. async async_step_zeroconf(discovery_info: Dict[str, Any]) → homeassis- tant.data_entry_flow.FlowResult Handle a flow initialized by discovery. class homeassistant.helpers.config_entry_flow.WebhookFlowHandler(domain: str, title: str, descrip- tion_placeholder: dict, al- low_multiple: bool) Bases: homeassistant.config_entries.ConfigFlow Handle a webhook config flow. VERSION = 1 async async_step_user(user_input: dict[str, Any] | None = None) → FlowResult Handle a user initiated set up flow to create a webhook. homeassistant.helpers.config_entry_flow.register_discovery_flow(domain: str, title: str, discov- ery_function: Discovery- FunctionType, connec- tion_class: str | Unde- finedType = ) → None Register flow for discovered integrations that not require auth. homeassistant.helpers.config_entry_flow.register_webhook_flow(domain: str, title: str, descrip- tion_placeholder: dict, al- low_multiple: bool = False) → None Register flow for webhook integrations.

90 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 async homeassistant.helpers.config_entry_flow.webhook_async_remove_entry(hass: home- as- sis- tant.core.HomeAssistant, en- try: home- as- sis- tant.config_entries.ConfigEntry) → None Remove a webhook config entry.

8.7 homeassistant.helpers.config_entry_oauth2_flow

Config Flow using OAuth2. This module exists of the following parts: • OAuth2 config flow which supports multiple OAuth2 implementations • OAuth2 implementation that works with local provided client ID/secret class homeassistant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler Bases: homeassistant.config_entries.ConfigFlow Handle a config flow. DOMAIN = '' VERSION = 1 async async_oauth_create_entry(data: dict) → homeassistant.data_entry_flow.FlowResult Create an entry for the flow. Ok to override if you want to fetch extra info or even add another step. classmethod async_register_implementation(hass: homeassistant.core.HomeAssistant, local_impl: homeassis- tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation) → None Register a local implementation. async async_step_auth(user_input: dict[str, Any] | None = None) → FlowResult Create an entry for auth. async async_step_creation(user_input: dict[str, Any] | None = None) → FlowResult Create config entry from external data. async async_step_pick_implementation(user_input: dict | None = None) → FlowResult Handle a flow start. async async_step_user(user_input: dict[str, Any] | None = None) → FlowResult Handle a flow start. property extra_authorize_data Extra data that needs to be appended to the authorize url.

8.7. homeassistant.helpers.config_entry_oauth2_flow 91 Home Assistant Documentation, Release 2021.10.0.dev0

abstract property logger Return logger. class homeassistant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation Bases: abc.ABC Base class to abstract OAuth2 authentication. abstract async async_generate_authorize_url(flow_id: str) → str Generate a url for the user to authorize. This step is called when a config flow is initialized. It should redirect the user to the vendor website where they can authorize Home Assistant. The implementation is responsible to get notified when the user is authorized and pass this to the specified config flow. Do as little work as possible once notified. You can do the work inside async_resolve_external_data. This will give the best UX. Pass external data in with: await hass.config_entries.flow.async_configure( flow_id=flow_id, user_input={‘code’: ‘abcd’, ‘state’: {...} ) async async_refresh_token(token: dict) → dict Refresh a token and update expires info. abstract async async_resolve_external_data(external_data: Any) → dict Resolve external data to tokens. Turn the data that the implementation passed to the config flow as external step data into tokens. These tokens will be stored as ‘token’ in the config entry data. abstract property domain Domain that is providing the implementation. abstract property name Name of the implementation. class homeassistant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation(hass: home- as- sis- tant.core.HomeAssistant, do- main: str, client_id: str, client_secret: str, au- tho- rize_url: str, to- ken_url: str) Bases: homeassistant.helpers.config_entry_oauth2_flow. AbstractOAuth2Implementation

92 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

Local OAuth2 implementation. async async_generate_authorize_url(flow_id: str) → str Generate a url for the user to authorize. async async_resolve_external_data(external_data: Any) → dict Resolve the authorization code to tokens. property domain Domain providing the implementation. property extra_authorize_data Extra data that needs to be appended to the authorize url. property name Name of the implementation. property redirect_uri Return the redirect uri. class homeassistant.helpers.config_entry_oauth2_flow.OAuth2AuthorizeCallbackView Bases: homeassistant.components.http.view.HomeAssistantView OAuth2 Authorization Callback View. async get(request: aiohttp.web_request.Request) → aiohttp.web_response.Response Receive authorization code. name = 'auth:external:callback' requires_auth = False url: str | None = '/auth/external/callback' class homeassistant.helpers.config_entry_oauth2_flow.OAuth2Session(hass: home- assis- tant.core.HomeAssistant, con- fig_entry: home- assis- tant.config_entries.ConfigEntry, implemen- tation: home- assis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation) Bases: object Session to make requests authenticated with OAuth2. async async_ensure_token_valid() → None Ensure that the current token is valid. async async_request(method: str, url: str, **kwargs: Any) → aio- http.client_reqrep.ClientResponse Make a request. property token Return the token.

8.7. homeassistant.helpers.config_entry_oauth2_flow 93 Home Assistant Documentation, Release 2021.10.0.dev0

property valid_token Return if token is still valid. homeassistant.helpers.config_entry_oauth2_flow.async_add_implementation_provider(hass: Home- As- sis- tant, provider_domain: str, async_provide_implementation: Callable[[HomeAssistant, str], Await- able[AbstractOAuth2Implementation | None]]) → None Add an implementation provider. If no implementation found, return None. async homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation(hass: home- as- sis- tant.core.HomeAssistant, con- fig_entry: home- as- sis- tant.config_entries.ConfigEntry) → home- as- sis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation Return the implementation for this config entry. async homeassistant.helpers.config_entry_oauth2_flow.async_get_implementations(hass: Home- As- sis- tant, do- main: str) → dict[str, Ab- strac- tOAuth2Implementation] Return OAuth2 implementations for specified domain.

94 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.helpers.config_entry_oauth2_flow.async_oauth2_request(hass: home- as- sis- tant.core.HomeAssistant, to- ken: dict, method: str, url: str, **kwargs: Any) → aio- http.client_reqrep.ClientResponse Make an OAuth2 authenticated request. This method will not refresh tokens. Use OAuth2 session for that. homeassistant.helpers.config_entry_oauth2_flow.async_register_implementation(hass: home- as- sis- tant.core.HomeAssistant, do- main: str, im- ple- men- ta- tion: home- as- sis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation) → None Register an OAuth2 flow implementation for an integration.

8.8 homeassistant.helpers.config_validation

Helpers for config validation using voluptuous. homeassistant.helpers.config_validation.STATE_CONDITION_SCHEMA(value: Any) → dict Validate a state condition. homeassistant.helpers.config_validation.boolean(value: Any) → bool Validate and coerce a boolean value. homeassistant.helpers.config_validation.custom_serializer(schema: Any) → Any Serialize additional types for voluptuous_serialize.

8.8. homeassistant.helpers.config_validation 95 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.config_validation.date(value: Any) → datetime.date Validate and transform a date. homeassistant.helpers.config_validation.datetime(value: Any) → datetime.datetime Validate datetime. homeassistant.helpers.config_validation.deprecated(key: str, replacement_key: str | None = None, default: Any | None = None) → Callable[[dict], dict] Log key as deprecated and provide a replacement (if exists). Expected behavior: • Outputs the appropriate deprecation warning if key is detected • Processes schema moving the value from key to replacement_key • Processes schema changing nothing if only replacement_key provided • No warning if only replacement_key provided • No warning if neither key nor replacement_key are provided – Adds replacement_key with default value in this case homeassistant.helpers.config_validation.determine_script_action(action: dict[str, Any]) → str Determine action type. homeassistant.helpers.config_validation.dynamic_template(value: Any | None) → tem- plate_helper.Template Validate a dynamic (non static) jinja2 template. homeassistant.helpers.config_validation.ensure_list(value: T | list[T] | None) → list[T] Wrap value in list if it is not one. homeassistant.helpers.config_validation.ensure_list_csv(value: Any) → list Ensure that input is a list or make one from comma-separated string. homeassistant.helpers.config_validation.entities_domain(domain: str | list[str]) → Callable[[str | list], list[str]] Validate that entities belong to domain. homeassistant.helpers.config_validation.entity_domain(domain: str | list[str]) → Callable[[Any], str] Validate that entity belong to domain. homeassistant.helpers.config_validation.entity_id(value: Any) → str Validate Entity ID. homeassistant.helpers.config_validation.entity_ids(value: str | list) → list[str] Validate Entity IDs. homeassistant.helpers.config_validation.enum(enumClass: type[Enum]) → vol.All Create validator for specified enum. homeassistant.helpers.config_validation.has_at_least_one_key(*keys: Any) → Callable[[dict], dict] Validate that at least one key exists.

96 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.config_validation.has_at_most_one_key(*keys: Any) → Callable[[dict], dict] Validate that zero keys exist or one key exists. homeassistant.helpers.config_validation.icon(value: Any) → str Validate icon. homeassistant.helpers.config_validation.is_regex(value: Any) → re.Pattern[Any] Validate that a string is a valid regular expression. homeassistant.helpers.config_validation.isdevice(value: Any) → str Validate that value is a real device. homeassistant.helpers.config_validation.isdir(value: Any) → str Validate that the value is an existing dir. homeassistant.helpers.config_validation.isfile(value: Any) → str Validate that the value is an existing file. homeassistant.helpers.config_validation.key_dependency(key: Hashable, depen- dency: Hashable) → Callable[[dict[Hashable, Any]], dict[Hashable, Any]] Validate that all dependencies exist for key. homeassistant.helpers.config_validation.key_value_schemas(key: str, value_schemas: dict[Hashable, vol.Schema]) → Callable[[Any], dict[Hashable, Any]] Create a validator that validates based on a value for specific key. This gives better error messages. homeassistant.helpers.config_validation.make_entity_service_schema(schema: dict, *, extra: int = 0) → volup- tuous.schema_builder.Schema Create an entity service schema. homeassistant.helpers.config_validation.match_all(value: T) → T Validate that matches all values. homeassistant.helpers.config_validation.matches_regex(regex: str) → Callable[[Any], str] Validate that the value is a string that matches a regex. class homeassistant.helpers.config_validation.multi_select(options: dict) Bases: object Multi select validator returning list of selected values. homeassistant.helpers.config_validation.path(value: Any) → str Validate it’s a safe path. homeassistant.helpers.config_validation.positive_timedelta(value: date- time.timedelta) → datetime.timedelta Validate timedelta is positive.

8.8. homeassistant.helpers.config_validation 97 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.config_validation.remove_falsy(value: list[T]) → list[T] Remove falsy values from a list. homeassistant.helpers.config_validation.schema_with_slug_keys(value_schema: T | Callable, *, slug_validator: Callable[[Any], str] = ) → Callable Ensure dicts have slugs as keys. Replacement of vol.Schema({cv.slug: value_schema}) to prevent misleading “Extra keys” errors from volup- tuous. homeassistant.helpers.config_validation.script_action(value: Any) → dict Validate a script action. homeassistant.helpers.config_validation.service(value: Any) → str Validate service. homeassistant.helpers.config_validation.slug(value: Any) → str Validate value is a valid slug. homeassistant.helpers.config_validation.slugify(value: Any) → str Coerce a value to a slug. homeassistant.helpers.config_validation.socket_timeout(value: Any | None) → ob- ject Validate timeout float > 0.0. None coerced to socket._GLOBAL_DEFAULT_TIMEOUT bare object. homeassistant.helpers.config_validation.string(value: Any) → str Coerce value to string, except for None. homeassistant.helpers.config_validation.string_with_no_html(value: Any) → str Validate that the value is a string without HTML. homeassistant.helpers.config_validation.temperature_unit(value: Any) → str Validate and transform temperature unit. homeassistant.helpers.config_validation.template(value: Any | None) → tem- plate_helper.Template Validate a jinja2 template. homeassistant.helpers.config_validation.template_complex(value: Any) → Any Validate a complex jinja2 template. homeassistant.helpers.config_validation.time(value: Any) → datetime.time Validate and transform a time. homeassistant.helpers.config_validation.time_period_seconds(value: float | str) → timedelta Validate and transform seconds to a time offset. homeassistant.helpers.config_validation.time_period_str(value: str) → date- time.timedelta Validate and transform time offset. homeassistant.helpers.config_validation.time_zone(value: str) → str Validate timezone.

98 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.config_validation.url(value: Any) → str Validate an URL. homeassistant.helpers.config_validation.url_no_path(value: Any) → str Validate a url without a path. homeassistant.helpers.config_validation.uuid4_hex(value: Any) → str Validate a v4 UUID in hex format. homeassistant.helpers.config_validation.whitespace(value: Any) → str Validate result contains only whitespace. homeassistant.helpers.config_validation.x10_address(value: str) → str Validate an address.

8.9 homeassistant.helpers.data_entry_flow

Helpers for the data entry flow. class homeassistant.helpers.data_entry_flow.FlowManagerIndexView(flow_mgr: homeassis- tant.data_entry_flow.FlowManager) Bases: homeassistant.helpers.data_entry_flow._BaseFlowManagerView View to create config flows. async post(request: web.Request, data: dict[str, Any]) → web.Response Handle a POST request. class homeassistant.helpers.data_entry_flow.FlowManagerResourceView(flow_mgr: home- assis- tant.data_entry_flow.FlowManager) Bases: homeassistant.helpers.data_entry_flow._BaseFlowManagerView View to interact with the flow manager. async delete(request: aiohttp.web_request.Request, flow_id: str) → aio- http.web_response.Response Cancel a flow in progress. async get(request: aiohttp.web_request.Request, flow_id: str) → aiohttp.web_response.Response Get the current state of a data_entry_flow. async post(request: web.Request, flow_id: str, data: dict[str, Any]) → web.Response Handle a POST request.

8.10 homeassistant.helpers.debounce

Debounce helper. class homeassistant.helpers.debounce.Debouncer(hass: HomeAssistant, logger: Logger, *, cooldown: float, immediate: bool, function: Callable[..., Awaitable[Any]] | None = None) Bases: object Class to rate limit calls to a specific command.

8.9. homeassistant.helpers.data_entry_flow 99 Home Assistant Documentation, Release 2021.10.0.dev0

async async_call() → None Call the function. async_cancel() → None Cancel any scheduled call. property function Return the function being wrapped by the Debouncer.

8.11 homeassistant.helpers.deprecation

Deprecation helpers for Home Assistant. homeassistant.helpers.deprecation.deprecated_class(replacement: str) → Any Mark class as deprecated and provide a replacement class to be used instead. homeassistant.helpers.deprecation.deprecated_function(replacement: str) → Callable[[...], Callable] Mark function as deprecated and provide a replacement function to be used instead. homeassistant.helpers.deprecation.deprecated_substitute(substitute_name: str) → Callable[[...], Callable] Help migrate properties to new names. When a property is added to replace an older property, this decorator can be added to the new property, listing the old property as the substitute. If the old property is defined, its value will be used instead, and a log warning will be issued alerting the user of the impending change. homeassistant.helpers.deprecation.get_deprecated(config: dict[str, Any], new_name: str, old_name: str, default: Any | None = None) → Any | None Allow an old config name to be deprecated with a replacement. If the new config isn’t found, but the old one is, the old value is used and a warning is issued to the user.

8.12 homeassistant.helpers.device_registry

Provide a way to connect entities belonging to one device. class homeassistant.helpers.device_registry.DeletedDeviceEntry(config_entries: set[str], con- nections: set[tuple[str, str]], identifiers: set[tuple[str, str]], id: str, or- phaned_timestamp: float | None) Bases: object Deleted Device Registry Entry. config_entries connections id

100 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

identifiers orphaned_timestamp to_device_entry(config_entry_id: str, connections: set[tuple[str, str]], identifiers: set[tuple[str, str]]) → DeviceEntry Create DeviceEntry from DeletedDeviceEntry. class homeassistant.helpers.device_registry.DeviceEntry(config_entries=NOTHING, connections=NOTHING, identifiers=NOTHING, manufacturer: str | None = None, model: str | None = None, name: str | None = None, sw_version: str | None = None, via_device_id: str | None = None, area_id: str | None = None, name_by_user: str | None = None, entry_type: str | None = None, id: str = NOTHING, is_new: bool = False, disabled_by: str | None = None, sug- gested_area: str | None = None) Bases: object Device Registry Entry. area_id config_entries connections property disabled Return if entry is disabled. disabled_by entry_type id identifiers is_new manufacturer model name name_by_user suggested_area sw_version via_device_id

8.12. homeassistant.helpers.device_registry 101 Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.helpers.device_registry.DeviceRegistry(hass: homeassis- tant.core.HomeAssistant) Bases: object Class to hold a registry of devices. async_clear_area_id(area_id: str) → None Clear area id from registry entries. async_clear_config_entry(config_entry_id: str) → None Clear config entry from registry entries. async_get(device_id: str) → DeviceEntry | None Get device. async_get_device(identifiers: set[tuple[str, str]], connections: set[tuple[str, str]] | None = None) → DeviceEntry | None Check if device is registered. async_get_or_create(*, config_entry_id: str, connections: set[tuple[str, str]] | None = None, identifiers: set[tuple[str, str]] | None = None, manufacturer: str | None | Un- definedType = , model: str | None | Unde- finedType = , name: str | None | Undefined- Type = , default_manufacturer: str | None | UndefinedType = , default_model: str | None | UndefinedType = , default_name: str | None | UndefinedType = , sw_version: str | None | UndefinedType = , entry_type: str | None | UndefinedType = , via_device: tuple[str, str] | None = None, disabled_by: str | None | UndefinedType = , suggested_area: str | None | Undefined- Type = ) → DeviceEntry Get device. Create if it doesn’t exist. async async_load() → None Load the device registry. async_purge_expired_orphaned_devices() → None Purge expired orphaned devices from the registry. We need to purge these periodically to avoid the database growing without bound. async_remove_device(device_id: str) → None Remove a device from the device registry. async_schedule_save() → None Schedule saving the device registry.

102 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async_update_device(device_id: str, *, area_id: str | None | UndefinedType = , manufacturer: str | None | Undefined- Type = , model: str | None | Unde- finedType = , name: str | None | Un- definedType = , name_by_user: str | None | UndefinedType = , new_identifiers: set[tuple[str, str]] | UndefinedType = , sw_version: str | None | UndefinedType = , via_device_id: str | None | UndefinedType = , add_config_entry_id: str | UndefinedType = , remove_config_entry_id: str | UndefinedType = , disabled_by: str | None | UndefinedType = , suggested_area: str | None | Undefined- Type = ) → DeviceEntry | None Update properties of a device. deleted_devices = None devices = None homeassistant.helpers.device_registry.async_cleanup(hass: HomeAssistant, dev_reg: DeviceRegistry, ent_reg: en- tity_registry.EntityRegistry) → None Clean up device registry. homeassistant.helpers.device_registry.async_config_entry_disabled_by_changed(registry: De- viceReg- istry, con- fig_entry: Con- fi- gEn- try) → None Handle a config entry being disabled or enabled. Disable devices in the registry that are associated with a config entry when the config entry is disabled, enable devices in the registry that are associated with a config entry when the config entry is enabled and the devices are marked DISABLED_CONFIG_ENTRY. Only disable a device if all associated config entries are disabled. homeassistant.helpers.device_registry.async_entries_for_area(registry: De- viceRegistry, area_id: str) → list[DeviceEntry] Return entries that match an area. homeassistant.helpers.device_registry.async_entries_for_config_entry(registry: De- viceReg- istry, con- fig_entry_id: str) → list[DeviceEntry] Return entries that match a config entry.

8.12. homeassistant.helpers.device_registry 103 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.device_registry.async_get(hass: homeassis- tant.core.HomeAssistant) → homeassis- tant.helpers.device_registry.DeviceRegistry Get device registry. async homeassistant.helpers.device_registry.async_get_registry(hass: home- assis- tant.core.HomeAssistant) → homeassis- tant.helpers.device_registry.DeviceRegistry Get device registry. This is deprecated and will be removed in the future. Use async_get instead. async homeassistant.helpers.device_registry.async_load(hass: homeassis- tant.core.HomeAssistant) → None Load device registry. homeassistant.helpers.device_registry.async_setup_cleanup(hass: homeassis- tant.core.HomeAssistant, dev_reg: homeassis- tant.helpers.device_registry.DeviceRegistry) → None Clean up device registry when entities removed. homeassistant.helpers.device_registry.format_mac(mac: str) → str Format the mac address string for entry into dev reg.

8.13 homeassistant.helpers.discovery

Helper methods to help with platform discovery. There are two different types of discoveries that can be fired/listened for. • listen/discover is for services. These are targeted at a component. • listen_platform/discover_platform is for platforms. These are used by components to allow discovery of their platforms. class homeassistant.helpers.discovery.DiscoveryDict Bases: dict Discovery data. discovered = None platform = None service = None async homeassistant.helpers.discovery.async_discover(hass: core.HomeAssistant, ser- vice: str, discovered: Dis- coveryInfoType | None, compo- nent: str | None, hass_config: ConfigType) → None Fire discovery event. Can ensure a component is loaded.

104 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.discovery.async_listen(hass: homeassistant.core.HomeAssistant, service: str, callback: Callable[[], None]) → None Set up listener for discovery of specific service. Service can be a string or a list/tuple. homeassistant.helpers.discovery.async_listen_platform(hass: core.HomeAssistant, component: str, callback: Callable[[str, dict[str, Any] | None], Any]) → None Register a platform loader listener. This method must be run in the event loop. async homeassistant.helpers.discovery.async_load_platform(hass: homeassis- tant.core.HomeAssistant, component: str, plat- form: str, discov- ered: Dict[str, Any], hass_config: Dict[str, Any]) → None Load a component and platform dynamically. Use async_listen_platform to register a callback for these events. Warning: Do not await this inside a setup method to avoid a dead lock. Use hass.async_create_task(async_load_platform(..)) instead. homeassistant.helpers.discovery.discover(hass: homeassistant.core.HomeAssistant, ser- vice: str, discovered: Dict[str, Any], component: str, hass_config: Dict[str, Any]) → None Fire discovery event. Can ensure a component is loaded. homeassistant.helpers.discovery.load_platform(hass: homeassistant.core.HomeAssistant, component: str, platform: str, discovered: Dict[str, Any], hass_config: Dict[str, Any]) → None Load a component and platform dynamically.

8.14 homeassistant.helpers.dispatcher

Helpers for Home Assistant dispatcher & internal component/platform. homeassistant.helpers.dispatcher.async_dispatcher_connect(hass: homeassis- tant.core.HomeAssistant, signal: str, target: Callable[[...], Any]) → Callable[[], None] Connect a callable function to a signal. This method must be run in the event loop. homeassistant.helpers.dispatcher.async_dispatcher_send(hass: homeassis- tant.core.HomeAssistant, signal: str, *args: Any) → None Send signal and data. This method must be run in the event loop.

8.14. homeassistant.helpers.dispatcher 105 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.dispatcher.dispatcher_connect(hass: homeassis- tant.core.HomeAssistant, signal: str, target: Callable[[...], None]) → Callable[[], None] Connect a callable function to a signal. homeassistant.helpers.dispatcher.dispatcher_send(hass: homeassis- tant.core.HomeAssistant, signal: str, *args: Any) → None Send signal and data.

8.15 homeassistant.helpers.entity

An abstract class for entities. class homeassistant.helpers.entity.DeviceInfo Bases: dict Entity device information for device registry. connections = None default_manufacturer = None default_model = None default_name = None entry_type = None identifiers = None manufacturer = None model = None name = None suggested_area = None sw_version = None via_device = None class homeassistant.helpers.entity.Entity Bases: abc.ABC An abstract class for Home Assistant entities. add_to_platform_abort() → None Abort adding an entity to a platform. async add_to_platform_finish() → None Finish adding an entity to a platform. add_to_platform_start(hass: HomeAssistant, platform: EntityPlatform, parallel_updates: asyn- cio.Semaphore | None) → None Start adding an entity to a platform. property assumed_state Return True if unable to access real state of the entity.

106 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async async_added_to_hass() → None Run when entity about to be added to hass. To be extended by integrations. async async_device_update(warning: bool = True) → None Process ‘update’ or ‘async_update’ from entity. This method is a coroutine. async async_internal_added_to_hass() → None Run when entity about to be added to hass. Not to be extended by integrations. async async_internal_will_remove_from_hass() → None Run when entity will be removed from hass. Not to be extended by integrations. async_on_remove(func: Callable[[], None]) → None Add a function to call when entity removed. async async_remove(*, force_remove: bool = False) → None Remove entity from Home Assistant. If the entity has a non disabled entry in the entity registry, the entity’s state will be set to unavailable, in the same way as when the entity registry is loaded. If the entity doesn’t have a non disabled entry in the entity registry, or if force_remove=True, its state will be removed. async async_removed_from_registry() → None Run when entity has been removed from entity registry. To be extended by integrations. async async_request_call(coro: collections.abc.Awaitable) → None Process request batched. async_schedule_update_ha_state(force_refresh: bool = False) → None Schedule an update ha state change task. This method must be run in the event loop. the update avoids executor deadlocks. Entity state and attributes are read when the update ha state change task is executed. If state is changed more than once before the ha state change task has been executed, the intermediate state transitions will be missed. async_set_context(context: homeassistant.core.Context) → None Set the context the entity currently operates under. async async_update_ha_state(force_refresh: bool = False) → None Update Home Assistant with current state of entity. If force_refresh == True will update entity before setting state. This method must be run in the event loop. async async_will_remove_from_hass() → None Run when entity will be removed from hass. To be extended by integrations. async_write_ha_state() → None Write the state to the state machine.

8.15. homeassistant.helpers.entity 107 Home Assistant Documentation, Release 2021.10.0.dev0

property available Return True if entity is available. property capability_attributes Return the capability attributes. Attributes that explain the capabilities of an entity. Implemented by component base class. Convention for attribute names is lowercase snake_case. property context_recent_time Time that a context is considered recent. property device_class Return the class of this device, from component DEVICE_CLASSES. property device_info Return device specific attributes. Implemented by platform classes. property device_state_attributes Return entity specific state attributes. This method is deprecated, platform classes should implement extra_state_attributes instead. property enabled Return if the entity is enabled in the entity registry. If an entity is not part of the registry, it cannot be disabled and will therefore always be enabled. entity_description = None entity_id: str = None property entity_picture Return the entity picture to use in the frontend, if any. property entity_registry_enabled_default Return if the entity should be enabled when first added to the entity registry. property extra_state_attributes Return entity specific state attributes. Implemented by platform classes. Convention for attribute names is lowercase snake_case. property force_update Return True if state updates should be forced. If True, a state change will be triggered anytime the state property is updated, not just when the value changes. hass: HomeAssistant = None property icon Return the icon to use in the frontend, if any. property name Return the name of the entity. parallel_updates: asyncio.Semaphore | None = None platform: EntityPlatform | None = None registry_entry: RegistryEntry | None = None

108 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

schedule_update_ha_state(force_refresh: bool = False) → None Schedule an update ha state change task. Scheduling the update avoids executor deadlocks. Entity state and attributes are read when the update ha state change task is executed. If state is changed more than once before the ha state change task has been executed, the intermediate state transitions will be missed. property should_poll Return True if entity has to be polled for state. False if entity pushes its state to HA. property state Return the state of the entity. property state_attributes Return the state attributes. Implemented by component base class, should not be extended by integrations. Convention for attribute names is lowercase snake_case. property supported_features Flag supported features. property unique_id Return a unique ID. property unit_of_measurement Return the unit of measurement of this entity, if any. class homeassistant.helpers.entity.EntityDescription(key: str, device_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: object A class that describes Home Assistant entities. device_class: str | None = None entity_registry_enabled_default: bool = True force_update: bool = False icon: str | None = None key = None name: str | None = None unit_of_measurement: str | None = None class homeassistant.helpers.entity.ToggleEntity Bases: homeassistant.helpers.entity.Entity An abstract class for entities that can be turned on and off. async async_toggle(**kwargs: Any) → None Toggle the entity.

8.15. homeassistant.helpers.entity 109 Home Assistant Documentation, Release 2021.10.0.dev0

async async_turn_off(**kwargs: Any) → None Turn the entity off. async async_turn_on(**kwargs: Any) → None Turn the entity on. entity_description = None property is_on Return True if entity is on. property state Return the state. toggle(**kwargs: Any) → None Toggle the entity. turn_off(**kwargs: Any) → None Turn the entity off. turn_on(**kwargs: Any) → None Turn the entity on. class homeassistant.helpers.entity.ToggleEntityDescription(key: str, device_class: str | None = None, en- tity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None) Bases: homeassistant.helpers.entity.EntityDescription A class that describes toggle entities. key = None homeassistant.helpers.entity.async_generate_entity_id(entity_id_format: str, name: str | None, current_ids: It- erable[str] | None = None, hass: HomeAssistant | None = None) → str Generate a unique entity ID based on given entity IDs or used IDs. homeassistant.helpers.entity.entity_sources(hass: HomeAssistant) → dict[str, dict[str, str]] Get the entity sources. homeassistant.helpers.entity.generate_entity_id(entity_id_format: str, name: str | None, current_ids: list[str] | None = None, hass: HomeAssistant | None = None) → str Generate a unique entity ID based on given entity IDs or used IDs. homeassistant.helpers.entity.get_capability(hass: HomeAssistant, entity_id: str, capabil- ity: str) → Any | None Get a capability attribute of an entity. First try the statemachine, then entity registry.

110 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.entity.get_device_class(hass: HomeAssistant, entity_id: str) → str | None Get device class of an entity. First try the statemachine, then entity registry. homeassistant.helpers.entity.get_supported_features(hass: homeassis- tant.core.HomeAssistant, en- tity_id: str) → int Get supported features for an entity. First try the statemachine, then entity registry. homeassistant.helpers.entity.get_unit_of_measurement(hass: HomeAssistant, en- tity_id: str) → str | None Get unit of measurement class of an entity. First try the statemachine, then entity registry.

8.16 homeassistant.helpers.entity_component

Helpers for components that manage entities. class homeassistant.helpers.entity_component.EntityComponent(logger: log- ging.Logger, domain: str, hass: homeassis- tant.core.HomeAssistant, scan_interval: datetime.timedelta = date- time.timedelta(seconds=15)) Bases: object The EntityComponent manages platforms that manages entities. This class has the following responsibilities: • Process the configuration and set up a platform based component. • Manage the platforms and their entities. • Help extract the entities from a service call. • Listen for discovery events for platforms related to the domain. async async_extract_from_service(service_call: ServiceCall, expand_group: bool = True) → list[entity.Entity] Extract all known and available entities from a service call. Will return an empty list if entities specified but unknown. This method must be run in the event loop. async async_prepare_reload(*, skip_reset: bool = False) → ConfigType | None Prepare reloading this entity component. This method must be run in the event loop. async_register_entity_service(name: str, schema: dict[str, Any] | vol.Schema, func: str | Callable[..., Any], required_features: list[int] | None = None) → None Register an entity service.

8.16. homeassistant.helpers.entity_component 111 Home Assistant Documentation, Release 2021.10.0.dev0

async async_remove_entity(entity_id: str) → None Remove an entity managed by one of the platforms. async async_setup(config: Dict[str, Any]) → None Set up a full entity component. Loads the platforms from the config and will listen for supported discovered platforms. This method must be run in the event loop. async async_setup_entry(config_entry: homeassistant.config_entries.ConfigEntry) → bool Set up a config entry. async async_setup_platform(platform_type: str, platform_config: ConfigType, discovery_info: DiscoveryInfoType | None = None) → None Set up a platform for this component. async async_unload_entry(config_entry: homeassistant.config_entries.ConfigEntry) → bool Unload a config entry. property entities Return an iterable that returns all entities. get_entity(entity_id: str) → entity.Entity | None Get an entity. setup(config: Dict[str, Any]) → None Set up a full entity component. This doesn’t block the executor to protect from deadlocks. async homeassistant.helpers.entity_component.async_update_entity(hass: homeassis- tant.core.HomeAssistant, entity_id: str) → None Trigger an update for an entity.

8.17 homeassistant.helpers.entity_platform

Class to manage the entities for a single platform. class homeassistant.helpers.entity_platform.AddEntitiesCallback(*args, **kwargs) Bases: typing.Protocol Protocol type for EntityPlatform.add_entities callback. class homeassistant.helpers.entity_platform.EntityPlatform(*, hass: Home- Assistant, logger: Logger, domain: str, platform_name: str, platform: ModuleType | None, scan_interval: timedelta, en- tity_namespace: str | None) Bases: object Manage the entities for a single platform.

112 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

add_entities(new_entities: Iterable[Entity], update_before_add: bool = False) → None Add entities for a single platform. async async_add_entities(new_entities: Iterable[Entity], update_before_add: bool = False) → None Add entities for a single platform async. This method must be run in the event loop. async_cancel_retry_setup() → None Cancel retry setup. async async_destroy() → None Destroy an entity platform. Call before discarding the object. async async_extract_from_service(service_call: ServiceCall, expand_group: bool = True) → list[Entity] Extract all known and available entities from a service call. Will return an empty list if entities specified but unknown. This method must be run in the event loop. async_register_entity_service(name: str, schema: dict | vol.Schema, func: str | Callable[..., Any], required_features: Iterable[int] | None = None) → None Register an entity service. Services will automatically be shared by all platforms of the same domain. async async_remove_entity(entity_id: str) → None Remove entity id from platform. async async_reset() → None Remove all entities and reset data. This method must be run in the event loop. async async_setup(platform_config: ConfigType, discovery_info: DiscoveryInfoType | None = None) → None Set up the platform from a config file. async async_setup_entry(config_entry: homeassistant.config_entries.ConfigEntry) → bool Set up the platform from a config entry. async async_shutdown() → None Call when Home Assistant is stopping. async_unsub_polling() → None Stop polling. homeassistant.helpers.entity_platform.async_get_current_platform() → homeassis- tant.helpers.entity_platform.EntityPlatform Get the current platform from context. homeassistant.helpers.entity_platform.async_get_platforms(hass: HomeAssistant, integration_name: str) → list[EntityPlatform] Find existing platforms.

8.17. homeassistant.helpers.entity_platform 113 Home Assistant Documentation, Release 2021.10.0.dev0

8.18 homeassistant.helpers.entity_registry

Provide a registry to track entity IDs. The Entity Registry keeps a registry of entities. Entities are uniquely identified by their domain, platform and a unique id provided by that platform. The Entity Registry will persist itself 10 seconds after a new entity is registered. Registering a new entity while a timer is in progress resets the timer. class homeassistant.helpers.entity_registry.EntityRegistry(hass: homeassis- tant.core.HomeAssistant) Bases: object Class to hold a registry of entities. async_clear_area_id(area_id: str) → None Clear area id from registry entries. async_clear_config_entry(config_entry: str) → None Clear config entry from registry entries. async_device_modified(event: homeassistant.core.Event) → None Handle the removal or update of a device. Remove entities from the registry that are associated to a device when the device is removed. Disable entities in the registry that are associated to a device when the device is disabled. async_generate_entity_id(domain: str, suggested_object_id: str, known_object_ids: Iter- able[str] | None = None) → str Generate an entity ID that does not conflict. Conflicts checked against registered and currently existing entities. async_get(entity_id: str) → RegistryEntry | None Get EntityEntry for an entity_id. async_get_device_class_lookup(domain_device_classes: set[tuple[str, str | None]]) → dict Return a lookup of entity ids for devices which have matching entities. Entities must match a set of (domain, device_class) tuples. The result is indexed by device_id, then by the matching (domain, device_class) async_get_entity_id(domain: str, platform: str, unique_id: str) → str | None Check if an entity_id is currently registered. async_get_or_create(domain: str, platform: str, unique_id: str, *, suggested_object_id: str | None = None, known_object_ids: Iterable[str] | None = None, disabled_by: str | None = None, config_entry: ConfigEntry | None = None, device_id: str | None = None, area_id: str | None = None, capabilities: Mapping[str, Any] | None = None, supported_features: int | None = None, device_class: str | None = None, unit_of_measurement: str | None = None, original_name: str | None = None, original_icon: str | None = None) → RegistryEntry Get entity. Create if it doesn’t exist. async_is_registered(entity_id: str) → bool Check if an entity_id is currently registered. async async_load() → None Load the entity registry.

114 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async_remove(entity_id: str) → None Remove an entity from registry. async_schedule_save() → None Schedule saving the entity registry. async_update_entity(entity_id: str, *, name: str | None | UndefinedType = , icon: str | None | UndefinedType = , config_entry_id: str | None | UndefinedType = , area_id: str | None | UndefinedType = , new_entity_id: str | UndefinedType = , new_unique_id: str | UndefinedType = , disabled_by: str | None | UndefinedType = ) → RegistryEntry Update properties of an entity. class homeassistant.helpers.entity_registry.RegistryEntry(entity_id: str, unique_id: str, plat- form: str, name: str | None = None, icon: str | None = None, device_id: str | None = None, area_id: str | None = None, con- fig_entry_id: str | None = None, disabled_by: str | None = None, ca- pabilities: Mapping[str, Any] | None = None, supported_features: int = 0, device_class: str | None = None, unit_of_measurement: str | None = None, orig- inal_name: str | None = None, original_icon: str | None = None) Bases: object Entity Registry Entry. area_id capabilities config_entry_id device_class device_id property disabled Return if entry is disabled. disabled_by domain entity_id icon

8.18. homeassistant.helpers.entity_registry 115 Home Assistant Documentation, Release 2021.10.0.dev0

name original_icon original_name platform supported_features unique_id unit_of_measurement write_unavailable_state(hass: homeassistant.core.HomeAssistant) → None Write the unavailable state to the state machine. homeassistant.helpers.entity_registry.async_config_entry_disabled_by_changed(registry: En- ti- tyReg- istry, con- fig_entry: Con- fi- gEn- try) → None Handle a config entry being disabled or enabled. Disable entities in the registry that are associated with a config entry when the config entry is disabled, enable entities in the registry that are associated with a config entry when the config entry is enabled and the entities are marked DISABLED_CONFIG_ENTRY. homeassistant.helpers.entity_registry.async_entries_for_area(registry: En- tityRegistry, area_id: str) → list[RegistryEntry] Return entries that match an area. homeassistant.helpers.entity_registry.async_entries_for_config_entry(registry: Enti- tyReg- istry, con- fig_entry_id: str) → list[RegistryEntry] Return entries that match a config entry. homeassistant.helpers.entity_registry.async_entries_for_device(registry: Enti- tyRegistry, de- vice_id: str, in- clude_disabled_entities: bool = False) → list[RegistryEntry] Return entries that match a device.

116 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.entity_registry.async_get(hass: homeassis- tant.core.HomeAssistant) → homeassis- tant.helpers.entity_registry.EntityRegistry Get entity registry. async homeassistant.helpers.entity_registry.async_get_registry(hass: home- assis- tant.core.HomeAssistant) → homeassis- tant.helpers.entity_registry.EntityRegistry Get entity registry. This is deprecated and will be removed in the future. Use async_get instead. async homeassistant.helpers.entity_registry.async_load(hass: homeassis- tant.core.HomeAssistant) → None Load entity registry. async homeassistant.helpers.entity_registry.async_migrate_entries(hass: HomeAssis- tant, con- fig_entry_id: str, en- try_callback: Callable[[RegistryEntry], dict | None]) → None Migrator of unique IDs. homeassistant.helpers.entity_registry.async_setup_entity_restore(hass: homeassis- tant.core.HomeAssistant, registry: homeassis- tant.helpers.entity_registry.EntityRegistry) → None Set up the entity restore mechanism.

8.19 homeassistant.helpers.entity_values

A class to hold entity values. class homeassistant.helpers.entity_values.EntityValues(exact: dict[str, dict[str, str]] | None = None, domain: dict[str, dict[str, str]] | None = None, glob: dict[str, dict[str, str]] | None = None) Bases: object Class to store entity id based values. get(entity_id: str) → dict[str, str] Get config for an entity id.

8.19. homeassistant.helpers.entity_values 117 Home Assistant Documentation, Release 2021.10.0.dev0

8.20 homeassistant.helpers.entityfilter

Helper class to implement include/exclude of entities and domains. homeassistant.helpers.entityfilter.convert_filter(config: dict[str, list[str]]) → Callable[[str], bool] Convert the filter schema into a filter. homeassistant.helpers.entityfilter.convert_include_exclude_filter(config: dict[str, dict[str, list[str]]]) → Callable[[str], bool] Convert the include exclude filter schema into a filter. homeassistant.helpers.entityfilter.generate_filter(include_domains: list[str], include_entities: list[str], exclude_domains: list[str], exclude_entities: list[str], in- clude_entity_globs: list[str] = [], exclude_entity_globs: list[str] = []) → Callable[[str], bool] Return a function that will filter entities based on the args.

8.21 homeassistant.helpers.event

Helpers for listening to events. class homeassistant.helpers.event.SunListener(hass: HomeAssistant, job: HassJob, event: str, offset: timedelta | None, un- sub_sun: CALLBACK_TYPE | None = None, unsub_config: CALLBACK_TYPE | None = None) Bases: object Helper class to help listen to sun events. async_attach() → None Attach a sun listener. async_detach() → None Detach the sun listener. event = None hass = None job = None offset = None class homeassistant.helpers.event.TrackStates(all_states: bool, entities: set[str], do- mains: set[str]) Bases: object Class for keeping track of states being tracked. all_states: All states on the system are being tracked entities: Entities to track domains: Domains to track

118 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

all_states = None domains = None entities = None class homeassistant.helpers.event.TrackTemplate(template: Template, variables: Tem- plateVarsType, rate_limit: timedelta | None = None) Bases: object Class for keeping track of a template with variables. The template is template to calculate. The variables are variables to pass to the template. The rate_limit is a rate limit on how often the template is re-rendered. rate_limit: timedelta | None = None template = None variables = None class homeassistant.helpers.event.TrackTemplateResult(template: homeassis- tant.helpers.template.Template, last_result: Any, result: Any) Bases: object Class for result of template tracking. template The template that has changed. last_result The output from the template on the last successful run, or None if no previous successful run. result Result from the template run. This will be a string or an TemplateError if the template resulted in an error. last_result = None result = None template = None homeassistant.helpers.event.async_call_later(hass: HomeAssistant, delay: float | timedelta, action: HassJob | Callable[..., Awaitable[None] | None]) → CALL- BACK_TYPE Add a listener that is called in . homeassistant.helpers.event.async_track_entity_registry_updated_event(hass: Home- Assis- tant, en- tity_ids: str | Iter- able[str], ac- tion: Callable[[Event], Any]) → Callable[[], None]

8.21. homeassistant.helpers.event 119 Home Assistant Documentation, Release 2021.10.0.dev0

Track specific entity registry updated events indexed by entity_id. Similar to async_track_state_change_event. homeassistant.helpers.event.async_track_point_in_time(hass: HomeAssistant, ac- tion: HassJob | Callable[..., Awaitable[None] | None], point_in_time: datetime) → CALLBACK_TYPE Add a listener that fires once after a specific point in time. homeassistant.helpers.event.async_track_point_in_utc_time(hass: HomeAssis- tant, action: Has- sJob | Callable[..., Awaitable[None] | None], point_in_time: datetime) → CALL- BACK_TYPE Add a listener that fires once after a specific point in UTC time. homeassistant.helpers.event.async_track_same_state(hass: HomeAssistant, period: timedelta, action: Callable[..., Awaitable[None] | None], async_check_same_func: Callable[[str, State | None, State | None], bool], entity_ids: str | Iterable[str] = '*') → CALLBACK_TYPE Track the state of entities for a period and run an action. If async_check_func is None it use the state of orig_value. Without entity_ids we track all state changes. homeassistant.helpers.event.async_track_state_added_domain(hass: HomeAssis- tant, domains: str | Iterable[str], action: Callable[[Event], Any]) → Callable[[], None] Track state change events when an entity is added to domains. homeassistant.helpers.event.async_track_state_change(hass: HomeAssistant, en- tity_ids: str | Iterable[str], action: Callable[[str, State, State], Awaitable[None] | None], from_state: None | str | Iterable[str] = None, to_state: None | str | Iterable[str] = None) → CALLBACK_TYPE Track specific state changes. entity_ids, from_state and to_state can be string or list. Use list to match multiple. Returns a function that can be called to remove the listener. If entity_ids are not MATCH_ALL along with from_state and to_state being None, async_track_state_change_event should be used instead as it is slightly faster. Must be run within the event loop.

120 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.event.async_track_state_change_event(hass: HomeAssistant, entity_ids: str | It- erable[str], action: Callable[[Event], Any]) → Callable[[], None] Track specific state change events indexed by entity_id. Unlike async_track_state_change, async_track_state_change_event passes the full event to the callback. In order to avoid having to iterate a long list of EVENT_STATE_CHANGED and fire and create a job for each one, we keep a dict of entity ids that care about the state change events so we can do a fast dict lookup to route events. homeassistant.helpers.event.async_track_state_change_filtered(hass: homeassis- tant.core.HomeAssistant, track_states: homeassis- tant.helpers.event.TrackStates, action: Callable[[homeassistant.core.Event], Any]) → homeassis- tant.helpers.event._TrackStateChangeFiltered Track state changes with a TrackStates filter that can be updated. hass Home assistant object. track_states A TrackStates data class. action Callable to call with results. Object used to update the listeners (async_update_listeners) with a new TrackStates or cancel the tracking (async_remove). homeassistant.helpers.event.async_track_state_removed_domain(hass: Home- Assistant, do- mains: str | Iter- able[str], action: Callable[[Event], Any]) → Callable[[], None] Track state change events when an entity is removed from domains. homeassistant.helpers.event.async_track_sunrise(hass: HomeAssistant, action: Callable[(Ellipsis, None)], offset: timedelta | None = None) → CALL- BACK_TYPE Add a listener that will fire a specified offset from sunrise daily. homeassistant.helpers.event.async_track_sunset(hass: HomeAssistant, action: Callable[(Ellipsis, None)], offset: timedelta | None = None) → CALL- BACK_TYPE Add a listener that will fire a specified offset from sunset daily. homeassistant.helpers.event.async_track_template(hass: HomeAssistant, template: Tem- plate, action: Callable[[str, State | None, State | None], Awaitable[None] | None], variables: TemplateVarsType | None = None) → Callable[[], None]

8.21. homeassistant.helpers.event 121 Home Assistant Documentation, Release 2021.10.0.dev0

Add a listener that fires when a a template evaluates to ‘true’. Listen for the result of the template becoming true, or a true-like string result, such as ‘On’, ‘Open’, or ‘Yes’. If the template results in an error state when the value changes, this will be logged and not passed through. If the initial check of the template is invalid and results in an exception, the listener will still be registered but will only fire if the template result becomes true without an exception. entity_id ID of the entity that triggered the state change. old_state The old state of the entity that changed. new_state New state of the entity that changed.

hass Home assistant object. template The template to calculate. action Callable to call with results. See above for arguments. variables Variables to pass to the template.

Callable to unregister the listener. homeassistant.helpers.event.async_track_template_result(hass: HomeAssistant, track_templates: Iter- able[TrackTemplate], action: TrackTem- plateResultListener, raise_on_template_error: bool = False, strict: bool = False) → _TrackTem- plateResultInfo Add a listener that fires when the result of a template changes. The action will fire with the initial result from the template, and then whenever the output from the template changes. The template will be reevaluated if any states referenced in the last run of the template change, or if manually triggered. If the result of the evaluation is different from the previous run, the listener is passed the result. If the template results in an TemplateError, this will be returned to the listener the first time this happens but not for subsequent errors. Once the template returns to a non-error condition the result is sent to the action as usual. hass Home assistant object. track_templates An iterable of TrackTemplate. action Callable to call with results. raise_on_template_error When set to True, if there is an exception processing the template during setup, the system will raise the exception instead of setting up tracking. strict When set to True, raise on undefined variables. Info object used to unregister the listener, and refresh the template. homeassistant.helpers.event.async_track_time_change(hass: HomeAssistant, action: Callable[(Ellipsis, None)], hour: Any | None = None, minute: Any | None = None, second: Any | None = None) → CALL- BACK_TYPE Add a listener that will fire if UTC time matches a pattern.

122 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.event.async_track_time_interval(hass: HomeAssistant, action: Callable[..., Awaitable[None] | None], interval: timedelta) → CALLBACK_TYPE Add a listener that fires repetitively at every timedelta interval. homeassistant.helpers.event.async_track_utc_time_change(hass: HomeAssistant, action: Callable[..., Awaitable[None] | None], hour: Any | None = None, minute: Any | None = None, second: Any | None = None, lo- cal: bool = False) → CALLBACK_TYPE Add a listener that will fire if time matches a pattern. homeassistant.helpers.event.call_later(hass: HomeAssistant, delay: float | timedelta, action: HassJob | Callable[..., Awaitable[None] | None]) → CALLBACK_TYPE Add a listener that is called in . homeassistant.helpers.event.process_state_match(parameter: None | str | Iterable[str]) → Callable[[str | None], bool] Convert parameter to function that matches input against parameter. homeassistant.helpers.event.threaded_listener_factory(async_factory: Callable[[...], Any]) → Callable[[...], Callable[[], None]] Convert an async event helper to a threaded one. homeassistant.helpers.event.track_point_in_time(hass: HomeAssistant, action: Has- sJob | Callable[..., Awaitable[None] | None], point_in_time: datetime) → CALLBACK_TYPE Add a listener that fires once after a specific point in time. homeassistant.helpers.event.track_point_in_utc_time(hass: HomeAssistant, ac- tion: HassJob | Callable[..., Awaitable[None] | None], point_in_time: datetime) → CALLBACK_TYPE Add a listener that fires once after a specific point in UTC time. homeassistant.helpers.event.track_same_state(hass: HomeAssistant, period: timedelta, action: Callable[..., Awaitable[None] | None], async_check_same_func: Callable[[str, State | None, State | None], bool], entity_ids: str | Iterable[str] = '*') → CALLBACK_TYPE Track the state of entities for a period and run an action. If async_check_func is None it use the state of orig_value. Without entity_ids we track all state changes. homeassistant.helpers.event.track_state_change(hass: HomeAssistant, entity_ids: str | Iterable[str], action: Callable[[str, State, State], Awaitable[None] | None], from_state: None | str | Iterable[str] = None, to_state: None | str | Iterable[str] = None) → CALLBACK_TYPE Track specific state changes.

8.21. homeassistant.helpers.event 123 Home Assistant Documentation, Release 2021.10.0.dev0

entity_ids, from_state and to_state can be string or list. Use list to match multiple. Returns a function that can be called to remove the listener. If entity_ids are not MATCH_ALL along with from_state and to_state being None, async_track_state_change_event should be used instead as it is slightly faster. Must be run within the event loop. homeassistant.helpers.event.track_sunrise(hass: HomeAssistant, action: Callable[(Ellipsis, None)], offset: timedelta | None = None) → CALLBACK_TYPE Add a listener that will fire a specified offset from sunrise daily. homeassistant.helpers.event.track_sunset(hass: HomeAssistant, action: Callable[(Ellipsis, None)], offset: timedelta | None = None) → CALLBACK_TYPE Add a listener that will fire a specified offset from sunset daily. homeassistant.helpers.event.track_template(hass: HomeAssistant, template: Template, ac- tion: Callable[[str, State | None, State | None], Awaitable[None] | None], variables: Templat- eVarsType | None = None) → Callable[[], None] Add a listener that fires when a a template evaluates to ‘true’. Listen for the result of the template becoming true, or a true-like string result, such as ‘On’, ‘Open’, or ‘Yes’. If the template results in an error state when the value changes, this will be logged and not passed through. If the initial check of the template is invalid and results in an exception, the listener will still be registered but will only fire if the template result becomes true without an exception. entity_id ID of the entity that triggered the state change. old_state The old state of the entity that changed. new_state New state of the entity that changed.

hass Home assistant object. template The template to calculate. action Callable to call with results. See above for arguments. variables Variables to pass to the template.

Callable to unregister the listener. homeassistant.helpers.event.track_time_change(hass: HomeAssistant, action: Callable[(Ellipsis, None)], hour: Any | None = None, minute: Any | None = None, second: Any | None = None) → CALLBACK_TYPE Add a listener that will fire if UTC time matches a pattern. homeassistant.helpers.event.track_time_interval(hass: HomeAssistant, action: Callable[..., Awaitable[None] | None], interval: timedelta) → CALL- BACK_TYPE Add a listener that fires repetitively at every timedelta interval.

124 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.event.track_utc_time_change(hass: HomeAssistant, action: Callable[..., Awaitable[None] | None], hour: Any | None = None, minute: Any | None = None, second: Any | None = None, local: bool = False) → CALLBACK_TYPE Add a listener that will fire if time matches a pattern.

8.22 homeassistant.helpers.icon

Icon helper methods. homeassistant.helpers.icon.icon_for_battery_level(battery_level: int | None = None, charging: bool = False) → str Return a battery icon valid identifier. homeassistant.helpers.icon.icon_for_signal_level(signal_level: int | None = None) → str Return a signal icon valid identifier.

8.23 homeassistant.helpers.integration_platform

Helpers to help with integration platforms. async homeassistant.helpers.integration_platform.async_process_integration_platforms(hass: Home- As- sis- tant, plat- form_name: str, pro- cess_platform: Callable[[HomeAssistant, str, Any], Await- able[None]]) → None Process a specific platform for all current and future loaded integrations.

8.22. homeassistant.helpers.icon 125 Home Assistant Documentation, Release 2021.10.0.dev0

8.24 homeassistant.helpers.intent

Module to coordinate user intentions. class homeassistant.helpers.intent.Intent(hass: HomeAssistant, platform: str, intent_type: str, slots: _SlotsType, text_input: str | None, context: Context) Bases: object Hold the intent. context create_response() → homeassistant.helpers.intent.IntentResponse Create a response. hass intent_type platform slots text_input exception homeassistant.helpers.intent.IntentError Bases: homeassistant.exceptions.HomeAssistantError Base class for intent related errors. exception homeassistant.helpers.intent.IntentHandleError Bases: homeassistant.helpers.intent.IntentError Error while handling intent. class homeassistant.helpers.intent.IntentHandler Bases: object Intent handler registration. async_can_handle(intent_obj: homeassistant.helpers.intent.Intent) → bool Test if an intent can be handled. async async_handle(intent_obj: homeassistant.helpers.intent.Intent) → homeassis- tant.helpers.intent.IntentResponse Handle the intent. async_validate_slots(slots: Dict[str, Any]) → Dict[str, Any] Validate slot information. intent_type: str | None = None platforms: Iterable[str] | None = [] slot_schema: vol.Schema | None = None class homeassistant.helpers.intent.IntentResponse(intent: Intent | None = None) Bases: object Response to an intent. as_dict() → dict[str, dict[str, dict[str, Any]]] Return a dictionary representation of an intent response.

126 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async_set_card(title: str, content: str, card_type: str = 'simple') → None Set speech response. async_set_speech(speech: str, speech_type: str = 'plain', extra_data: Any | None = None) → None Set speech response. exception homeassistant.helpers.intent.IntentUnexpectedError Bases: homeassistant.helpers.intent.IntentError Unexpected error while handling intent. exception homeassistant.helpers.intent.InvalidSlotInfo Bases: homeassistant.helpers.intent.IntentError When the slot data is invalid. class homeassistant.helpers.intent.ServiceIntentHandler(intent_type: str, domain: str, service: str, speech: str) Bases: homeassistant.helpers.intent.IntentHandler Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id. async async_handle(intent_obj: homeassistant.helpers.intent.Intent) → homeassis- tant.helpers.intent.IntentResponse Handle the hass intent. slot_schema: vol.Schema | None = {'name': } exception homeassistant.helpers.intent.UnknownIntent Bases: homeassistant.helpers.intent.IntentError When the intent is not registered. async homeassistant.helpers.intent.async_handle(hass: HomeAssistant, platform: str, in- tent_type: str, slots: _SlotsType | None = None, text_input: str | None = None, context: Context | None = None) → In- tentResponse Handle an intent. homeassistant.helpers.intent.async_match_state(hass: HomeAssistant, name: str, states: Iterable[State] | None = None) → State Find a state that matches the name. homeassistant.helpers.intent.async_register(hass: homeassistant.core.HomeAssistant, handler: homeassis- tant.helpers.intent.IntentHandler) → None Register an intent with Home Assistant. homeassistant.helpers.intent.async_test_feature(state: homeassistant.core.State, fea- ture: int, feature_name: str) → None Test if state supports a feature.

8.24. homeassistant.helpers.intent 127 Home Assistant Documentation, Release 2021.10.0.dev0

8.25 homeassistant.helpers.json

Helpers to help with encoding Home Assistant objects in JSON. class homeassistant.helpers.json.ExtendedJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, de- fault=None) Bases: homeassistant.helpers.json.JSONEncoder JSONEncoder that supports Home Assistant objects and falls back to repr(o). default(o: Any) → Any Convert certain objects. Fall back to repr(o). class homeassistant.helpers.json.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separa- tors=None, default=None) Bases: json.encoder.JSONEncoder JSONEncoder that supports Home Assistant objects. default(o: Any) → Any Convert Home Assistant objects. Hand other objects to the original method.

8.26 homeassistant.helpers.location

Location helpers for Home Assistant. homeassistant.helpers.location.closest(latitude: float, longitude: float, states: Iter- able[State]) → State | None Return closest state to point. Async friendly. homeassistant.helpers.location.find_coordinates(hass: HomeAssistant, entity_id: str, re- cursion_history: list | None = None) → str | None Find the gps coordinates of the entity in the form of ‘90.000,180.000’. homeassistant.helpers.location.has_location(state: homeassistant.core.State) → bool Test if state contains a valid location. Async friendly.

128 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

8.27 homeassistant.helpers.logging

Helpers for logging allowing more advanced logging styles to be used. class homeassistant.helpers.logging.KeywordMessage(fmt: Any, args: Any, kwargs: Map- ping[str, Any]) Bases: object Represents a logging message with keyword arguments. Adapted from: https://stackoverflow.com/a/24683360/2267718 class homeassistant.helpers.logging.KeywordStyleAdapter(logger: logging.Logger, extra: Mapping[str, Any] | None = None) Bases: logging.LoggerAdapter Represents an adapter wrapping the logger allowing KeywordMessages. log(level: int, msg: Any, *args: Any, **kwargs: Any) → None Log the message provided at the appropriate level. process(msg: Any, kwargs: MutableMapping[str, Any]) → tuple[Any, MutableMapping[str, Any]] Process the keyword args in preparation for logging.

8.28 homeassistant.helpers.network

Network helpers. exception homeassistant.helpers.network.NoURLAvailableError Bases: homeassistant.exceptions.HomeAssistantError An URL to the Home Assistant instance is not available. homeassistant.helpers.network.get_url(hass: homeassistant.core.HomeAssistant, *, re- quire_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, allow_internal: bool = True, allow_external: bool = True, allow_cloud: bool = True, allow_ip: bool = True, prefer_external: bool = False, prefer_cloud: bool = False) → str Get a URL to this instance. homeassistant.helpers.network.is_internal_request(hass: homeassis- tant.core.HomeAssistant) → bool Test if the current request is internal.

8.27. homeassistant.helpers.logging 129 Home Assistant Documentation, Release 2021.10.0.dev0

8.29 homeassistant.helpers.restore_state

Support for restoring entity states on startup. class homeassistant.helpers.restore_state.RestoreEntity Bases: homeassistant.helpers.entity.Entity Mixin class for restoring previous entity state. async async_get_last_state() → State | None Get the entity state from the previous run. async async_internal_added_to_hass() → None Register this entity as a restorable entity. async async_internal_will_remove_from_hass() → None Run when entity will be removed from hass. entity_description = None class homeassistant.helpers.restore_state.RestoreStateData(hass: homeassis- tant.core.HomeAssistant) Bases: object Helper class for managing the helper saved data. async async_dump_states() → None Save the current state machine to storage. async static async_get_instance(hass: homeassistant.core.HomeAssistant) → homeassis- tant.helpers.restore_state.RestoreStateData Get the singleton instance of this data helper. async_get_stored_states() → list[StoredState] Get the set of states which should be stored. This includes the states of all registered entities, as well as the stored states from the previous run, which have not been created as entities on this run, and have not expired. async_restore_entity_added(entity_id: str) → None Store this entity’s state when hass is shutdown. async_restore_entity_removed(entity_id: str) → None Unregister this entity from saving state. async classmethod async_save_persistent_states(hass: homeassis- tant.core.HomeAssistant) → None Dump states now. async_setup_dump(*args: Any) → None Set up the restore state listeners. class homeassistant.helpers.restore_state.StoredState(state: homeassis- tant.core.State, last_seen: datetime.datetime) Bases: object Object to represent a stored state. as_dict() → dict[str, Any] Return a dict representation of the stored state.

130 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

classmethod from_dict(json_dict: dict) → homeassistant.helpers.restore_state.StoredState Initialize a stored state from a dict.

8.30 homeassistant.helpers.script

Helpers to execute scripts. class homeassistant.helpers.script.Script(hass: HomeAssistant, sequence: Se- quence[dict[str, Any]], name: str, domain: str, *, running_description: str | None = None, change_listener: Callable[..., Any] | None = None, script_mode: str = 'single', max_runs: int = 10, max_exceeded: str = 'WARNING', logger: logging.Logger | None = None, log_exceptions: bool = True, top_level: bool = True, variables: ScriptVariables | None = None) Bases: object Representation of a script. async async_run(run_variables: _VarsType | None = None, context: Context | None = None, started_action: Callable[..., Any] | None = None) → None Run script. async async_stop(update_state: bool = True, spare: _ScriptRun | None = None) → None Stop running script. property change_listener Return the change_listener. property is_running Return true if script is on. property referenced_areas Return a set of referenced areas. property referenced_devices Return a set of referenced devices. property referenced_entities Return a set of referenced entities. run(variables: _VarsType | None = None, context: Context | None = None) → None Run script. property runs Return the number of current runs. property supports_max Return true if the current mode support max. update_logger(logger: logging.Logger | None = None) → None Update logger. homeassistant.helpers.script.action_trace_append(variables, path) Append a TraceElement to trace[path].

8.30. homeassistant.helpers.script 131 Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.helpers.script.async_validate_action_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any]) → Dict[str, Any] Validate config. async homeassistant.helpers.script.async_validate_actions_config(hass: Home- Assistant, actions: list[ConfigType]) → list[ConfigType] Validate a list of actions. homeassistant.helpers.script.breakpoint_clear(hass, key, run_id, node) Clear a breakpoint. homeassistant.helpers.script.breakpoint_clear_all(hass: homeassis- tant.core.HomeAssistant) → None Clear all breakpoints. homeassistant.helpers.script.breakpoint_list(hass: HomeAssistant) → list[dict[str, Any]] List breakpoints. homeassistant.helpers.script.breakpoint_set(hass, key, run_id, node) Set a breakpoint. homeassistant.helpers.script.debug_continue(hass, key, run_id) Continue execution of a halted script. homeassistant.helpers.script.debug_step(hass, key, run_id) Single step a halted script. homeassistant.helpers.script.debug_stop(hass, key, run_id) Stop execution of a running or halted script. homeassistant.helpers.script.make_script_schema(schema, default_script_mode, ex- tra=0) Make a schema for a component that uses the script helper. homeassistant.helpers.script.trace_action(hass, script_run, stop, variables) Trace action execution.

8.31 homeassistant.helpers.service

Service calling related helpers. class homeassistant.helpers.service.ReloadServiceHelper(service_func: Callable[[homeassistant.core.ServiceCall], collec- tions.abc.Awaitable]) Bases: object Helper for reload services to minimize unnecessary reloads.

132 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async execute_service(service_call: homeassistant.core.ServiceCall) → None Execute the service. If a previous reload task if currently in progress, wait for it to finish first. Once the previous reload task has finished, one of the waiting tasks will be assigned to execute the reload, the others will wait for the reload to finish. class homeassistant.helpers.service.SelectedEntities(referenced: set[str] = , indirectly_referenced: set[str] = , miss- ing_devices: set[str] = , missing_areas: set[str] = , refer- enced_devices: set[str] = ) Bases: object Class to hold the selected entities. indirectly_referenced = None log_missing(missing_entities: set[str]) → None Log about missing items. missing_areas = None missing_devices = None referenced = None referenced_devices = None class homeassistant.helpers.service.ServiceParams Bases: dict Type for service call parameters. domain = None service = None service_data = None target = None class homeassistant.helpers.service.ServiceTargetSelector(service_call: homeassis- tant.core.ServiceCall) Bases: object Class to hold a target selector for a service. property has_any_selector Determine if any selectors are present. async homeassistant.helpers.service.async_call_from_config(hass: HomeAssistant, config: ConfigType, blocking: bool = False, variables: TemplateVarsType = None, validate_config: bool = True, context: Context | None = None) → None

8.31. homeassistant.helpers.service 133 Home Assistant Documentation, Release 2021.10.0.dev0

Call a service based on a config hash. async homeassistant.helpers.service.async_extract_config_entry_ids(hass: home- assis- tant.core.HomeAssistant, ser- vice_call: home- assis- tant.core.ServiceCall, ex- pand_group: bool = True) → set Extract referenced config entry ids from a service call. async homeassistant.helpers.service.async_extract_entities(hass: HomeAs- sistant, entities: Iterable[Entity], service_call: Service- Call, expand_group: bool = True) → list[Entity] Extract a list of entity objects from a service call. Will convert group entity ids to the entity ids it represents. async homeassistant.helpers.service.async_extract_entity_ids(hass: HomeAssis- tant, service_call: ServiceCall, ex- pand_group: bool = True) → set[str] Extract a set of entity ids from a service call. Will convert group entity ids to the entity ids it represents.

134 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.helpers.service.async_extract_referenced_entity_ids(hass: home- as- sis- tant.core.HomeAssistant, ser- vice_call: home- as- sis- tant.core.ServiceCall, ex- pand_group: bool = True) → home- as- sis- tant.helpers.service.SelectedEntities Extract referenced entity IDs from a service call. async homeassistant.helpers.service.async_get_all_descriptions(hass: Home- Assistant) → dict[str, dict[str, Any]] Return descriptions (i.e. user documentation) for all service calls. homeassistant.helpers.service.async_prepare_call_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], vari- ables: Op- tional[Mapping[str, Any]] = None, val- idate_config: bool = False) → homeassis- tant.helpers.service.ServiceParams Prepare to call a service based on a config hash. homeassistant.helpers.service.async_register_admin_service(hass: HomeAssistant, domain: str, ser- vice: str, service_func: Callable[[ServiceCall], Awaitable | None], schema: vol.Schema = ) → None Register a service that requires admin access.

8.31. homeassistant.helpers.service 135 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.service.async_set_service_schema(hass: HomeAssistant, do- main: str, service: str, schema: dict[str, Any]) → None Register a description for a service. homeassistant.helpers.service.call_from_config(hass: homeassis- tant.core.HomeAssistant, config: Dict[str, Any], blocking: bool = False, variables: Optional[Mapping[str, Any]] = None, validate_config: bool = True) → None Call a service based on a config hash. async homeassistant.helpers.service.entity_service_call(hass: HomeAssis- tant, platforms: Iter- able[EntityPlatform], func: str | Callable[..., Any], call: ServiceCall, required_features: Iter- able[int] | None = None) → None Handle an entity service call. Calls all platforms simultaneously. homeassistant.helpers.service.extract_entity_ids(hass: HomeAssistant, service_call: ServiceCall, expand_group: bool = True) → set[str] Extract a list of entity ids from a service call. Will convert group entity ids to the entity ids it represents. homeassistant.helpers.service.verify_domain_control(hass: homeassis- tant.core.HomeAssistant, domain: str) → Callable[[Callable[[homeassistant.core.ServiceCall], Any]], Callable[[homeassistant.core.ServiceCall], Any]] Ensure permission to access any entity under domain in service call.

8.32 homeassistant.helpers.signal

Signal handling related helpers. homeassistant.helpers.signal.async_register_signal_handling(hass: homeassis- tant.core.HomeAssistant) → None Register system signal handler for core.

136 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

8.33 homeassistant.helpers.state

Helpers that help with state related things. class homeassistant.helpers.state.AsyncTrackStates(hass: homeassis- tant.core.HomeAssistant) Bases: object Record the time when the with-block is entered. Add all states that have changed since the start time to the return list when with-block is exited. Must be run within the event loop. Deprecated. Remove after June 2021. Warning added via get_changed_since. async homeassistant.helpers.state.async_reproduce_state(hass: HomeAssistant, states: State | Iter- able[State], *, context: Context | None = None, re- produce_options: dict[str, Any] | None = None) → None Reproduce a list of states on multiple domains. homeassistant.helpers.state.get_changed_since(states: Iterable[State], utc_point_in_time: dt.datetime) → list[State] Return list of states that have been changed since utc_point_in_time. Deprecated. Remove after June 2021. homeassistant.helpers.state.state_as_number(state: homeassistant.core.State) → float Try to coerce our state to a number. Raises ValueError if this is not possible.

8.34 homeassistant.helpers.storage

Helper to help store data. class homeassistant.helpers.storage.Store(hass: HomeAssistant, version: int, key: str, private: bool = False, *, encoder: type[JSONEncoder] | None = None) Bases: object Class to help storing data. async_delay_save(data_func: Callable[[], dict], delay: float = 0) → None Save data with an optional delay. async async_load() → dict | list | None Load data. If the expected version does not match the given version, the migrate function will be invoked with await migrate_func(version, config). Will ensure that when a call comes in while another one is in progress, the second call will wait and return the result of the first call.

8.33. homeassistant.helpers.state 137 Home Assistant Documentation, Release 2021.10.0.dev0

async async_remove() → None Remove all data. async async_save(data: dict | list) → None Save data. property path Return the config path. async homeassistant.helpers.storage.async_migrator(hass, old_path, store, *, old_conf_load_func=None, old_conf_migrate_func=None) Migrate old data to a store and then load data. async def old_conf_migrate_func(old_data)

8.35 homeassistant.helpers.sun

Helpers for sun events. homeassistant.helpers.sun.get_astral_event_date(hass: HomeAssistant, event: str, date: datetime.date | datetime.datetime | None = None) → datetime.datetime | None Calculate the astral event time for the specified date. homeassistant.helpers.sun.get_astral_event_next(hass: HomeAssistant, event: str, utc_point_in_time: datetime.datetime | None = None, offset: date- time.timedelta | None = None) → datetime.datetime Calculate the next specified solar event. homeassistant.helpers.sun.get_astral_location(hass: HomeAssistant) → tu- ple[astral.location.Location, as- tral.Elevation] Get an astral location for the current Home Assistant configuration. homeassistant.helpers.sun.get_location_astral_event_next(location: as- tral.location.Location, elevation: as- tral.Elevation, event: str, utc_point_in_time: datetime.datetime | None = None, offset: datetime.timedelta | None = None) → datetime.datetime Calculate the next specified solar event. homeassistant.helpers.sun.is_up(hass: HomeAssistant, utc_point_in_time: datetime.datetime | None = None) → bool Calculate if the sun is currently up.

138 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

8.36 homeassistant.helpers.system_info

Helper to gather system info. async homeassistant.helpers.system_info.async_get_system_info(hass: HomeAssis- tant) → dict[str, Any] Return info about the system.

8.37 homeassistant.helpers.temperature

Temperature helpers for Home Assistant. homeassistant.helpers.temperature.display_temp(hass: HomeAssistant, temperature: float | None, unit: str, precision: float) → float | None Convert temperature into preferred units/precision for display.

8.38 homeassistant.helpers.template

Template helper methods for rendering strings with Home Assistant data. class homeassistant.helpers.template.AllStates(hass: homeassis- tant.core.HomeAssistant) Bases: object Class to expose all HA states as attributes. class homeassistant.helpers.template.DomainStates(hass: homeassis- tant.core.HomeAssistant, domain: str) Bases: object Class to expose a specific HA domain as attributes. class homeassistant.helpers.template.LoggingUndefined(hint: Optional[str] = None, obj: Any = missing, name: Optional[str] = None, exc: Type[jinja2.exceptions.TemplateRuntimeError] = ) Bases: jinja2.runtime.Undefined Log on undefined variables. class homeassistant.helpers.template.RenderInfo(template: homeassis- tant.helpers.template.Template) Bases: object Holds information about a template render. result() → str Results of the template computation. class homeassistant.helpers.template.ResultWrapper Bases: object Result wrapper class to store render result.

8.36. homeassistant.helpers.system_info 139 Home Assistant Documentation, Release 2021.10.0.dev0

render_result = None class homeassistant.helpers.template.Template(template, hass=None) Bases: object Class to hold a template and manage caching and rendering. async_render(variables: Optional[Mapping[str, Any]] = None, parse_result: bool = True, limited: bool = False, strict: bool = False, **kwargs: Any) → Any Render given template. This method must be run in the event loop. If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine. async_render_to_info(variables: Optional[Mapping[str, Any]] = None, strict: bool = False, **kwargs: Any) → homeassistant.helpers.template.RenderInfo Render the template and collect an entity filter. async async_render_will_timeout(timeout: float, variables: Optional[Mapping[str, Any]] = None, strict: bool = False, **kwargs: Any) → bool Check to see if rendering a template will timeout during render. This is intended to check for expensive templates that will make the system unstable. The template is rendered in the executor to ensure it does not tie up the event loop. This function is not a security control and is only intended to be used as a safety check when testing templates. This method must be run in the event loop. async_render_with_possible_json_value(value, error_value=, vari- ables=None) Render template with value exposed. If valid JSON will expose value_json too. This method must be run in the event loop. ensure_valid() → None Return if template is valid. hass is_static render(variables: Optional[Mapping[str, Any]] = None, parse_result: bool = True, limited: bool = False, **kwargs: Any) → Any Render given template. If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine. render_with_possible_json_value(value, error_value=) Render template with value exposed. If valid JSON will expose value_json too. template class homeassistant.helpers.template.TemplateEnvironment(hass, limited=False, strict=False) Bases: jinja2.sandbox.ImmutableSandboxedEnvironment The Home Assistant template environment.

140 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

compile(source, name=None, filename=None, raw=False, defer_init=False) Compile the template. is_safe_attribute(obj, attr, value) Test if attribute is safe. is_safe_callable(obj) Test if callback is safe. class homeassistant.helpers.template.TemplateState(hass: homeassis- tant.core.HomeAssistant, state: homeassistant.core.State, collect: bool = True) Bases: homeassistant.core.State Class to represent a state object in a template. property attributes Wrap State.attributes. property context Wrap State.context. property domain Wrap State.domain. property entity_id Wrap State.entity_id. Intentionally does not collect state property last_changed Wrap State.last_changed. property last_updated Wrap State.last_updated. property name Wrap State.name. property object_id Wrap State.object_id. property state Wrap State.state. property state_with_unit Return the state concatenated with the unit if available. class homeassistant.helpers.template.TupleWrapper(value: tuple, *, render_result: str | None = None) Bases: tuple, homeassistant.helpers.template.ResultWrapper Wrap a tuple. render_result = None homeassistant.helpers.template.arc_cosine(value) Filter to get arc cosine of the value. homeassistant.helpers.template.arc_sine(value) Filter to get arc sine of the value. homeassistant.helpers.template.arc_tangent(value) Filter to get arc tangent of the value.

8.38. homeassistant.helpers.template 141 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.template.arc_tangent2(*args) Filter to calculate four quadrant arc tangent of y / x. homeassistant.helpers.template.area_id(hass: HomeAssistant, lookup_value: str) → str | None Get the area ID from an area name, device id, or entity id. homeassistant.helpers.template.area_name(hass: HomeAssistant, lookup_value: str) → str | None Get the area name from an area id, device id, or entity id. homeassistant.helpers.template.attach(hass: homeassistant.core.HomeAssistant, obj: Any) → None Recursively attach hass to all template instances in list and dict. homeassistant.helpers.template.base64_decode(value) Perform base64 denode. homeassistant.helpers.template.base64_encode(value) Perform base64 encode. homeassistant.helpers.template.bitwise_and(first_value, second_value) Perform a bitwise and operation. homeassistant.helpers.template.bitwise_or(first_value, second_value) Perform a bitwise or operation. homeassistant.helpers.template.closest(hass, *args) Find closest entity. Closest to home: closest(states) closest(states.device_tracker) closest(‘group.children’) clos- est(states.group.children) Closest to a point: closest(23.456, 23.456, ‘group.children’) closest(‘zone.school’, ‘group.children’) clos- est(states.zone.school, ‘group.children’) As a filter: states | closest states.device_tracker | closest [‘group.children’, states.device_tracker] | closest ‘group.children’ | closest(23.456, 23.456) states.device_tracker | closest(‘zone.school’) ‘group.children’ | closest(states.zone.school) homeassistant.helpers.template.closest_filter(hass, *args) Call closest as a filter. Need to reorder arguments. homeassistant.helpers.template.cosine(value) Filter to get cosine of the value. homeassistant.helpers.template.device_attr(hass: homeassistant.core.HomeAssistant, de- vice_or_entity_id: str, attr_name: str) → Any Get the device specific attribute. homeassistant.helpers.template.device_entities(hass: HomeAssistant, _device_id: str) → Iterable[str] Get entity ids for entities tied to a device. homeassistant.helpers.template.device_id(hass: HomeAssistant, entity_id_or_device_name: str) → str | None Get a device ID from an entity ID or device name. homeassistant.helpers.template.distance(hass, *args) Calculate distance. Will calculate distance from home to a point or between points. Points can be passed in using state objects or lat/lng coordinates.

142 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.template.expand(hass: HomeAssistant, *args: Any) → Iterable[State] Expand out any groups into entity states. homeassistant.helpers.template.fail_when_undefined(value) Filter to force a failure when the value is undefined. homeassistant.helpers.template.forgiving_as_timestamp(value) Try to convert value to timestamp. homeassistant.helpers.template.forgiving_float(value) Try to convert value to a float. homeassistant.helpers.template.forgiving_round(value, precision=0, method='common') Round accepted strings. homeassistant.helpers.template.from_json(value) Convert a JSON string to an object. homeassistant.helpers.template.gen_result_wrapper(kls) Generate a result wrapper. homeassistant.helpers.template.is_complex(value: Any) → bool Test if data structure is a complex template. homeassistant.helpers.template.is_device_attr(hass: homeassistant.core.HomeAssistant, device_or_entity_id: str, attr_name: str, attr_value: Any) → bool Test if a device’s attribute is a specific value. homeassistant.helpers.template.is_number(value) Try to convert value to a float. homeassistant.helpers.template.is_state(hass: homeassistant.core.HomeAssistant, en- tity_id: str, state: homeassistant.core.State) → bool Test if a state is a specific value. homeassistant.helpers.template.is_state_attr(hass: homeassistant.core.HomeAssistant, entity_id: str, name: str, value: Any) → bool Test if a state’s attribute is a specific value. homeassistant.helpers.template.is_template_string(maybe_template: str) → bool Check if the input is a Jinja2 template. homeassistant.helpers.template.logarithm(value, base=2.718281828459045) Filter to get logarithm of the value with a specific base. homeassistant.helpers.template.multiply(value, amount) Filter to convert value to float and multiply it. homeassistant.helpers.template.now(hass: homeassistant.core.HomeAssistant) → date- time.datetime Record fetching now. homeassistant.helpers.template.ordinal(value) Perform ordinal conversion. homeassistant.helpers.template.random_every_time(context, values) Choose a random value. Unlike Jinja’s random filter, this is context-dependent to avoid caching the chosen value. homeassistant.helpers.template.regex_findall(value, find='', ignorecase=False) Find all matches using regex.

8.38. homeassistant.helpers.template 143 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.template.regex_findall_index(value, find='', index=0, ignore- case=False) Find all matches using regex and then pick specific match index. homeassistant.helpers.template.regex_match(value, find='', ignorecase=False) Match value using regex. homeassistant.helpers.template.regex_replace(value='', find='', replace='', ignore- case=False) Replace using regex. homeassistant.helpers.template.regex_search(value, find='', ignorecase=False) Search using regex. homeassistant.helpers.template.relative_time(value) Take a datetime and return its “age” as a string. The age can be in second, minute, hour, day, month or year. Only the biggest unit is considered, e.g. if it’s 2 days and 3 hours, “2 days” will be returned. Make sure date is not in the future, or else it will return None. If the input are not a datetime object the input will be returned unmodified. homeassistant.helpers.template.render_complex(value: Any, variables: Op- tional[Mapping[str, Any]] = None, limited: bool = False) → Any Recursive template creator helper function. homeassistant.helpers.template.result_as_boolean(template_result: str | None) → bool Convert the template result to a boolean. True/not 0/’1’/’true’/’yes’/’on’/’enable’ are considered truthy False/0/None/’0’/’false’/’no’/’off’/’disable’ are considered falsy homeassistant.helpers.template.sine(value) Filter to get sine of the value. homeassistant.helpers.template.square_root(value) Filter to get square root of the value. homeassistant.helpers.template.state_attr(hass: homeassistant.core.HomeAssistant, en- tity_id: str, name: str) → Any Get a specific attribute from a state. homeassistant.helpers.template.strptime(string, fmt) Parse a time string to datetime. homeassistant.helpers.template.tangent(value) Filter to get tangent of the value. homeassistant.helpers.template.timestamp_custom(value, date_format='%Y-%m-%d %H:%M:%S', local=True) Filter to convert given timestamp to format. homeassistant.helpers.template.timestamp_local(value) Filter to convert given timestamp to local date/time. homeassistant.helpers.template.timestamp_utc(value) Filter to convert given timestamp to UTC date/time. homeassistant.helpers.template.to_json(value) Convert an object to a JSON string. homeassistant.helpers.template.urlencode(value) Urlencode dictionary and return as UTF-8 string.

144 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.helpers.template.utcnow(hass: homeassistant.core.HomeAssistant) → date- time.datetime Record fetching utcnow.

8.39 homeassistant.helpers.translation

Translation string lookup helpers. async homeassistant.helpers.translation.async_get_component_strings(hass: Home- Assis- tant, lan- guage: str, com- ponents: set[str]) → dict[str, Any] Load translations. async homeassistant.helpers.translation.async_get_translations(hass: Home- Assistant, language: str, category: str, integration: str | None = None, config_flow: bool | None = None) → dict[str, Any] Return all backend translations. If integration specified, load it for that one. Otherwise default to loaded intgrations combined with config flow integrations if config_flow is true. homeassistant.helpers.translation.component_translation_path(component: str, language: str, integration: Inte- gration) → str | None Return the translation json file location for a component. For component: • components/hue/translations/nl.json For platform: • components/hue/translations/light.nl.json If component is just a single file, will return None. homeassistant.helpers.translation.load_translations_files(translation_files: dict[str, str]) → dict[str, dict[str, Any]] Load and parse translation.json files.

8.39. homeassistant.helpers.translation 145 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.translation.recursive_flatten(prefix: Any, data: dict[str, Any]) → dict[str, Any] Return a flattened representation of dict data.

8.40 homeassistant.helpers.typing

Typing Helpers for Home Assistant. class homeassistant.helpers.typing.UndefinedType Bases: enum.Enum Singleton type for use with not set sentinel values.

8.41 homeassistant.helpers.update_coordinator

Helpers to help coordinate updates. class homeassistant.helpers.update_coordinator.CoordinatorEntity(coordinator: homeassis- tant.helpers.update_coordinator.DataUpdateCoordinator[~T][T]) Bases: typing.Generic, homeassistant.helpers.entity.Entity A class for entities using DataUpdateCoordinator. async async_added_to_hass() → None When entity is added to hass. async async_update() → None Update the entity. Only used by the generic entity update service. property available Return if entity is available. entity_description = None property should_poll No need to poll. Coordinator notifies entity of updates.

146 Chapter 8. homeassistant.helpers Home Assistant Documentation, Release 2021.10.0.dev0 class homeassistant.helpers.update_coordinator.DataUpdateCoordinator(hass: Home- Assis- tant, logger: log- ging.Logger, *, name: str, up- date_interval: timedelta | None = None, up- date_method: Callable[[], Await- able[T]] | None = None, re- quest_refresh_debouncer: De- bouncer | None = None) Bases: typing.Generic Class to manage fetching data from single endpoint. async_add_listener(update_callback: Callable[[], None]) → Callable[[], None] Listen for data updates. async async_config_entry_first_refresh() → None Refresh data for the first time when a config entry is setup. Will automatically raise ConfigEntryNotReady if the refresh fails. Additionally logging is handled by config entry setup to ensure that multiple retries do not cause log spam. async async_refresh() → None Refresh data and log errors. async_remove_listener(update_callback: Callable[[], None]) → None Remove data update. async async_request_refresh() → None Request a refresh. Refresh will wait a bit to see if it can batch them. async_set_updated_data(data: T) → None Manually update data, notify listeners and reset refresh interval. exception homeassistant.helpers.update_coordinator.UpdateFailed Bases: Exception

8.41. homeassistant.helpers.update_coordinator 147 Home Assistant Documentation, Release 2021.10.0.dev0

Raised when an update has failed.

148 Chapter 8. homeassistant.helpers CHAPTER NINE

HOMEASSISTANT.LOADER

The methods for loading Home Assistant integrations. This module has quite some complex parts. I have tried to add as much documentation as possible to keep it under- standable. exception homeassistant.loader.CircularDependency(from_domain: str, to_domain: str) Raised when a circular dependency is found when resolving components. class homeassistant.loader.Components(hass: HomeAssistant) Helper to load components. class homeassistant.loader.Helpers(hass: HomeAssistant) Helper to load helpers. class homeassistant.loader.Integration(hass: HomeAssistant, pkg_path: str, file_path: path- lib.Path, manifest: Manifest) An integration in Home Assistant. property after_dependencies Return after_dependencies. property all_dependencies Return all dependencies including sub-dependencies. property all_dependencies_resolved Return if all dependencies have been resolved. property config_flow Return config_flow. property dependencies Return dependencies. property dhcp Return Integration dhcp entries. property disabled Return reason integration is disabled. property documentation Return documentation. property domain Return domain. get_component() → module Return the component.

149 Home Assistant Documentation, Release 2021.10.0.dev0

get_platform(platform_name: str) → module Return a platform for an integration. property homekit Return Integration homekit entries. property iot_class Return the integration IoT Class. property is_built_in Test if package is a built-in integration. property issue_tracker Return issue tracker link. property mqtt Return Integration MQTT entries. property name Return name. property quality_scale Return Integration Quality Scale. property requirements Return requirements. async resolve_dependencies() → bool Resolve all dependencies. classmethod resolve_from_root(hass: HomeAssistant, root_module: ModuleType, domain: str) → Integration | None Resolve an integration from a root module. property ssdp Return Integration SSDP entries. property Return Integration usb entries. property version Return the version of the integration. property zeroconf Return Integration zeroconf entries. exception homeassistant.loader.IntegrationNotFound(domain: str) Raised when a component is not found. exception homeassistant.loader.LoaderError Loader base error. class homeassistant.loader.Manifest Integration manifest. Note that none of the attributes are marked Optional here. However, some of them may be optional in mani- fest.json in the sense that they can be omitted altogether. But when present, they should not have null values in it. class homeassistant.loader.ModuleWrapper(hass: HomeAssistant, module: ModuleType) Class to wrap a Python module and auto fill in hass argument. async homeassistant.loader.async_get_config_flows(hass: HomeAssistant) → set[str] Return cached list of config flows.

150 Chapter 9. homeassistant.loader Home Assistant Documentation, Release 2021.10.0.dev0

async homeassistant.loader.async_get_custom_components(hass: HomeAssistant) → dict[str, Integration] Return cached list of custom integrations. async homeassistant.loader.async_get_dhcp(hass: HomeAssistant) → list[dict[str, str]] Return cached list of dhcp types. async homeassistant.loader.async_get_homekit(hass: HomeAssistant) → dict[str, str] Return cached list of homekit models. async homeassistant.loader.async_get_integration(hass: HomeAssistant, domain: str) → Integration Get an integration. async homeassistant.loader.async_get_mqtt(hass: HomeAssistant) → dict[str, list[str]] Return cached list of MQTT mappings. async homeassistant.loader.async_get_ssdp(hass: HomeAssistant) → dict[str, list[dict[str, str]]] Return cached list of ssdp mappings. async homeassistant.loader.async_get_usb(hass: HomeAssistant) → list[dict[str, str]] Return cached list of usb types. async homeassistant.loader.async_get_zeroconf(hass: HomeAssistant) → dict[str, list[dict[str, str]]] Return cached list of zeroconf types. homeassistant.loader.bind_hass(func: CALLABLE_T) → CALLABLE_T Decorate function to indicate that first argument is hass. homeassistant.loader.manifest_from_legacy_module(domain: str, module: module) → homeassistant.loader.Manifest Generate a manifest from a legacy module.

151 Home Assistant Documentation, Release 2021.10.0.dev0

152 Chapter 9. homeassistant.loader CHAPTER TEN

HOMEASSISTANT.UTIL

Helper methods for various modules. class homeassistant.util.OrderedEnum Bases: enum.Enum Taken from Python 3.4.0 docs. class homeassistant.util.Throttle(min_time: timedelta, limit_no_throttle: timedelta | None = None) Bases: object A class for throttling the execution of tasks. This method decorator adds a cooldown to a method to prevent it from being called more then 1 time within the timedelta interval min_time after it returned its result. Calling a method a second time during the interval will return None. Pass keyword argument no_throttle=True to the wrapped method to make the call not throttled. Decorator takes in an optional second timedelta interval to throttle the ‘no_throttle’ calls. Adds a datetime attribute last_call to the method. homeassistant.util.convert(value: T | None, to_type: Callable[[T], U], default: U | None = None) → U | None Convert value to to_type, returns default if fails. homeassistant.util.ensure_unique_string(preferred_string: str, current_strings: Iterable[str] | KeysView[str]) → str Return a string that is not present in current_strings. If preferred string exists will append _2, _3, .. homeassistant.util.get_local_ip Try to determine the local IP address of the machine. homeassistant.util.get_random_string(length: int = 10) → str Return a random string with letters and digits. homeassistant.util.raise_if_invalid_filename(filename: str) → None Check if a filename is valid. Raises a ValueError if the filename is invalid. homeassistant.util.raise_if_invalid_path(path: str) → None Check if a path is valid. Raises a ValueError if the path is invalid.

153 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.util.repr_helper(inp: Any) → str Help creating a more readable string representation of objects. homeassistant.util.sanitize_filename(filename: str) → str Check if a filename is safe. Only to be used to compare to original filename to check if changed. If result changed, the given path is not safe and should not be used, raise an error. DEPRECATED. homeassistant.util.sanitize_path(path: str) → str Check if a path is safe. Only to be used to compare to original path to check if changed. If result changed, the given path is not safe and should not be used, raise an error. DEPRECATED. homeassistant.util.slugify(text: str | None, *, separator: str = '_') → str Slugify a given text.

10.1 homeassistant.util.yaml

YAML utility functions. class homeassistant.util.yaml.Input(name: str) Bases: object Input that should be substituted. classmethod from_node(loader: yaml.loader.Loader, node: yaml.nodes.Node) → homeassis- tant.util.yaml.objects.Input Create a new placeholder from a node. name: str = None homeassistant.util.yaml.dump(_dict: dict) → str Dump YAML to a string and remove null. homeassistant.util.yaml.save_yaml(path: str, data: dict) → None Save YAML to a file. class homeassistant.util.yaml.Secrets(config_dir: pathlib.Path) Bases: object Store secrets while loading YAML. get(requester_path: str, secret: str) → str Return the value of a secret. homeassistant.util.yaml.load_yaml(fname: str, secrets: Secrets | None = None) → JSON_TYPE Load a YAML file. homeassistant.util.yaml.secret_yaml(loader: homeassistant.util.yaml.loader.SafeLineLoader, node: yaml.nodes.Node) → Union[list, dict, str] Load secrets and embed it into the configuration YAML. homeassistant.util.yaml.parse_yaml(content: str | TextIO, secrets: Secrets | None = None) → JSON_TYPE Load a YAML file.

154 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0 exception homeassistant.util.yaml.UndefinedSubstitution(input_name: str) Bases: Exception Error raised when we find a substitution that is not defined. homeassistant.util.yaml.extract_inputs(obj: Any) → set[str] Extract input from a structure. homeassistant.util.yaml.substitute(obj: Any, substitutions: dict[str, Any]) → Any Substitute values.

10.2 homeassistant.util.aiohttp

Utilities to help with aiohttp. class homeassistant.util.aiohttp.MockRequest(content: bytes, mock_source: str, method: str = 'GET', status: int = 200, headers: dict[str, str] | None = None, query_string: str | None = None, url: str = '') Bases: object Mock an aiohttp request. property content Return the body as text. async json() → Any Return the body as JSON. mock_source: str | None = None async post() → multidict._multidict.MultiDict Return POST parameters. property query Return a dictionary with the query variables. async text() → str Return the body as text. class homeassistant.util.aiohttp.MockStreamReader(content: bytes) Bases: object Small mock to imitate stream reader. async read(byte_count: int = -1) → bytes Read bytes.

10.3 homeassistant.util.async_

Asyncio utilities. homeassistant.util.async_.check_loop() → None Warn if called inside the event loop.

10.2. homeassistant.util.aiohttp 155 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.util.async_.fire_coroutine_threadsafe(coro: collec- tions.abc.Coroutine, loop: asyn- cio.events.AbstractEventLoop) → None Submit a coroutine object to a given event loop. This method does not provide a way to retrieve the result and is intended for fire-and-forget use. This reduces the work involved to fire the function on the loop. async homeassistant.util.async_.gather_with_concurrency(limit: int, *tasks: Any, return_exceptions: bool = False) → Any Wrap asyncio.gather to limit the number of concurrent tasks. From: https://stackoverflow.com/a/61478547/9127614 homeassistant.util.async_.protect_loop(func: Callable) → Callable Protect function from running in event loop. homeassistant.util.async_.run_callback_threadsafe(loop: AbstractEventLoop, callback: Callable[..., T], *args: Any) → concurrent.futures.Future[T] Submit a callback object to a given event loop. Return a concurrent.futures.Future to access the result. homeassistant.util.async_.shutdown_run_callback_threadsafe(loop: asyn- cio.events.AbstractEventLoop) → None Call when run_callback_threadsafe should prevent creating new futures. We must finish all callbacks before the executor is shutdown or we can end up in a deadlock state where: executor.result() is waiting for its ._condition and the executor shutdown is trying to .join() the executor thread. This function is considered irreversible and should only ever be called when Home Assistant is going to shut- down and python is going to exit.

10.4 homeassistant.util.color

Color util methods. class homeassistant.util.color.GamutType(red: homeassistant.util.color.XYPoint, green: homeassistant.util.color.XYPoint, blue: homeas- sistant.util.color.XYPoint) Bases: object Represents the Gamut of a light. blue: XYPoint = None green: XYPoint = None red: XYPoint = None class homeassistant.util.color.RGBColor Bases: tuple RGB hex values. b Alias for field number 2

156 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0

g Alias for field number 1 r Alias for field number 0 class homeassistant.util.color.XYPoint(x: float, y: float) Bases: object Represents a CIE 1931 XY coordinate pair. x: float = None y: float = None homeassistant.util.color.check_point_in_lamps_reach(p: tuple[float, float], Gamut: GamutType) → bool Check if the provided XYPoint can be recreated by a Hue lamp. homeassistant.util.color.check_valid_gamut(Gamut: homeassistant.util.color.GamutType) → bool Check if the supplied gamut is valid. homeassistant.util.color.color_RGB_to_hs(iR: float, iG: float, iB: float) → tuple[float, float] Convert an rgb color to its hs representation. homeassistant.util.color.color_RGB_to_hsv(iR: float, iG: float, iB: float) → tuple[float, float, float] Convert an rgb color to its hsv representation. Hue is scaled 0-360 Sat is scaled 0-100 Val is scaled 0-100 homeassistant.util.color.color_RGB_to_xy(iR: int, iG: int, iB: int, Gamut: GamutType | None = None) → tuple[float, float] Convert from RGB color to XY color. homeassistant.util.color.color_RGB_to_xy_brightness(iR: int, iG: int, iB: int, Gamut: GamutType | None = None) → tuple[float, float, int] Convert from RGB color to XY color. homeassistant.util.color.color_hs_to_RGB(iH: float, iS: float) → tuple[int, int, int] Convert an hsv color into its rgb representation. homeassistant.util.color.color_hs_to_xy(iH: float, iS: float, Gamut: GamutType | None = None) → tuple[float, float] Convert an hs color to its xy representation. homeassistant.util.color.color_hsb_to_RGB(fH: float, fS: float, fB: float) → tuple[int, int, int] Convert a hsb into its rgb representation. homeassistant.util.color.color_hsv_to_RGB(iH: float, iS: float, iV: float) → tuple[int, int, int] Convert an hsv color into its rgb representation. Hue is scaled 0-360 Sat is scaled 0-100 Val is scaled 0-100 homeassistant.util.color.color_name_to_rgb(color_name: str) → homeassis- tant.util.color.RGBColor Convert color name to RGB hex value. homeassistant.util.color.color_rgb_to_hex(r: int, g: int, b: int) → str Return a RGB color from a hex color string. homeassistant.util.color.color_rgb_to_rgbw(r: int, g: int, b: int) → tuple[int, int, int, int] Convert an rgb color to an rgbw representation.

10.4. homeassistant.util.color 157 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.util.color.color_rgb_to_rgbww(r: int, g: int, b: int, min_mireds: int, max_mireds: int) → tuple[int, int, int, int, int] Convert an rgb color to an rgbww representation. homeassistant.util.color.color_rgbw_to_rgb(r: int, g: int, b: int, w: int) → tuple[int, int, int] Convert an rgbw color to an rgb representation. homeassistant.util.color.color_rgbww_to_rgb(r: int, g: int, b: int, cw: int, ww: int, min_mireds: int, max_mireds: int) → tu- ple[int, int, int] Convert an rgbww color to an rgb representation. homeassistant.util.color.color_temperature_kelvin_to_mired(kelvin_temperature: float) → int Convert degrees kelvin to mired shift. homeassistant.util.color.color_temperature_mired_to_kelvin(mired_temperature: float) → int Convert absolute mired shift to degrees kelvin. homeassistant.util.color.color_temperature_to_hs(color_temperature_kelvin: float) → tuple[float, float] Return an hs color from a color temperature in Kelvin. homeassistant.util.color.color_temperature_to_rgb(color_temperature_kelvin: float) → tuple[float, float, float] Return an RGB color from a color temperature in Kelvin. This is a rough approximation based on the formula provided by T. Helland http://www.tannerhelland.com/ 4435/convert-temperature-rgb-algorithm-code/ homeassistant.util.color.color_xy_brightness_to_RGB(vX: float, vY: float, ibrightness: int, Gamut: GamutType | None = None) → tuple[int, int, int] Convert from XYZ to RGB. homeassistant.util.color.color_xy_to_RGB(vX: float, vY: float, Gamut: GamutType | None = None) → tuple[int, int, int] Convert from XY to a normalized RGB. homeassistant.util.color.color_xy_to_hs(vX: float, vY: float, Gamut: GamutType | None = None) → tuple[float, float] Convert an xy color to its hs representation. homeassistant.util.color.cross_product(p1: homeassistant.util.color.XYPoint, p2: homeas- sistant.util.color.XYPoint) → float Calculate the cross product of two XYPoints. homeassistant.util.color.get_closest_point_to_line(A: homeassis- tant.util.color.XYPoint, B: home- assistant.util.color.XYPoint, P: homeassistant.util.color.XYPoint) → homeassis- tant.util.color.XYPoint Find the closest point from P to a line defined by A and B. This point will be reproducible by the lamp as it is on the edge of the gamut. homeassistant.util.color.get_closest_point_to_point(xy_tuple: tuple[float, float], Gamut: GamutType) → tu- ple[float, float]

158 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0

Get the closest matching color within the gamut of the light. Should only be used if the supplied color is outside of the color gamut. homeassistant.util.color.get_distance_between_two_points(one: homeassis- tant.util.color.XYPoint, two: homeassis- tant.util.color.XYPoint) → float Calculate the distance between two XYPoints. homeassistant.util.color.rgb_hex_to_rgb_list(hex_string: str) → list[int] Return an RGB color value list from a hex color string.

10.5 homeassistant.util.decorator

Decorator utility functions. class homeassistant.util.decorator.Registry Bases: dict Registry of items. register(name: collections.abc.Hashable) → Callable[[CALLABLE_T], CALLABLE_T] Return decorator to register item with a specific name.

10.6 homeassistant.util.distance

Distance util functions. homeassistant.util.distance.convert(value: float, unit_1: str, unit_2: str) → float Convert one unit of measurement to another.

10.7 homeassistant.util.dt

Helper methods to handle the time in Home Assistant. homeassistant.util.dt.as_local(dattim: datetime.datetime) → datetime.datetime Convert a UTC datetime object to local time zone. homeassistant.util.dt.as_timestamp(dt_value: dt.datetime | str) → float Convert a date/time into a unix time (seconds since 1970). homeassistant.util.dt.as_utc(dattim: datetime.datetime) → datetime.datetime Return a datetime as UTC time. Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE. homeassistant.util.dt.find_next_time_expression_time(now: dt.datetime, seconds: list[int], minutes: list[int], hours: list[int]) → dt.datetime Find the next datetime from now for which the time expression matches. The algorithm looks at each time unit separately and tries to find the next one that matches for each. If any of them would roll over, all time units below that are reset to the first matching value. Timezones are also handled (the tzinfo of the now object is used), including daylight saving time.

10.5. homeassistant.util.decorator 159 Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.util.dt.get_age(date: datetime.datetime) → str Take a datetime and return its “age” as a string. The age can be in second, minute, hour, day, month or year. Only the biggest unit is considered, e.g. if it’s 2 days and 3 hours, “2 days” will be returned. Make sure date is not in the future, or else it won’t work. homeassistant.util.dt.get_time_zone(time_zone_str: str) → dt.tzinfo | None Get time zone from string. Return None if unable to determine. Async friendly. homeassistant.util.dt.now(time_zone: dt.tzinfo | None = None) → dt.datetime Get now in specified time zone. homeassistant.util.dt.parse_date(dt_str: str) → dt.date | None Convert a date string to a date object. homeassistant.util.dt.parse_datetime(dt_str: str) → dt.datetime | None Parse a string and return a datetime.datetime. This function supports time zone offsets. When the input contains one, the output uses a timezone with a fixed offset from UTC. Raises ValueError if the input is well formatted but not a valid datetime. Returns None if the input isn’t well formatted. homeassistant.util.dt.parse_time(time_str: str) → dt.time | None Parse a time string (00:20:00) into Time object. Return None if invalid. homeassistant.util.dt.parse_time_expression(parameter: Any, min_value: int, max_value: int) → list[int] Parse the time expression part and return a list of times to match. homeassistant.util.dt.set_default_time_zone(time_zone: datetime.tzinfo) → None Set a default time zone to be used when none is specified. Async friendly. homeassistant.util.dt.start_of_local_day(dt_or_d: dt.date | dt.datetime | None = None) → dt.datetime Return local datetime object of start of day from date or datetime. homeassistant.util.dt.utc_from_timestamp(timestamp: float) → datetime.datetime Return a UTC time from a timestamp. homeassistant.util.dt.utcnow() → datetime.datetime Get now in UTC time.

10.8 homeassistant.util.json

JSON utility functions. exception homeassistant.util.json.SerializationError Bases: homeassistant.exceptions.HomeAssistantError Error serializing the data to JSON. exception homeassistant.util.json.WriteError Bases: homeassistant.exceptions.HomeAssistantError Error writing the data.

160 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0

homeassistant.util.json.find_paths_unserializable_data(bad_data: Any, *, dump: Callable[[Any], str] = ) → dict[str, Any] Find the paths to unserializable data. This method is slow! Only use for error handling. homeassistant.util.json.format_unserializable_data(data: dict[str, Any]) → str Format output of find_paths in a friendly way. Format is comma separated: =() homeassistant.util.json.load_json(filename: str, default: list | dict | None = None) → list | dict Load JSON data from a file and return as dict or list. Defaults to returning empty dict if file is not found. homeassistant.util.json.save_json(filename: str, data: list | dict, private: bool = False, *, en- coder: type[json.JSONEncoder] | None = None) → None Save JSON data to a file. Returns True on success.

10.9 homeassistant.util.location

Module with location helpers. detect_location_info and elevation are mocked by default during tests. class homeassistant.util.location.LocationInfo(ip, country_code, currency, region_code, region_name, city, zip_code, time_zone, latitude, longitude, use_metric) Bases: tuple city Alias for field number 5 country_code Alias for field number 1 currency Alias for field number 2 ip Alias for field number 0 latitude Alias for field number 8 longitude Alias for field number 9 region_code Alias for field number 3 region_name Alias for field number 4 time_zone Alias for field number 7

10.9. homeassistant.util.location 161 Home Assistant Documentation, Release 2021.10.0.dev0

use_metric Alias for field number 10 zip_code Alias for field number 6 async homeassistant.util.location.async_detect_location_info(session: aio- http.ClientSession) → LocationInfo | None Detect location information. homeassistant.util.location.distance(lat1: float | None, lon1: float | None, lat2: float, lon2: float) → float | None Calculate the distance in meters between two points. Async friendly. homeassistant.util.location.vincenty(point1: tuple[float, float], point2: tuple[float, float], miles: bool = False) → float | None Vincenty formula (inverse method) to calculate the distance. Result in kilometers or miles between two points on the surface of a spheroid. Async friendly.

10.10 homeassistant.util.logging

Logging utilities. class homeassistant.util.logging.HideSensitiveDataFilter(text: str) Bases: logging.Filter Filter API password calls. filter(record: logging.LogRecord) → bool Hide sensitive data in messages. class homeassistant.util.logging.HomeAssistantQueueHandler(queue) Bases: logging.handlers.QueueHandler Process the log in another thread. handle(record: logging.LogRecord) → Any Conditionally emit the specified logging record. Depending on which filters have been added to the handler, push the new records onto the backing Queue. The default python logger Handler acquires a lock in the parent class which we do not need as Simple- Queue is already thread safe. See https://bugs.python.org/issue24645 homeassistant.util.logging.async_activate_log_queue_handler(hass: homeassis- tant.core.HomeAssistant) → None Migrate the existing log handlers to use the queue. This allows us to avoid blocking I/O and formatting messages in the event loop as log messages are written in another thread.

162 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.util.logging.async_create_catching_coro(target: collec- tions.abc.Coroutine) → collections.abc.Coroutine Wrap a coroutine to catch and log exceptions. The exception will be logged together with a stacktrace of where the coroutine was wrapped. target: target coroutine. homeassistant.util.logging.catch_log_coro_exception(target: Coroutine[Any, Any, Any], format_err: Callable[..., Any], *args: Any) → Corou- tine[Any, Any, Any] Decorate a coroutine to catch and log exceptions. homeassistant.util.logging.catch_log_exception(func: Callable[..., Any], format_err: Callable[..., Any], *args: Any) → Callable[(Ellipsis, None)] | Callable[..., Awaitable[None]] Decorate a callback to catch and log exceptions. homeassistant.util.logging.log_exception(format_err: Callable[[...], Any], *args: Any) → None Log an exception with additional context.

10.11 homeassistant.util.network

Network utilities. homeassistant.util.network.is_invalid(address: IPv4Address | IPv6Address) → bool Check if an address is invalid. homeassistant.util.network.is_ip_address(address: str) → bool Check if a given string is an IP address. homeassistant.util.network.is_link_local(address: IPv4Address | IPv6Address) → bool Check if an address is link local. homeassistant.util.network.is_local(address: IPv4Address | IPv6Address) → bool Check if an address is loopback or private. homeassistant.util.network.is_loopback(address: IPv4Address | IPv6Address) → bool Check if an address is a loopback address. homeassistant.util.network.is_private(address: IPv4Address | IPv6Address) → bool Check if an address is a private address. homeassistant.util.network.normalize_url(address: str) → str Normalize a given URL.

10.11. homeassistant.util.network 163 Home Assistant Documentation, Release 2021.10.0.dev0

10.12 homeassistant.util.package

Helpers to install PyPi packages. async homeassistant.util.package.async_get_user_site(deps_dir: str) → str Return user local library path. This function is a coroutine. homeassistant.util.package.install_package(package: str, upgrade: bool = True, target: str | None = None, constraints: str | None = None, find_links: str | None = None, timeout: int | None = None, no_cache_dir: bool | None = False) → bool Install a package on PyPi. Accepts pip compatible package strings. Return boolean if install successful. homeassistant.util.package.is_docker_env() → bool Return True if we run in a docker env. homeassistant.util.package.is_installed(package: str) → bool Check if a package is installed and will be loaded when we import it. Returns True when the requirement is met. Returns False when the package is not installed or doesn’t meet req. homeassistant.util.package.is_virtual_env() → bool Return if we run in a virtual environment.

10.13 homeassistant.util.pil

PIL utilities. Can only be used by integrations that have pillow in their requirements. homeassistant.util.pil.draw_box(draw: ImageDraw, box: tuple[float, float, float, float], img_width: int, img_height: int, text: str = '', color: tuple[int, int, int] = (255, 255, 0)) → None Draw a bounding box on and image. The bounding box is defined by the tuple (y_min, x_min, y_max, x_max) where the coordinates are floats in the range [0.0, 1.0] and relative to the width and height of the image. For example, if an image is 100 x 200 pixels (height x width) and the bounding box is (0.1, 0.2, 0.5, 0.9), the upper-left and bottom-right coordinates of the bounding box will be (40, 10) to (180, 50) (in (x,y) coordinates).

10.14 homeassistant.util.pressure

Pressure util functions. homeassistant.util.pressure.convert(value: float, unit_1: str, unit_2: str) → float Convert one unit of measurement to another.

164 Chapter 10. homeassistant.util Home Assistant Documentation, Release 2021.10.0.dev0

10.15 homeassistant.util.ssl

Helper to create SSL contexts. homeassistant.util.ssl.client_context() → ssl.SSLContext Return an SSL context for making requests. homeassistant.util.ssl.server_context_intermediate() → ssl.SSLContext Return an SSL context following the Mozilla recommendations. TLS configuration follows the best-practice guidelines specified here: https://wiki.mozilla.org/Security/Server_ Side_TLS Intermediate guidelines are followed. homeassistant.util.ssl.server_context_modern() → ssl.SSLContext Return an SSL context following the Mozilla recommendations. TLS configuration follows the best-practice guidelines specified here: https://wiki.mozilla.org/Security/Server_ Side_TLS Modern guidelines are followed.

10.16 homeassistant.util.temperature

Temperature util functions. homeassistant.util.temperature.celsius_to_fahrenheit(celsius: float, interval: bool = False) → float Convert a temperature in Celsius to Fahrenheit. homeassistant.util.temperature.celsius_to_kelvin(celsius: float, interval: bool = False) → float Convert a temperature in Celsius to Fahrenheit. homeassistant.util.temperature.convert(temperature: float, from_unit: str, to_unit: str, inter- val: bool = False) → float Convert a temperature from one unit to another. homeassistant.util.temperature.fahrenheit_to_celsius(fahrenheit: float, interval: bool = False) → float Convert a temperature in Fahrenheit to Celsius. homeassistant.util.temperature.kelvin_to_celsius(kelvin: float, interval: bool = False) → float Convert a temperature in Kelvin to Celsius.

10.17 homeassistant.util.unit_system

Unit system helper class and methods. class homeassistant.util.unit_system.UnitSystem(name: str, temperature: str, length: str, volume: str, mass: str, pressure: str) Bases: object A container for units of measure. as_dict() → dict[str, str] Convert the unit system to a dictionary. property is_metric Determine if this is the metric unit system.

10.15. homeassistant.util.ssl 165 Home Assistant Documentation, Release 2021.10.0.dev0

length(length: float | None, from_unit: str) → float Convert the given length to this unit system. pressure(pressure: float | None, from_unit: str) → float Convert the given pressure to this unit system. temperature(temperature: float, from_unit: str) → float Convert the given temperature to this unit system. volume(volume: float | None, from_unit: str) → float Convert the given volume to this unit system. homeassistant.util.unit_system.is_valid_unit(unit: str, unit_type: str) → bool Check if the unit is valid for it’s type.

10.18 homeassistant.util.volume

Volume conversion util functions. homeassistant.util.volume.convert(volume: float, from_unit: str, to_unit: str) → float Convert a temperature from one unit to another. homeassistant.util.volume.cubic_feet_to_cubic_meter(cubic_feet: float) → float Convert a volume measurement in cubic feet to cubic meter. homeassistant.util.volume.cubic_meter_to_cubic_feet(cubic_meter: float) → float Convert a volume measurement in cubic meter to cubic feet. homeassistant.util.volume.gallon_to_liter(gallon: float) → float Convert a volume measurement in Gallon to Liter. homeassistant.util.volume.liter_to_gallon(liter: float) → float Convert a volume measurement in Liter to Gallon.

166 Chapter 10. homeassistant.util CHAPTER ELEVEN

INDICES AND TABLES

• genindex • modindex • search

167 Home Assistant Documentation, Release 2021.10.0.dev0

168 Chapter 11. Indices and tables PYTHON MODULE INDEX

h homeassistant.helpers.check_config, 82 homeassistant.auth,3 homeassistant.helpers.collection, 82 homeassistant.auth.auth_store,5 homeassistant.helpers.condition, 85 homeassistant.auth.const,6 homeassistant.helpers.config_entry_flow, homeassistant.auth.models,7 89 homeassistant.bootstrap,9 homeassistant.helpers.config_entry_oauth2_flow, homeassistant.components.air_quality, 91 11 homeassistant.helpers.config_validation, homeassistant.components.alarm_control_panel, 95 12 homeassistant.helpers.data_entry_flow, homeassistant.components.binary_sensor, 99 15 homeassistant.helpers.debounce, 99 homeassistant.components.calendar, 22 homeassistant.helpers.deprecation, 100 homeassistant.components.camera, 17 homeassistant.helpers.device_registry, homeassistant.components.climate, 23 100 homeassistant.components.conversation, homeassistant.helpers.discovery, 104 27 homeassistant.helpers.dispatcher, 105 homeassistant.components.cover, 28 homeassistant.helpers.entity, 106 homeassistant.components.device_tracker, homeassistant.helpers.entity_component, 30 111 homeassistant.components.fan, 30 homeassistant.helpers.entity_platform, homeassistant.components.light, 34 112 homeassistant.components.lock, 37 homeassistant.helpers.entity_registry, homeassistant.components.media_player, 114 38 homeassistant.helpers.entity_values, 117 homeassistant.components.notify, 45 homeassistant.helpers.entityfilter, 118 homeassistant.components.remote, 46 homeassistant.helpers.event, 118 homeassistant.components.sensor, 49 homeassistant.helpers.icon, 125 homeassistant.components.switch, 47 homeassistant.helpers.integration_platform, homeassistant.components.vacuum, 50 125 homeassistant.components.water_heater, homeassistant.helpers.intent, 126 53 homeassistant.helpers.json, 128 homeassistant.components.weather, 56 homeassistant.helpers.location, 128 homeassistant.components.webhook, 58 homeassistant.helpers.logging, 129 homeassistant.config_entries, 61 homeassistant.helpers.network, 129 homeassistant.core, 67 homeassistant.helpers.restore_state, 130 homeassistant.data_entry_flow, 75 homeassistant.helpers.script, 131 homeassistant.exceptions, 77 homeassistant.helpers.service, 132 homeassistant.helpers, 79 homeassistant.helpers.signal, 136 homeassistant.helpers.aiohttp_client, homeassistant.helpers.state, 137 79 homeassistant.helpers.storage, 137 homeassistant.helpers.area_registry, 80 homeassistant.helpers.sun, 138

169 Home Assistant Documentation, Release 2021.10.0.dev0 homeassistant.helpers.system_info, 139 homeassistant.helpers.temperature, 139 homeassistant.helpers.template, 139 homeassistant.helpers.translation, 145 homeassistant.helpers.typing, 146 homeassistant.helpers.update_coordinator, 146 homeassistant.loader, 149 homeassistant.util, 153 homeassistant.util.aiohttp, 155 homeassistant.util.async_, 155 homeassistant.util.color, 156 homeassistant.util.decorator, 159 homeassistant.util.distance, 159 homeassistant.util.dt, 159 homeassistant.util.json, 160 homeassistant.util.location, 161 homeassistant.util.logging, 162 homeassistant.util.network, 163 homeassistant.util.package, 164 homeassistant.util.pil, 164 homeassistant.util.pressure, 164 homeassistant.util.ssl, 165 homeassistant.util.temperature, 165 homeassistant.util.unit_system, 165 homeassistant.util.volume, 166 homeassistant.util.yaml, 154

170 Python Module Index INDEX

A air_quality_index() (homeassis- AbortFlow, 75 tant.components.air_quality.AirQualityEntity AbstractOAuth2FlowHandler (class in homeas- property), 11 sistant.helpers.config_entry_oauth2_flow), 91 AirQualityEntity (class in homeassis- AbstractOAuth2Implementation (class in home- tant.components.air_quality), 11 assistant.helpers.config_entry_oauth2_flow), alarm_arm_away() (homeassis- 92 tant.components.alarm_control_panel.AlarmControlPanelEntity access_token() (homeassis- method), 12 tant.components.media_player.MediaPlayerEntityalarm_arm_custom_bypass() (homeassis- property), 39 tant.components.alarm_control_panel.AlarmControlPanelEntity access_token_expiration (homeassis- method), 12 tant.auth.models.RefreshToken attribute), alarm_arm_home() (homeassis- 7 tant.components.alarm_control_panel.AlarmControlPanelEntity action_trace_append() (in module homeassis- method), 12 tant.helpers.script), 131 alarm_arm_night() (homeassis- activity_list() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.components.remote.RemoteEntity prop- method), 12 erty), 46 alarm_arm_vacation() (homeassis- add_collection() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.helpers.collection.IDManager method), method), 12 83 alarm_disarm() (homeassis- add_entities() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.helpers.entity_platform.EntityPlatform method), 12 method), 112 alarm_trigger() (homeassis- add_error() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.helpers.check_config.HomeAssistantConfig method), 13 method), 82 AlarmControlPanel (class in homeassis- add_job() (homeassistant.core.HomeAssistant tant.components.alarm_control_panel), 12 method), 69 AlarmControlPanelEntity (class in homeassis- add_to_platform_abort() (homeassis- tant.components.alarm_control_panel), 12 tant.helpers.entity.Entity method), 106 AlarmControlPanelEntityDescription add_to_platform_finish() (homeassis- (class in homeassis- tant.helpers.entity.Entity method), 106 tant.components.alarm_control_panel), 13 add_to_platform_start() (homeassis- all() (homeassistant.core.StateMachine method), 72 tant.helpers.entity.Entity method), 106 all_dependencies() (homeassis- add_update_listener() (homeassis- tant.loader.Integration property), 149 tant.config_entries.ConfigEntry method), all_dependencies_resolved() (homeassis- 63 tant.loader.Integration property), 149 AddEntitiesCallback (class in homeassis- all_states (homeassistant.helpers.event.TrackStates tant.helpers.entity_platform), 112 attribute), 118 after_dependencies() (homeassis- AllStates (class in homeassistant.helpers.template), tant.loader.Integration property), 149 139

171 Home Assistant Documentation, Release 2021.10.0.dev0 app_id() (homeassis- tant.config_entries.ConfigFlow method), tant.components.media_player.MediaPlayerEntity 63 property), 39 async_abort() (homeassis- app_name() (homeassis- tant.data_entry_flow.FlowHandler method), tant.components.media_player.MediaPlayerEntity 75 property), 39 async_abort() (homeassis- apply_default() (homeassis- tant.data_entry_flow.FlowManager method), tant.components.light.Profiles method), 35 75 apply_profile() (homeassis- async_activate_log_queue_handler() (in tant.components.light.Profiles method), 35 module homeassistant.util.logging), 162 arc_cosine() (in module homeassis- async_activate_user() (homeassis- tant.helpers.template), 141 tant.auth.auth_store.AuthStore method), arc_sine() (in module homeassis- 5 tant.helpers.template), 141 async_activate_user() (homeassis- arc_tangent() (in module homeassis- tant.auth.AuthManager method),3 tant.helpers.template), 141 async_add() (homeassis- arc_tangent2() (in module homeassis- tant.config_entries.ConfigEntries method), tant.helpers.template), 141 61 area_id (homeassistant.helpers.device_registry.DeviceEntryasync_add_change_set_listener() (homeas- attribute), 101 sistant.helpers.collection.ObservableCollection area_id (homeassistant.helpers.entity_registry.RegistryEntry method), 83 attribute), 115 async_add_entities() (homeassis- area_id() (in module homeassis- tant.helpers.entity_platform.EntityPlatform tant.helpers.template), 142 method), 113 area_name() (in module homeassis- async_add_executor_job() (homeassis- tant.helpers.template), 142 tant.core.HomeAssistant method), 69 AreaEntry (class in homeassis- async_add_hass_job() (homeassis- tant.helpers.area_registry), 80 tant.core.HomeAssistant method), 69 AreaRegistry (class in homeassis- async_add_implementation_provider() tant.helpers.area_registry), 81 (in module homeassis- as_dict() (homeassis- tant.helpers.config_entry_oauth2_flow), tant.components.media_player.BrowseMedia 94 method), 38 async_add_job() (homeassis- as_dict() (homeassistant.config_entries.ConfigEntry tant.core.HomeAssistant method), 69 method), 63 async_add_listener() (homeassis- as_dict() (homeassistant.core.Config method), 67 tant.helpers.collection.ObservableCollection as_dict() (homeassistant.core.Context method), 67 method), 83 as_dict() (homeassistant.core.Event method), 68 async_add_listener() (homeassis- as_dict() (homeassistant.core.State method), 71 tant.helpers.update_coordinator.DataUpdateCoordinator as_dict() (homeassis- method), 147 tant.helpers.intent.IntentResponse method), async_added_to_hass() (homeassis- 126 tant.helpers.entity.Entity method), 106 as_dict() (homeassis- async_added_to_hass() (homeassis- tant.helpers.restore_state.StoredState method), tant.helpers.update_coordinator.CoordinatorEntity 130 method), 146 as_dict() (homeassistant.util.unit_system.UnitSystem async_aiohttp_proxy_stream() (in module method), 165 homeassistant.helpers.aiohttp_client), 79 as_local() (in module homeassistant.util.dt), 159 async_aiohttp_proxy_web() (in module home- as_timestamp() (in module homeassistant.util.dt), assistant.helpers.aiohttp_client), 79 159 async_alarm_arm_away() (homeassis- as_utc() (in module homeassistant.util.dt), 159 tant.components.alarm_control_panel.AlarmControlPanelEntity assumed_state() (homeassis- method), 13 tant.helpers.entity.Entity property), 106 async_alarm_arm_custom_bypass() (homeas- async_abort() (homeassis- sistant.components.alarm_control_panel.AlarmControlPanelEntity

172 Index Home Assistant Documentation, Release 2021.10.0.dev0

method), 13 async_check_ha_config_file() (in module async_alarm_arm_home() (homeassis- homeassistant.helpers.check_config), 82 tant.components.alarm_control_panel.AlarmControlPanelEntityasync_cleanup() (in module homeassis- method), 13 tant.helpers.device_registry), 103 async_alarm_arm_night() (homeassis- async_clear_area_id() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntitytant.helpers.device_registry.DeviceRegistry method), 13 method), 102 async_alarm_arm_vacation() (homeassis- async_clear_area_id() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntitytant.helpers.entity_registry.EntityRegistry method), 13 method), 114 async_alarm_disarm() (homeassis- async_clear_config_entry() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntitytant.helpers.device_registry.DeviceRegistry method), 13 method), 102 async_alarm_trigger() (homeassis- async_clear_config_entry() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntitytant.helpers.entity_registry.EntityRegistry method), 13 method), 114 async_all() (homeassistant.core.StateMachine async_clear_playlist() (homeassis- method), 72 tant.components.media_player.MediaPlayerEntity async_and_from_config() (in module homeassis- method), 39 tant.helpers.condition), 85 async_close_cover() (homeassis- async_attach() (homeassis- tant.components.cover.CoverEntity method), tant.helpers.event.SunListener method), 28 118 async_close_cover_tilt() (homeassis- async_available() (homeassis- tant.components.cover.CoverEntity method), tant.core.StateMachine method), 72 28 async_block_till_done() (homeassis- async_config_entry_disabled_by_changed() tant.core.HomeAssistant method), 69 (in module homeassis- async_browse_media() (homeassis- tant.helpers.device_registry), 103 tant.components.media_player.MediaPlayerEntityasync_config_entry_disabled_by_changed() method), 39 (in module homeassis- async_call() (homeassistant.core.ServiceRegistry tant.helpers.entity_registry), 116 method), 70 async_config_entry_first_refresh() async_call() (homeassis- (homeassistant.helpers.update_coordinator.DataUpdateCoordinator tant.helpers.debounce.Debouncer method), method), 147 99 async_configure() (homeassis- async_call_from_config() (in module homeas- tant.data_entry_flow.FlowManager method), sistant.helpers.service), 133 76 async_call_later() (in module homeassis- async_create() (homeassis- tant.helpers.event), 119 tant.helpers.area_registry.AreaRegistry async_camera_image() (homeassis- method), 81 tant.components.camera.Camera method), async_create_access_token() (homeassis- 17 tant.auth.AuthManager method),3 async_can_handle() (homeassis- async_create_catching_coro() (in module tant.helpers.intent.IntentHandler method), homeassistant.util.logging), 162 126 async_create_clientsession() (in module async_cancel() (homeassis- homeassistant.helpers.aiohttp_client), 80 tant.helpers.debounce.Debouncer method), async_create_entry() (homeassis- 100 tant.config_entries.ConfigFlow method), async_cancel_retry_setup() (homeassis- 63 tant.config_entries.ConfigEntry method), async_create_entry() (homeassis- 63 tant.data_entry_flow.FlowHandler method), async_cancel_retry_setup() (homeassis- 75 tant.helpers.entity_platform.EntityPlatform async_create_flow() (homeassis- method), 113 tant.auth.AuthManagerFlowManager method),

Index 173 Home Assistant Documentation, Release 2021.10.0.dev0

5 async_device_from_config() (in module home- async_create_flow() (homeassis- assistant.helpers.condition), 85 tant.config_entries.ConfigEntriesFlowManager async_device_modified() (homeassis- method), 62 tant.helpers.entity_registry.EntityRegistry async_create_flow() (homeassis- method), 114 tant.config_entries.OptionsFlowManager async_device_update() (homeassis- method), 65 tant.helpers.entity.Entity method), 107 async_create_flow() (homeassis- async_disable_motion_detection() (home- tant.data_entry_flow.FlowManager method), assistant.components.camera.Camera method), 76 17 async_create_item() (homeassis- async_disable_user_mfa() (homeassis- tant.helpers.collection.StorageCollection tant.auth.AuthManager method),3 method), 84 async_discover() (in module homeassis- async_create_refresh_token() (homeas- tant.helpers.discovery), 104 sistant.auth.auth_store.AuthStore method), async_dispatcher_connect() (in module home- 5 assistant.helpers.dispatcher), 105 async_create_refresh_token() (homeassis- async_dispatcher_send() (in module homeassis- tant.auth.AuthManager method),3 tant.helpers.dispatcher), 105 async_create_system_user() (homeassis- async_domains() (homeassis- tant.auth.AuthManager method),3 tant.config_entries.ConfigEntries method), async_create_task() (homeassis- 61 tant.core.HomeAssistant method), 69 async_dump_states() (homeassis- async_create_user() (homeassis- tant.helpers.restore_state.RestoreStateData tant.auth.auth_store.AuthStore method), method), 130 5 async_enable_logging() (in module homeassis- async_create_user() (homeassis- tant.bootstrap),9 tant.auth.AuthManager method),3 async_enable_motion_detection() (homeas- async_deactivate_user() (homeassis- sistant.components.camera.Camera method), tant.auth.auth_store.AuthStore method), 17 6 async_enable_user_mfa() (homeassis- async_deactivate_user() (homeassis- tant.auth.AuthManager method),3 tant.auth.AuthManager method),3 async_ensure_token_valid() (homeassis- async_decrease_speed() (homeassis- tant.helpers.config_entry_oauth2_flow.OAuth2Session tant.components.fan.FanEntity method), method), 93 30 async_entity_ids() (homeassis- async_delay_save() (homeassis- tant.core.StateMachine method), 72 tant.helpers.storage.Store method), 137 async_entity_ids_count() (homeassis- async_delete() (homeassis- tant.core.StateMachine method), 72 tant.helpers.area_registry.AreaRegistry async_entries() (homeassis- method), 81 tant.config_entries.ConfigEntries method), async_delete_command() (homeassis- 61 tant.components.remote.RemoteEntity method), async_entries_for_area() (in module homeas- 46 sistant.helpers.device_registry), 103 async_delete_item() (homeassis- async_entries_for_area() (in module homeas- tant.helpers.collection.StorageCollection sistant.helpers.entity_registry), 116 method), 84 async_entries_for_config_entry() (in mod- async_destroy() (homeassis- ule homeassistant.helpers.device_registry), 103 tant.helpers.entity_platform.EntityPlatform async_entries_for_config_entry() (in mod- method), 113 ule homeassistant.helpers.entity_registry), 116 async_detach() (homeassis- async_entries_for_device() (in module home- tant.helpers.event.SunListener method), assistant.helpers.entity_registry), 116 118 async_external_step() (homeassis- async_detect_location_info() (in module tant.data_entry_flow.FlowHandler method), homeassistant.util.location), 162 75

174 Index Home Assistant Documentation, Release 2021.10.0.dev0 async_external_step_done() (homeassis- async_generate_entity_id() (in module home- tant.data_entry_flow.FlowHandler method), assistant.helpers.entity), 110 75 async_generate_id() (in module homeassis- async_extract_config_entry_ids() (in mod- tant.components.webhook), 58 ule homeassistant.helpers.service), 134 async_generate_path() (in module homeassis- async_extract_devices() (in module homeassis- tant.components.webhook), 58 tant.helpers.condition), 85 async_generate_url() (in module homeassis- async_extract_entities() (in module homeas- tant.components.webhook), 58 sistant.helpers.condition), 85 async_get() (homeassis- async_extract_entities() (in module homeas- tant.helpers.device_registry.DeviceRegistry sistant.helpers.service), 134 method), 102 async_extract_entity_ids() (in module home- async_get() (homeassis- assistant.helpers.service), 134 tant.helpers.entity_registry.EntityRegistry async_extract_from_service() (homeassis- method), 114 tant.helpers.entity_component.EntityComponent async_get() (in module homeassis- method), 111 tant.helpers.area_registry), 81 async_extract_from_service() (homeassis- async_get() (in module homeassis- tant.helpers.entity_platform.EntityPlatform tant.helpers.device_registry), 104 method), 113 async_get() (in module homeassis- async_extract_referenced_entity_ids() tant.helpers.entity_registry), 116 (in module homeassistant.helpers.service), 134 async_get_all_descriptions() (in module async_finish_flow() (homeassis- homeassistant.helpers.service), 135 tant.auth.AuthManagerFlowManager method), async_get_area() (homeassis- 5 tant.helpers.area_registry.AreaRegistry async_finish_flow() (homeassis- method), 81 tant.config_entries.ConfigEntriesFlowManager async_get_area_by_name() (homeassis- method), 62 tant.helpers.area_registry.AreaRegistry async_finish_flow() (homeassis- method), 81 tant.config_entries.OptionsFlowManager async_get_browse_image() (homeassis- method), 65 tant.components.media_player.MediaPlayerEntity async_finish_flow() (homeassis- method), 39 tant.data_entry_flow.FlowManager method), async_get_clientsession() (in module home- 76 assistant.helpers.aiohttp_client), 80 async_fire() (homeassistant.core.EventBus async_get_component_strings() (in module method), 68 homeassistant.helpers.translation), 145 async_forward_entry_setup() (homeassis- async_get_config_entry_implementation() tant.config_entries.ConfigEntries method), (in module homeassis- 61 tant.helpers.config_entry_oauth2_flow), async_forward_entry_unload() (homeassis- 94 tant.config_entries.ConfigEntries method), async_get_config_flows() (in module homeas- 61 sistant.loader), 150 async_from_config() (in module homeassis- async_get_current_platform() (in module tant.helpers.condition), 86 homeassistant.helpers.entity_platform), 113 async_from_config_dict() (in module homeas- async_get_custom_components() (in module sistant.bootstrap),9 homeassistant.loader), 150 async_generate_authorize_url() (homeassis- async_get_device() (homeassis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementationtant.helpers.device_registry.DeviceRegistry method), 92 method), 102 async_generate_authorize_url() (homeassis- async_get_device_class_lookup() (home- tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementationassistant.helpers.entity_registry.EntityRegistry method), 93 method), 114 async_generate_entity_id() (homeassis- async_get_dhcp() (in module homeassis- tant.helpers.entity_registry.EntityRegistry tant.loader), 151 method), 114 async_get_enabled_mfa() (homeassis-

Index 175 Home Assistant Documentation, Release 2021.10.0.dev0

tant.auth.AuthManager method),3 tant.auth.AuthManager method),4 async_get_entity_id() (homeassis- async_get_owner() (homeassis- tant.helpers.entity_registry.EntityRegistry tant.auth.AuthManager method),4 method), 114 async_get_platforms() (in module homeassis- async_get_entry() (homeassis- tant.helpers.entity_platform), 113 tant.config_entries.ConfigEntries method), async_get_refresh_token() (homeassis- 61 tant.auth.auth_store.AuthStore method),6 async_get_events() (homeassis- async_get_refresh_token() (homeassis- tant.components.calendar.CalendarEventDevice tant.auth.AuthManager method),4 method), 22 async_get_refresh_token_by_token() async_get_group() (homeassis- (homeassistant.auth.auth_store.AuthStore tant.auth.auth_store.AuthStore method), method),6 6 async_get_refresh_token_by_token() async_get_group() (homeassis- (homeassistant.auth.AuthManager method),4 tant.auth.AuthManager method),3 async_get_registry() (in module homeassis- async_get_groups() (homeassis- tant.helpers.area_registry), 81 tant.auth.auth_store.AuthStore method), async_get_registry() (in module homeassis- 6 tant.helpers.device_registry), 104 async_get_homekit() (in module homeassis- async_get_registry() (in module homeassis- tant.loader), 151 tant.helpers.entity_registry), 117 async_get_image() (in module homeassis- async_get_ssdp() (in module homeassis- tant.components.camera), 19 tant.loader), 151 async_get_implementations() async_get_still_stream() (in module homeas- (in module homeassis- sistant.components.camera), 20 tant.helpers.config_entry_oauth2_flow), async_get_stored_states() (homeassis- 94 tant.helpers.restore_state.RestoreStateData async_get_instance() (homeassis- method), 130 tant.helpers.restore_state.RestoreStateData async_get_stream_source() (in module home- static method), 130 assistant.components.camera), 20 async_get_integration() (in module homeassis- async_get_system_info() (in module homeassis- tant.loader), 151 tant.helpers.system_info), 139 async_get_last_state() (homeassis- async_get_translations() (in module homeas- tant.helpers.restore_state.RestoreEntity sistant.helpers.translation), 145 method), 130 async_get_usb() (in module homeassistant.loader), async_get_media_image() (homeassis- 151 tant.components.media_player.MediaPlayerEntityasync_get_user() (homeassis- method), 39 tant.auth.auth_store.AuthStore method), async_get_mjpeg_stream() (in module homeas- 6 sistant.components.camera), 19 async_get_user() (homeassis- async_get_mqtt() (in module homeassis- tant.auth.AuthManager method),4 tant.loader), 151 async_get_user_by_credentials() (homeas- async_get_options_flow() (homeassis- sistant.auth.AuthManager method),4 tant.config_entries.ConfigFlow static method), async_get_user_site() (in module homeassis- 63 tant.util.package), 164 async_get_or_create() (homeassis- async_get_users() (homeassis- tant.helpers.area_registry.AreaRegistry tant.auth.auth_store.AuthStore method), method), 81 6 async_get_or_create() (homeassis- async_get_users() (homeassis- tant.helpers.device_registry.DeviceRegistry tant.auth.AuthManager method),4 method), 102 async_get_zeroconf() (in module homeassis- async_get_or_create() (homeassis- tant.loader), 151 tant.helpers.entity_registry.EntityRegistry async_handle() (homeassis- method), 114 tant.helpers.intent.IntentHandler method), async_get_or_create_user() (homeassis- 126

176 Index Home Assistant Documentation, Release 2021.10.0.dev0

async_handle() (homeassis- method), 81 tant.helpers.intent.ServiceIntentHandler async_listen() (homeassistant.core.EventBus method), 127 method), 68 async_handle() (in module homeassis- async_listen() (in module homeassis- tant.helpers.intent), 127 tant.helpers.discovery), 104 async_handle_play_stream_service() (in async_listen_once() (homeassis- module homeassistant.components.camera), 20 tant.core.EventBus method), 68 async_handle_record_service() (in module async_listen_platform() (in module homeassis- homeassistant.components.camera), 20 tant.helpers.discovery), 105 async_handle_snapshot_service() (in mod- async_listeners() (homeassistant.core.EventBus ule homeassistant.components.camera), 20 method), 68 async_handle_webhook() (in module homeassis- async_load() (homeassistant.core.Config method), tant.components.webhook), 58 67 async_increase_speed() (homeassis- async_load() (homeassis- tant.components.fan.FanEntity method), tant.helpers.area_registry.AreaRegistry 30 method), 81 async_init() (homeassis- async_load() (homeassis- tant.data_entry_flow.FlowManager method), tant.helpers.collection.IDLessCollection 76 method), 83 async_initialize() (homeassis- async_load() (homeassis- tant.components.light.Profiles method), 35 tant.helpers.collection.StorageCollection async_initialize() (homeassis- method), 84 tant.config_entries.ConfigEntries method), async_load() (homeassis- 61 tant.helpers.collection.YamlCollection async_internal_added_to_hass() (homeassis- method), 85 tant.helpers.entity.Entity method), 107 async_load() (homeassis- async_internal_added_to_hass() (home- tant.helpers.device_registry.DeviceRegistry assistant.helpers.restore_state.RestoreEntity method), 102 method), 130 async_load() (homeassis- async_internal_will_remove_from_hass() tant.helpers.entity_registry.EntityRegistry (homeassistant.helpers.entity.Entity method), method), 114 107 async_load() (homeassistant.helpers.storage.Store async_internal_will_remove_from_hass() method), 137 (homeassistant.helpers.restore_state.RestoreEntityasync_load() (in module homeassis- method), 130 tant.helpers.area_registry), 81 async_is_registered() (homeassis- async_load() (in module homeassis- tant.helpers.entity_registry.EntityRegistry tant.helpers.device_registry), 104 method), 114 async_load() (in module homeassis- async_items() (homeassis- tant.helpers.entity_registry), 117 tant.helpers.collection.ObservableCollection async_load_platform() (in module homeassis- method), 83 tant.helpers.discovery), 105 async_join_players() (homeassis- async_lock() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.lock.LockEntity method), method), 39 37 async_learn_command() (homeassis- async_log_refresh_token_usage() (homeas- tant.components.remote.RemoteEntity method), sistant.auth.auth_store.AuthStore method),6 46 async_match_state() (in module homeassis- async_link_user() (homeassis- tant.helpers.intent), 127 tant.auth.auth_store.AuthStore method), async_media_next_track() (homeassis- 6 tant.components.media_player.MediaPlayerEntity async_link_user() (homeassis- method), 39 tant.auth.AuthManager method),4 async_media_pause() (homeassis- async_list_areas() (homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.area_registry.AreaRegistry method), 39

Index 177 Home Assistant Documentation, Release 2021.10.0.dev0

async_media_play() (homeassis- async_oscillate() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.fan.FanEntity method), method), 39 30 async_media_play_pause() (homeassis- async_pause() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.vacuum.StateVacuumEntity method), 39 method), 50 async_media_previous_track() (homeassis- async_pause() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.vacuum.VacuumEntity method), 39 method), 51 async_media_seek() (homeassis- async_play_media() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity method), 39 method), 40 async_media_stop() (homeassis- async_post_init() (homeassis- tant.components.media_player.MediaPlayerEntity tant.config_entries.ConfigEntriesFlowManager method), 39 method), 62 async_migrate() (homeassis- async_post_init() (homeassis- tant.config_entries.ConfigEntry method), tant.data_entry_flow.FlowManager method), 63 76 async_migrate_entries() (in module homeassis- async_prepare_call_from_config() (in mod- tant.helpers.entity_registry), 117 ule homeassistant.helpers.service), 135 async_migrator() (in module homeassis- async_prepare_reload() (homeassis- tant.helpers.storage), 138 tant.helpers.entity_component.EntityComponent async_mount_local_lib_path() (in module method), 111 homeassistant.bootstrap),9 async_process_integration_platforms() async_mute_volume() (homeassis- (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.integration_platform), 125 method), 39 async_progress() (homeassis- async_not_from_config() (in module homeassis- tant.data_entry_flow.FlowManager method), tant.helpers.condition), 86 76 async_numeric_state() (in module homeassis- async_purge_expired_orphaned_devices() tant.helpers.condition), 86 (homeassistant.helpers.device_registry.DeviceRegistry async_numeric_state_from_config() (in method), 102 module homeassistant.helpers.condition), 86 async_refresh() (homeassis- async_oauth2_request() (in module homeassis- tant.helpers.update_coordinator.DataUpdateCoordinator tant.helpers.config_entry_oauth2_flow), 94 method), 147 async_oauth_create_entry() (homeassis- async_refresh_token() (homeassis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandlertant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation method), 91 method), 92 async_on_remove() (homeassis- async_register() (homeassis- tant.helpers.entity.Entity method), 107 tant.core.ServiceRegistry method), 70 async_on_unload() (homeassis- async_register() (in module homeassis- tant.config_entries.ConfigEntry method), tant.components.webhook), 58 63 async_register() (in module homeassis- async_open() (homeassis- tant.helpers.intent), 127 tant.components.lock.LockEntity method), async_register_admin_service() (in module 37 homeassistant.helpers.service), 135 async_open_cover() (homeassis- async_register_entity_service() (homeas- tant.components.cover.CoverEntity method), sistant.helpers.entity_component.EntityComponent 28 method), 111 async_open_cover_tilt() (homeassis- async_register_entity_service() (homeas- tant.components.cover.CoverEntity method), sistant.helpers.entity_platform.EntityPlatform 28 method), 113 async_or_from_config() (in module homeassis- async_register_implementation() (homeas- tant.helpers.condition), 86 sistant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler

178 Index Home Assistant Documentation, Release 2021.10.0.dev0

class method), 91 tant.auth.auth_store.AuthStore method), async_register_implementation() 6 (in module homeassis- async_remove_user() (homeassis- tant.helpers.config_entry_oauth2_flow), tant.auth.AuthManager method),4 95 async_removed_from_registry() (homeassis- async_register_services() (homeassis- tant.helpers.entity.Entity method), 107 tant.components.notify.BaseNotificationService async_render() (homeassis- method), 45 tant.helpers.template.Template method), async_register_signal_handling() (in mod- 140 ule homeassistant.helpers.signal), 136 async_render_to_info() (homeassis- async_reload() (homeassis- tant.helpers.template.Template method), tant.config_entries.ConfigEntries method), 140 61 async_render_will_timeout() (homeassis- async_reload() (in module homeassis- tant.helpers.template.Template method), 140 tant.components.notify), 46 async_render_with_possible_json_value() async_remove() (homeassis- (homeassistant.helpers.template.Template tant.config_entries.ConfigEntries method), method), 140 61 async_reproduce_state() (in module homeassis- async_remove() (homeassis- tant.helpers.state), 137 tant.config_entries.ConfigEntry method), async_request() (homeassis- 63 tant.helpers.config_entry_oauth2_flow.OAuth2Session async_remove() (homeassis- method), 93 tant.core.ServiceRegistry method), 71 async_request_call() (homeassis- async_remove() (homeassistant.core.StateMachine tant.helpers.entity.Entity method), 107 method), 72 async_request_refresh() (homeassis- async_remove() (homeassistant.helpers.entity.Entity tant.helpers.update_coordinator.DataUpdateCoordinator method), 107 method), 147 async_remove() (homeassis- async_request_stream() (in module homeassis- tant.helpers.entity_registry.EntityRegistry tant.components.camera), 21 method), 114 async_reserve() (homeassistant.core.StateMachine async_remove() (homeassis- method), 72 tant.helpers.storage.Store method), 137 async_reset() (homeassis- async_remove_credentials() (homeassis- tant.helpers.entity_platform.EntityPlatform tant.auth.auth_store.AuthStore method),6 method), 113 async_remove_credentials() (homeassis- async_reset_platform() (in module homeassis- tant.auth.AuthManager method),4 tant.components.notify), 46 async_remove_device() (homeassis- async_resolve_external_data() (homeassis- tant.helpers.device_registry.DeviceRegistry tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation method), 102 method), 92 async_remove_entity() (homeassis- async_resolve_external_data() (homeassis- tant.helpers.entity_component.EntityComponent tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation method), 112 method), 93 async_remove_entity() (homeassis- async_restore_entity_added() (homeassis- tant.helpers.entity_platform.EntityPlatform tant.helpers.restore_state.RestoreStateData method), 113 method), 130 async_remove_listener() (homeassis- async_restore_entity_removed() (homeas- tant.helpers.update_coordinator.DataUpdateCoordinator sistant.helpers.restore_state.RestoreStateData method), 147 method), 130 async_remove_refresh_token() (homeas- async_run() (homeassistant.core.HomeAssistant sistant.auth.auth_store.AuthStore method), method), 69 6 async_run() (homeassistant.helpers.script.Script async_remove_refresh_token() (homeassis- method), 131 tant.auth.AuthManager method),4 async_run_hass_job() (homeassis- async_remove_user() (homeassis- tant.core.HomeAssistant method), 69

Index 179 Home Assistant Documentation, Release 2021.10.0.dev0 async_run_job() (homeassis- sistant.components.cover.CoverEntity method), tant.core.HomeAssistant method), 69 28 async_save() (homeassistant.helpers.storage.Store async_set_direction() (homeassis- method), 138 tant.components.fan.FanEntity method), async_save_persistent_states() (homeas- 30 sistant.helpers.restore_state.RestoreStateData async_set_disabled_by() (homeassis- class method), 130 tant.config_entries.ConfigEntries method), async_schedule_save() (homeassis- 61 tant.helpers.area_registry.AreaRegistry async_set_fan_mode() (homeassis- method), 81 tant.components.climate.ClimateEntity async_schedule_save() (homeassis- method), 23 tant.helpers.device_registry.DeviceRegistry async_set_humidity() (homeassis- method), 102 tant.components.climate.ClimateEntity async_schedule_save() (homeassis- method), 23 tant.helpers.entity_registry.EntityRegistry async_set_hvac_mode() (homeassis- method), 115 tant.components.climate.ClimateEntity async_schedule_update_ha_state() (home- method), 23 assistant.helpers.entity.Entity method), 107 async_set_operation_mode() (homeassis- async_select_sound_mode() (homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.media_player.MediaPlayerEntity method), 53 method), 40 async_set_percentage() (homeassis- async_select_source() (homeassis- tant.components.fan.FanEntity method), tant.components.media_player.MediaPlayerEntity 30 method), 40 async_set_preset_mode() (homeassis- async_send_command() (homeassis- tant.components.climate.ClimateEntity tant.components.remote.RemoteEntity method), method), 23 46 async_set_preset_mode() (homeassis- async_send_message() (homeassis- tant.components.fan.FanEntity method), tant.components.notify.BaseNotificationService 30 method), 45 async_set_repeat() (homeassis- async_service_aux_heat() (in module homeas- tant.components.media_player.MediaPlayerEntity sistant.components.climate), 26 method), 40 async_service_away_mode() (in module home- async_set_service_schema() (in module home- assistant.components.water_heater), 55 assistant.helpers.service), 135 async_service_temperature_set() (in mod- async_set_shuffle() (homeassis- ule homeassistant.components.climate), 26 tant.components.media_player.MediaPlayerEntity async_service_temperature_set() (in mod- method), 40 ule homeassistant.components.water_heater), async_set_speech() (homeassis- 55 tant.helpers.intent.IntentResponse method), async_services() (homeassis- 127 tant.core.ServiceRegistry method), 71 async_set_speed() (homeassis- async_set() (homeassistant.core.StateMachine tant.components.fan.FanEntity method), method), 72 30 async_set_agent() (in module homeassis- async_set_speed_deprecated() (homeas- tant.components.conversation), 27 sistant.components.fan.FanEntity method), async_set_card() (homeassis- 31 tant.helpers.intent.IntentResponse method), async_set_swing_mode() (homeassis- 126 tant.components.climate.ClimateEntity async_set_context() (homeassis- method), 23 tant.helpers.entity.Entity method), 107 async_set_temperature() (homeassis- async_set_cover_position() (homeassis- tant.components.climate.ClimateEntity tant.components.cover.CoverEntity method), method), 23 28 async_set_temperature() (homeassis- async_set_cover_tilt_position() (homeas- tant.components.water_heater.WaterHeaterEntity

180 Index Home Assistant Documentation, Release 2021.10.0.dev0

method), 53 tant.components.lock), 38 async_set_unique_id() (homeassis- async_setup() (in module homeassis- tant.config_entries.ConfigFlow method), tant.components.media_player), 44 63 async_setup() (in module homeassis- async_set_updated_data() (homeassis- tant.components.notify), 46 tant.helpers.update_coordinator.DataUpdateCoordinatorasync_setup() (in module homeassis- method), 147 tant.components.remote), 47 async_set_volume_level() (homeassis- async_setup() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.components.sensor), 50 method), 40 async_setup() (in module homeassis- async_setup() (homeassis- tant.components.switch), 48 tant.components.notify.BaseNotificationService async_setup() (in module homeassis- method), 45 tant.components.vacuum), 52 async_setup() (homeassis- async_setup() (in module homeassis- tant.config_entries.ConfigEntries method), tant.components.water_heater), 55 62 async_setup() (in module homeassis- async_setup() (homeassis- tant.components.weather), 57 tant.config_entries.ConfigEntry method), async_setup() (in module homeassis- 63 tant.components.webhook), 58 async_setup() (homeassis- async_setup_cleanup() (in module homeassis- tant.config_entries.EntityRegistryDisabledHandler tant.helpers.device_registry), 104 method), 64 async_setup_dump() (homeassis- async_setup() (homeassis- tant.helpers.restore_state.RestoreStateData tant.helpers.collection.StorageCollectionWebsocket method), 130 method), 84 async_setup_entity_restore() (in module async_setup() (homeassis- homeassistant.helpers.entity_registry), 117 tant.helpers.entity_component.EntityComponent async_setup_entry() (homeassis- method), 112 tant.helpers.entity_component.EntityComponent async_setup() (homeassis- method), 112 tant.helpers.entity_platform.EntityPlatform async_setup_entry() (homeassis- method), 113 tant.helpers.entity_platform.EntityPlatform async_setup() (in module homeassis- method), 113 tant.components.air_quality), 12 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.air_quality), 12 tant.components.alarm_control_panel), 14 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.alarm_control_panel), 14 tant.components.binary_sensor), 16 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.binary_sensor), 16 tant.components.calendar), 22 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.calendar), 22 tant.components.camera), 21 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.camera), 21 tant.components.climate), 26 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.climate), 26 tant.components.conversation), 27 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.cover), 29 tant.components.cover), 29 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.fan), 33 tant.components.device_tracker), 30 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.light), 35 tant.components.fan), 33 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.lock), 38 tant.components.light), 35 async_setup_entry() (in module homeassis- async_setup() (in module homeassis- tant.components.media_player), 45

Index 181 Home Assistant Documentation, Release 2021.10.0.dev0

async_setup_entry() (in module homeassis- async_step_auth() (homeassis- tant.components.remote), 47 tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler async_setup_entry() (in module homeassis- method), 91 tant.components.sensor), 50 async_step_confirm() (homeassis- async_setup_entry() (in module homeassis- tant.helpers.config_entry_flow.DiscoveryFlowHandler tant.components.switch), 48 method), 89 async_setup_entry() (in module homeassis- async_step_creation() (homeassis- tant.components.vacuum), 52 tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler async_setup_entry() (in module homeassis- method), 91 tant.components.water_heater), 55 async_step_dhcp() (homeassis- async_setup_entry() (in module homeassis- tant.config_entries.ConfigFlow method), tant.components.weather), 57 64 async_setup_hass() (in module homeassis- async_step_dhcp() (homeassis- tant.bootstrap),9 tant.helpers.config_entry_flow.DiscoveryFlowHandler async_setup_multi_components() (in module method), 89 homeassistant.bootstrap),9 async_step_discovery() (homeassis- async_setup_platform() (homeassis- tant.config_entries.ConfigFlow method), tant.helpers.entity_component.EntityComponent 64 method), 112 async_step_discovery() (homeassis- async_setup_platforms() (homeassis- tant.helpers.config_entry_flow.DiscoveryFlowHandler tant.config_entries.ConfigEntries method), method), 89 62 async_step_hassio() (homeassis- async_show_form() (homeassis- tant.config_entries.ConfigFlow method), tant.data_entry_flow.FlowHandler method), 64 75 async_step_homekit() (homeassis- async_show_progress() (homeassis- tant.config_entries.ConfigFlow method), tant.data_entry_flow.FlowHandler method), 64 75 async_step_homekit() (homeassis- async_show_progress_done() (homeassis- tant.helpers.config_entry_flow.DiscoveryFlowHandler tant.data_entry_flow.FlowHandler method), method), 89 75 async_step_ignore() (homeassis- async_shutdown() (homeassis- tant.config_entries.ConfigFlow method), tant.config_entries.ConfigEntry method), 64 63 async_step_import() (homeassis- async_shutdown() (homeassis- tant.helpers.config_entry_flow.DiscoveryFlowHandler tant.data_entry_flow.FlowManager method), method), 89 76 async_step_mqtt() (homeassis- async_shutdown() (homeassis- tant.config_entries.ConfigFlow method), tant.helpers.entity_platform.EntityPlatform 64 method), 113 async_step_mqtt() (homeassis- async_start() (homeassis- tant.helpers.config_entry_flow.DiscoveryFlowHandler tant.components.vacuum.StateVacuumEntity method), 89 method), 50 async_step_pick_implementation() (home- async_start() (homeassis- assistant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler tant.components.vacuum.VacuumEntity method), 91 method), 51 async_step_ssdp() (homeassis- async_start() (homeassistant.core.HomeAssistant tant.config_entries.ConfigFlow method), method), 69 64 async_start_pause() (homeassis- async_step_ssdp() (homeassis- tant.components.vacuum.VacuumEntity tant.helpers.config_entry_flow.DiscoveryFlowHandler method), 51 method), 90 async_start_reauth() (homeassis- async_step_unignore() (homeassis- tant.config_entries.ConfigEntry method), tant.config_entries.ConfigFlow method), 63 64

182 Index Home Assistant Documentation, Release 2021.10.0.dev0 async_step_usb() (homeassis- tant.components.cover.CoverEntity method), tant.config_entries.ConfigFlow method), 28 64 async_track_entity_registry_updated_event() async_step_user() (homeassis- (in module homeassistant.helpers.event), 119 tant.config_entries.ConfigFlow method), async_track_point_in_time() (in module 64 homeassistant.helpers.event), 120 async_step_user() (homeassis- async_track_point_in_utc_time() (in mod- tant.helpers.config_entry_flow.DiscoveryFlowHandler ule homeassistant.helpers.event), 120 method), 90 async_track_same_state() (in module homeas- async_step_user() (homeassis- sistant.helpers.event), 120 tant.helpers.config_entry_flow.WebhookFlowHandlerasync_track_state_added_domain() (in mod- method), 90 ule homeassistant.helpers.event), 120 async_step_user() (homeassis- async_track_state_change() (in module home- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandlerassistant.helpers.event), 120 method), 91 async_track_state_change_event() (in mod- async_step_zeroconf() (homeassis- ule homeassistant.helpers.event), 120 tant.config_entries.ConfigFlow method), async_track_state_change_filtered() (in 64 module homeassistant.helpers.event), 121 async_step_zeroconf() (homeassis- async_track_state_removed_domain() (in tant.helpers.config_entry_flow.DiscoveryFlowHandler module homeassistant.helpers.event), 121 method), 90 async_track_sunrise() (in module homeassis- async_stop() (homeassistant.core.HomeAssistant tant.helpers.event), 121 method), 69 async_track_sunset() (in module homeassis- async_stop() (homeassistant.helpers.script.Script tant.helpers.event), 121 method), 131 async_track_tasks() (homeassis- async_stop_cover() (homeassis- tant.core.HomeAssistant method), 70 tant.components.cover.CoverEntity method), async_track_template() (in module homeassis- 28 tant.helpers.event), 121 async_stop_cover_tilt() (homeassis- async_track_template_result() (in module tant.components.cover.CoverEntity method), homeassistant.helpers.event), 122 28 async_track_time_change() (in module home- async_stop_track_tasks() (homeassis- assistant.helpers.event), 122 tant.core.HomeAssistant method), 70 async_track_time_interval() (in module async_store() (homeassistant.core.Config method), homeassistant.helpers.event), 122 67 async_track_utc_time_change() (in module async_template() (in module homeassis- homeassistant.helpers.event), 123 tant.helpers.condition), 86 async_trigger_from_config() (in module async_template_from_config() (in module homeassistant.helpers.condition), 87 homeassistant.helpers.condition), 87 async_turn_aux_heat_off() (homeassis- async_test_feature() (in module homeassis- tant.components.climate.ClimateEntity tant.helpers.intent), 127 method), 23 async_toggle() (homeassis- async_turn_aux_heat_on() (homeassis- tant.components.cover.CoverEntity method), tant.components.climate.ClimateEntity 28 method), 24 async_toggle() (homeassis- async_turn_away_mode_off() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.water_heater.WaterHeaterEntity method), 40 method), 53 async_toggle() (homeassis- async_turn_away_mode_on() (homeassis- tant.components.vacuum.StateVacuumEntity tant.components.water_heater.WaterHeaterEntity method), 50 method), 53 async_toggle() (homeassis- async_turn_off() (homeassis- tant.helpers.entity.ToggleEntity method), tant.components.camera.Camera method), 109 17 async_toggle_tilt() (homeassis- async_turn_off() (homeassis-

Index 183 Home Assistant Documentation, Release 2021.10.0.dev0

tant.components.climate.ClimateEntity async_unload_entry() (in module homeassis- method), 24 tant.components.binary_sensor), 16 async_turn_off() (homeassis- async_unload_entry() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.components.calendar), 23 method), 40 async_unload_entry() (in module homeassis- async_turn_off() (homeassis- tant.components.camera), 21 tant.components.vacuum.StateVacuumEntity async_unload_entry() (in module homeassis- method), 50 tant.components.climate), 27 async_turn_off() (homeassis- async_unload_entry() (in module homeassis- tant.components.vacuum.VacuumEntity tant.components.cover), 30 method), 51 async_unload_entry() (in module homeassis- async_turn_off() (homeassis- tant.components.fan), 33 tant.helpers.entity.ToggleEntity method), async_unload_entry() (in module homeassis- 109 tant.components.light), 36 async_turn_on() (homeassis- async_unload_entry() (in module homeassis- tant.components.camera.Camera method), tant.components.lock), 38 17 async_unload_entry() (in module homeassis- async_turn_on() (homeassis- tant.components.media_player), 45 tant.components.climate.ClimateEntity async_unload_entry() (in module homeassis- method), 24 tant.components.remote), 47 async_turn_on() (homeassis- async_unload_entry() (in module homeassis- tant.components.fan.FanEntity method), tant.components.sensor), 50 31 async_unload_entry() (in module homeassis- async_turn_on() (homeassis- tant.components.switch), 48 tant.components.media_player.MediaPlayerEntityasync_unload_entry() (in module homeassis- method), 40 tant.components.vacuum), 52 async_turn_on() (homeassis- async_unload_entry() (in module homeassis- tant.components.vacuum.StateVacuumEntity tant.components.water_heater), 56 method), 50 async_unload_entry() (in module homeassis- async_turn_on() (homeassis- tant.components.weather), 57 tant.components.vacuum.VacuumEntity async_unload_platforms() (homeassis- method), 52 tant.config_entries.ConfigEntries method), async_turn_on() (homeassis- 62 tant.helpers.entity.ToggleEntity method), async_unlock() (homeassis- 110 tant.components.lock.LockEntity method), async_turn_on_compat() (homeassis- 37 tant.components.fan.FanEntity method), async_unregister() (in module homeassis- 31 tant.components.webhook), 58 async_unjoin_player() (homeassis- async_unregister_services() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.notify.BaseNotificationService method), 40 method), 45 async_unload() (homeassis- async_unsub_polling() (homeassis- tant.config_entries.ConfigEntries method), tant.helpers.entity_platform.EntityPlatform 62 method), 113 async_unload() (homeassis- async_update() (homeassistant.core.Config tant.config_entries.ConfigEntry method), method), 67 63 async_update() (homeassis- async_unload_entry() (homeassis- tant.helpers.area_registry.AreaRegistry tant.helpers.entity_component.EntityComponent method), 81 method), 112 async_update() (homeassis- async_unload_entry() (in module homeassis- tant.helpers.update_coordinator.CoordinatorEntity tant.components.air_quality), 12 method), 146 async_unload_entry() (in module homeassis- async_update_device() (homeassis- tant.components.alarm_control_panel), 15 tant.helpers.device_registry.DeviceRegistry

184 Index Home Assistant Documentation, Release 2021.10.0.dev0

method), 102 142 async_update_entity() (homeassis- attributes() (homeassis- tant.helpers.entity_registry.EntityRegistry tant.helpers.template.TemplateState property), method), 115 141 async_update_entity() (in module homeassis- attribution() (homeassis- tant.helpers.entity_component), 112 tant.components.air_quality.AirQualityEntity async_update_entry() (homeassis- property), 11 tant.config_entries.ConfigEntries method), attribution() (homeassis- 62 tant.components.weather.WeatherEntity async_update_ha_state() (homeassis- property), 56 tant.helpers.entity.Entity method), 107 auth_manager_from_config() (in module home- async_update_item() (homeassis- assistant.auth),5 tant.helpers.collection.StorageCollection auth_mfa_modules() (homeassis- method), 84 tant.auth.AuthManager property),4 async_update_token() (homeassis- auth_provider_id (homeassis- tant.components.camera.Camera method), tant.auth.models.Credentials attribute),7 17 auth_provider_type (homeassis- async_update_user() (homeassis- tant.auth.models.Credentials attribute),7 tant.auth.auth_store.AuthStore method), auth_providers() (homeassis- 6 tant.auth.AuthManager property),4 async_update_user() (homeassis- AuthManager (class in homeassistant.auth),3 tant.auth.AuthManager method),4 AuthManagerFlowManager (class in homeassis- async_validate_access_token() (homeassis- tant.auth),5 tant.auth.AuthManager method),4 AuthStore (class in homeassistant.auth.auth_store),5 async_validate_action_config() (in module available() (homeassistant.helpers.entity.Entity homeassistant.helpers.script), 131 property), 107 async_validate_actions_config() (in mod- available() (homeassis- ule homeassistant.helpers.script), 132 tant.helpers.update_coordinator.CoordinatorEntity async_validate_condition_config() (in property), 146 module homeassistant.helpers.condition), 87 async_validate_refresh_token() (homeassis- B tant.auth.AuthManager method),4 b (homeassistant.util.color.RGBColor attribute), 156 async_validate_slots() (homeassis- base64_decode() (in module homeassis- tant.helpers.intent.IntentHandler method), tant.helpers.template), 142 126 base64_encode() (in module homeassis- async_volume_down() (homeassis- tant.helpers.template), 142 tant.components.media_player.MediaPlayerEntityBaseNotificationService (class in homeassis- method), 40 tant.components.notify), 45 async_volume_up() (homeassis- battery_icon() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.vacuum.StateVacuumEntity method), 40 property), 50 async_wait_init_flow_finish() (homeassis- battery_icon() (homeassis- tant.data_entry_flow.FlowManager method), tant.components.vacuum.VacuumEntity prop- 76 erty), 52 async_warn_old_async_camera_image_signature()BinarySensorDevice (class in homeassis- (homeassistant.components.camera.Camera tant.components.binary_sensor), 15 method), 17 BinarySensorEntity (class in homeassis- async_will_remove_from_hass() (homeassis- tant.components.binary_sensor), 15 tant.helpers.entity.Entity method), 107 BinarySensorEntityDescription (class in async_write_ha_state() (homeassis- homeassistant.components.binary_sensor), 15 tant.helpers.entity.Entity method), 107 bind_hass() (in module homeassistant.loader), 151 AsyncTrackStates (class in homeassis- bitwise_and() (in module homeassis- tant.helpers.state), 137 tant.helpers.template), 142 attach() (in module homeassistant.helpers.template),

Index 185 Home Assistant Documentation, Release 2021.10.0.dev0 bitwise_or() (in module homeassis- CameraImageView (class in homeassis- tant.helpers.template), 142 tant.components.camera), 18 block_till_done() (homeassis- CameraMjpegStream (class in homeassis- tant.core.HomeAssistant method), 70 tant.components.camera), 19 blue (homeassistant.util.color.GamutType attribute), CameraView (class in homeassis- 156 tant.components.camera), 19 boolean() (in module homeassis- capabilities (homeassis- tant.helpers.config_validation), 95 tant.helpers.entity_registry.RegistryEntry brand() (homeassistant.components.camera.Camera attribute), 115 property), 17 capability_attributes() (homeassis- breakpoint_clear() (in module homeassis- tant.components.climate.ClimateEntity prop- tant.helpers.script), 132 erty), 24 breakpoint_clear_all() (in module homeassis- capability_attributes() (homeassis- tant.helpers.script), 132 tant.components.fan.FanEntity property), breakpoint_list() (in module homeassis- 31 tant.helpers.script), 132 capability_attributes() (homeassis- breakpoint_set() (in module homeassis- tant.components.light.LightEntity property), tant.helpers.script), 132 34 brightness (homeassistant.components.light.Profile capability_attributes() (homeassis- attribute), 35 tant.components.media_player.MediaPlayerEntity brightness() (homeassis- property), 40 tant.components.light.LightEntity property), capability_attributes() (homeassis- 34 tant.components.sensor.SensorEntity property), brightness_supported() (in module homeassis- 49 tant.components.light), 36 capability_attributes() (homeassis- BrowseMedia (class in homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.media_player), 38 property), 53 capability_attributes() (homeassis- C tant.helpers.entity.Entity property), 108 calculate_children_class() (homeassis- carbon_dioxide() (homeassis- tant.components.media_player.BrowseMedia tant.components.air_quality.AirQualityEntity method), 38 property), 11 calculate_offset() (in module homeassis- carbon_monoxide() (homeassis- tant.components.calendar), 23 tant.components.air_quality.AirQualityEntity CalendarEventDevice (class in homeassis- property), 11 tant.components.calendar), 22 catch_log_coro_exception() (in module home- CalendarEventView (class in homeassis- assistant.util.logging), 163 tant.components.calendar), 22 catch_log_exception() (in module homeassis- CalendarListView (class in homeassis- tant.util.logging), 163 tant.components.calendar), 22 celsius_to_fahrenheit() (in module homeassis- call() (homeassistant.core.ServiceRegistry method), tant.util.temperature), 165 71 celsius_to_kelvin() (in module homeassis- call_from_config() (in module homeassis- tant.util.temperature), 165 tant.helpers.service), 136 change_listener() (homeassis- call_later() (in module homeassis- tant.helpers.script.Script property), 131 tant.helpers.event), 123 change_type (homeassis- callback() (in module homeassistant.core), 73 tant.helpers.collection.CollectionChangeSet Camera (class in homeassistant.components.camera), attribute), 82 17 changed_by() (homeassis- camera_image() (homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.components.camera.Camera method), property), 13 17 changed_by() (homeassis- CameraEntityDescription (class in homeassis- tant.components.lock.LockEntity property), tant.components.camera), 18 37

186 Index Home Assistant Documentation, Release 2021.10.0.dev0 check_loop() (in module homeassistant.util.async_), color_hs_to_RGB() (in module homeassis- 155 tant.util.color), 157 check_point_in_lamps_reach() (in module color_hs_to_xy() (in module homeassis- homeassistant.util.color), 157 tant.util.color), 157 check_valid_gamut() (in module homeassis- color_hsb_to_RGB() (in module homeassis- tant.util.color), 157 tant.util.color), 157 CheckConfigError (class in homeassis- color_hsv_to_RGB() (in module homeassis- tant.helpers.check_config), 82 tant.util.color), 157 CircularDependency, 149 color_mode() (homeassis- city (homeassistant.util.location.LocationInfo at- tant.components.light.LightEntity property), tribute), 161 34 clear_playlist() (homeassis- color_name_to_rgb() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.util.color), 157 method), 40 color_rgb_to_hex() (in module homeassis- client_context() (in module homeassis- tant.util.color), 157 tant.util.ssl), 165 color_RGB_to_hs() (in module homeassis- client_icon (homeassis- tant.util.color), 157 tant.auth.models.RefreshToken attribute), color_RGB_to_hsv() (in module homeassis- 7 tant.util.color), 157 client_id (homeassistant.auth.models.RefreshToken color_rgb_to_rgbw() (in module homeassis- attribute),7 tant.util.color), 157 client_name (homeassis- color_rgb_to_rgbww() (in module homeassis- tant.auth.models.RefreshToken attribute), tant.util.color), 157 7 color_RGB_to_xy() (in module homeassis- ClimateDevice (class in homeassis- tant.util.color), 157 tant.components.climate), 23 color_RGB_to_xy_brightness() (in module ClimateEntity (class in homeassis- homeassistant.util.color), 157 tant.components.climate), 23 color_rgbw_to_rgb() (in module homeassis- ClimateEntityDescription (class in homeassis- tant.util.color), 158 tant.components.climate), 26 color_rgbww_to_rgb() (in module homeassis- close_cover() (homeassis- tant.util.color), 158 tant.components.cover.CoverEntity method), color_supported() (in module homeassis- 28 tant.components.light), 36 close_cover_tilt() (homeassis- color_temp() (homeassis- tant.components.cover.CoverEntity method), tant.components.light.LightEntity property), 28 34 closest() (in module homeassistant.helpers.location), color_temp_supported() (in module homeassis- 128 tant.components.light), 36 closest() (in module homeassis- color_temperature_kelvin_to_mired() (in tant.helpers.template), 142 module homeassistant.util.color), 158 closest_filter() (in module homeassis- color_temperature_mired_to_kelvin() (in tant.helpers.template), 142 module homeassistant.util.color), 158 code_arm_required() (homeassis- color_temperature_to_hs() (in module home- tant.components.alarm_control_panel.AlarmControlPanelEntityassistant.util.color), 158 property), 13 color_temperature_to_rgb() (in module home- code_format() (homeassis- assistant.util.color), 158 tant.components.alarm_control_panel.AlarmControlPanelEntitycolor_x (homeassistant.components.light.Profile at- property), 13 tribute), 35 code_format() (homeassis- color_xy_brightness_to_RGB() (in module tant.components.lock.LockEntity property), homeassistant.util.color), 158 37 color_xy_to_hs() (in module homeassis- CollectionChangeSet (class in homeassis- tant.util.color), 158 tant.helpers.collection), 82 color_xy_to_RGB() (in module homeassis- CollectionError, 82 tant.util.color), 158

Index 187 Home Assistant Documentation, Release 2021.10.0.dev0

color_y (homeassistant.components.light.Profile at- tant.helpers.device_registry.DeletedDeviceEntry tribute), 35 attribute), 100 compile() (homeassis- connections (homeassis- tant.helpers.template.TemplateEnvironment tant.helpers.device_registry.DeviceEntry method), 140 attribute), 101 component_translation_path() (in module connections (homeassis- homeassistant.helpers.translation), 145 tant.helpers.entity.DeviceInfo attribute), Components (class in homeassistant.loader), 149 106 condition (homeassis- content (homeassistant.components.camera.Image at- tant.components.weather.Forecast attribute), tribute), 19 56 content() (homeassistant.util.aiohttp.MockRequest condition() (homeassis- property), 155 tant.components.weather.WeatherEntity content_type (homeassis- property), 56 tant.components.camera.Image attribute), condition_trace_append() (in module homeas- 19 sistant.helpers.condition), 87 Context (class in homeassistant.core), 67 condition_trace_set_result() (in module context (homeassistant.helpers.intent.Intent attribute), homeassistant.helpers.condition), 87 126 condition_trace_update_result() (in mod- context() (homeassis- ule homeassistant.helpers.condition), 88 tant.helpers.template.TemplateState property), ConditionError, 77 141 ConditionErrorContainer, 77 context_recent_time() (homeassis- ConditionErrorIndex, 77 tant.helpers.entity.Entity property), 108 ConditionErrorMessage, 77 ConversationProcessView (class in homeassis- Config (class in homeassistant.core), 67 tant.components.conversation), 27 config (homeassistant.helpers.check_config.CheckConfigErrorconvert() (in module homeassistant.util), 153 attribute), 82 convert() (in module homeassistant.util.distance), config_entries (homeassis- 159 tant.helpers.device_registry.DeletedDeviceEntry convert() (in module homeassistant.util.pressure), attribute), 100 164 config_entries (homeassis- convert() (in module homeassistant.util.temperature), tant.helpers.device_registry.DeviceEntry 165 attribute), 101 convert() (in module homeassistant.util.volume), 166 config_entry_id (homeassis- convert_filter() (in module homeassis- tant.helpers.entity_registry.RegistryEntry tant.helpers.entityfilter), 118 attribute), 115 convert_include_exclude_filter() (in mod- config_flow() (homeassistant.loader.Integration ule homeassistant.helpers.entityfilter), 118 property), 149 CoordinatorEntity (class in homeassis- config_per_platform() (in module homeassis- tant.helpers.update_coordinator), 146 tant.helpers), 79 CoreState (class in homeassistant.core), 67 ConfigEntries (class in homeassis- cors_allowed (homeassis- tant.config_entries), 61 tant.components.webhook.WebhookView ConfigEntriesFlowManager (class in homeassis- attribute), 58 tant.config_entries), 62 cosine() (in module homeassistant.helpers.template), ConfigEntry (class in homeassistant.config_entries), 142 62 counter (homeassistant.helpers.collection.IDLessCollection ConfigEntryAuthFailed, 77 attribute), 83 ConfigEntryNotReady, 77 country_code (homeassis- ConfigEntryState (class in homeassis- tant.util.location.LocationInfo attribute), tant.config_entries), 63 161 ConfigError, 63 CoverDevice (class in homeassis- ConfigFlow (class in homeassistant.config_entries), tant.components.cover), 28 63 CoverEntity (class in homeassis- connections (homeassis- tant.components.cover), 28

188 Index Home Assistant Documentation, Release 2021.10.0.dev0

CoverEntityDescription (class in homeassis- D tant.components.cover), 29 data (homeassistant.auth.models.Credentials attribute), create_response() (homeassis- 7 tant.helpers.intent.Intent method), 126 DataUpdateCoordinator (class in homeassis- create_stream() (homeassis- tant.helpers.update_coordinator), 146 tant.components.camera.Camera method), date() (in module homeassis- 17 tant.helpers.config_validation), 95 create_task() (homeassistant.core.HomeAssistant datetime (homeassis- method), 70 tant.components.weather.Forecast attribute), created_at (homeassistant.auth.models.RefreshToken 56 attribute),7 datetime() (in module homeassis- credential (homeassistant.auth.models.RefreshToken tant.helpers.config_validation), 96 attribute),7 Debouncer (class in homeassistant.helpers.debounce), Credentials (class in homeassistant.auth.models),7 99 credentials (homeassistant.auth.models.User debug_continue() (in module homeassis- attribute),8 tant.helpers.script), 132 cross_product() (in module homeassis- debug_step() (in module homeassis- tant.util.color), 158 tant.helpers.script), 132 cubic_feet_to_cubic_meter() (in module debug_stop() (in module homeassis- homeassistant.util.volume), 166 tant.helpers.script), 132 cubic_meter_to_cubic_feet() (in module default() (homeassis- homeassistant.util.volume), 166 tant.helpers.json.ExtendedJSONEncoder currency (homeassistant.util.location.LocationInfo at- method), 128 tribute), 161 default() (homeassistant.helpers.json.JSONEncoder current_activity() (homeassis- method), 128 tant.components.remote.RemoteEntity prop- default_manufacturer (homeassis- erty), 46 tant.helpers.entity.DeviceInfo attribute), current_cover_position() (homeassis- 106 tant.components.cover.CoverEntity property), default_model (homeassis- 28 tant.helpers.entity.DeviceInfo attribute), current_cover_tilt_position() (homeassis- 106 tant.components.cover.CoverEntity property), default_name (homeassis- 28 tant.helpers.entity.DeviceInfo attribute), current_direction() (homeassis- 106 tant.components.fan.FanEntity property), delete() (homeassis- 31 tant.helpers.data_entry_flow.FlowManagerResourceView current_humidity() (homeassis- method), 99 tant.components.climate.ClimateEntity prop- delete_command() (homeassis- erty), 24 tant.components.remote.RemoteEntity method), current_operation() (homeassis- 46 tant.components.water_heater.WaterHeaterEntity deleted_devices (homeassis- property), 53 tant.helpers.device_registry.DeviceRegistry current_power_w() (homeassis- attribute), 103 tant.components.switch.SwitchEntity property), DeletedDeviceEntry (class in homeassis- 48 tant.helpers.device_registry), 100 current_temperature() (homeassis- dependencies() (homeassistant.loader.Integration tant.components.climate.ClimateEntity prop- property), 149 erty), 24 deprecated() (in module homeassis- current_temperature() (homeassis- tant.helpers.config_validation), 96 tant.components.water_heater.WaterHeaterEntity deprecated_class() (in module homeassis- property), 53 tant.helpers.deprecation), 100 custom_serializer() (in module homeassis- deprecated_function() (in module homeassis- tant.helpers.config_validation), 95 tant.helpers.deprecation), 100 deprecated_substitute() (in module homeassis-

Index 189 Home Assistant Documentation, Release 2021.10.0.dev0

tant.helpers.deprecation), 100 tant.helpers.discovery.DiscoveryDict attribute), determine_script_action() (in module home- 104 assistant.helpers.config_validation), 96 DiscoveryDict (class in homeassis- device_attr() (in module homeassis- tant.helpers.discovery), 104 tant.helpers.template), 142 DiscoveryFlowHandler (class in homeassis- device_class (homeassis- tant.helpers.config_entry_flow), 89 tant.helpers.entity.EntityDescription attribute), dispatcher_connect() (in module homeassis- 109 tant.helpers.dispatcher), 105 device_class (homeassis- dispatcher_send() (in module homeassis- tant.helpers.entity_registry.RegistryEntry tant.helpers.dispatcher), 106 attribute), 115 display_temp() (in module homeassis- device_class() (homeassistant.helpers.entity.Entity tant.helpers.temperature), 139 property), 108 distance() (homeassistant.core.Config method), 67 device_entities() (in module homeassis- distance() (in module homeassis- tant.helpers.template), 142 tant.helpers.template), 142 device_id (homeassis- distance() (in module homeassistant.util.location), tant.helpers.entity_registry.RegistryEntry 162 attribute), 115 documentation() (homeassistant.loader.Integration device_id() (in module homeassis- property), 149 tant.helpers.template), 142 domain (homeassistant.helpers.check_config.CheckConfigError device_info() (homeassistant.helpers.entity.Entity attribute), 82 property), 108 DOMAIN (homeassistant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler device_state_attributes() (homeassis- attribute), 91 tant.helpers.entity.Entity property), 108 domain (homeassistant.helpers.entity_registry.RegistryEntry DeviceEntry (class in homeassis- attribute), 115 tant.helpers.device_registry), 101 domain (homeassistant.helpers.service.ServiceParams DeviceInfo (class in homeassistant.helpers.entity), attribute), 133 106 domain() (homeassis- DeviceRegistry (class in homeassis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation tant.helpers.device_registry), 101 property), 92 devices (homeassistant.helpers.device_registry.DeviceRegistrydomain() (homeassis- attribute), 103 tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation dhcp() (homeassistant.loader.Integration property), property), 93 149 domain() (homeassis- disable_motion_detection() (homeassis- tant.helpers.template.TemplateState property), tant.components.camera.Camera method), 141 17 domain() (homeassistant.loader.Integration property), disabled() (homeassis- 149 tant.helpers.device_registry.DeviceEntry domains (homeassistant.helpers.event.TrackStates at- property), 101 tribute), 119 disabled() (homeassis- DomainStates (class in homeassis- tant.helpers.entity_registry.RegistryEntry tant.helpers.template), 139 property), 115 draw_box() (in module homeassistant.util.pil), 164 disabled() (homeassistant.loader.Integration prop- dump() (in module homeassistant.util.yaml), 154 erty), 149 dynamic_template() (in module homeassis- disabled_by (homeassis- tant.helpers.config_validation), 96 tant.helpers.device_registry.DeviceEntry attribute), 101 E disabled_by (homeassis- effect() (homeassistant.components.light.LightEntity tant.helpers.entity_registry.RegistryEntry property), 34 attribute), 115 effect_list() (homeassis- discover() (in module homeassis- tant.components.light.LightEntity property), tant.helpers.discovery), 105 34 discovered (homeassis-

190 Index Home Assistant Documentation, Release 2021.10.0.dev0 enable_motion_detection() (homeassis- 28 tant.components.camera.Camera method), entity_description (homeassis- 17 tant.components.fan.FanEntity attribute), enabled() (homeassistant.helpers.entity.Entity prop- 31 erty), 108 entity_description (homeassis- ensure_list() (in module homeassis- tant.components.light.Light attribute), 34 tant.helpers.config_validation), 96 entity_description (homeassis- ensure_list_csv() (in module homeassis- tant.components.light.LightEntity attribute), tant.helpers.config_validation), 96 34 ensure_unique_string() (in module homeassis- entity_description (homeassis- tant.util), 153 tant.components.lock.LockDevice attribute), ensure_valid() (homeassis- 37 tant.helpers.template.Template method), entity_description (homeassis- 140 tant.components.lock.LockEntity attribute), entities (homeassistant.helpers.event.TrackStates at- 37 tribute), 119 entity_description (homeassis- entities() (homeassis- tant.components.media_player.MediaPlayerDevice tant.helpers.entity_component.EntityComponent attribute), 39 property), 112 entity_description (homeassis- entities_domain() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.config_validation), 96 attribute), 40 Entity (class in homeassistant.helpers.entity), 106 entity_description (homeassis- entity_description (homeassis- tant.components.remote.RemoteDevice at- tant.components.air_quality.AirQualityEntity tribute), 46 attribute), 11 entity_description (homeassis- entity_description (homeassis- tant.components.remote.RemoteEntity at- tant.components.alarm_control_panel.AlarmControlPanel tribute), 46 attribute), 12 entity_description (homeassis- entity_description (homeassis- tant.components.sensor.SensorEntity attribute), tant.components.alarm_control_panel.AlarmControlPanelEntity49 attribute), 13 entity_description (homeassis- entity_description (homeassis- tant.components.switch.SwitchDevice at- tant.components.binary_sensor.BinarySensorDevice tribute), 47 attribute), 15 entity_description (homeassis- entity_description (homeassis- tant.components.switch.SwitchEntity attribute), tant.components.binary_sensor.BinarySensorEntity 48 attribute), 15 entity_description (homeassis- entity_description (homeassis- tant.components.vacuum.StateVacuumDevice tant.components.calendar.CalendarEventDevice attribute), 50 attribute), 22 entity_description (homeassis- entity_description (homeassis- tant.components.vacuum.StateVacuumEntity tant.components.camera.Camera attribute), attribute), 50 17 entity_description (homeassis- entity_description (homeassis- tant.components.vacuum.VacuumDevice tant.components.climate.ClimateDevice at- attribute), 51 tribute), 23 entity_description (homeassis- entity_description (homeassis- tant.components.vacuum.VacuumEntity at- tant.components.climate.ClimateEntity at- tribute), 52 tribute), 24 entity_description (homeassis- entity_description (homeassis- tant.components.water_heater.WaterHeaterDevice tant.components.cover.CoverDevice attribute), attribute), 53 28 entity_description (homeassis- entity_description (homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.cover.CoverEntity attribute), attribute), 53

Index 191 Home Assistant Documentation, Release 2021.10.0.dev0 entity_description (homeassis- tant.helpers.entity_registry), 114 tant.components.weather.WeatherEntity at- EntityRegistryDisabledHandler (class in tribute), 56 homeassistant.config_entries), 64 entity_description (homeassis- EntityValues (class in homeassis- tant.helpers.entity.Entity attribute), 108 tant.helpers.entity_values), 117 entity_description (homeassis- entry_type (homeassis- tant.helpers.entity.ToggleEntity attribute), tant.helpers.device_registry.DeviceEntry 110 attribute), 101 entity_description (homeassis- entry_type (homeassistant.helpers.entity.DeviceInfo tant.helpers.restore_state.RestoreEntity at- attribute), 106 tribute), 130 enum() (in module homeassis- entity_description (homeassis- tant.helpers.config_validation), 96 tant.helpers.update_coordinator.CoordinatorEntityerror_str() (homeassis- attribute), 146 tant.helpers.check_config.HomeAssistantConfig entity_domain() (in module homeassis- property), 82 tant.helpers.config_validation), 96 Event (class in homeassistant.core), 67 entity_id (homeassistant.helpers.entity.Entity at- event (homeassistant.helpers.event.SunListener at- tribute), 108 tribute), 118 entity_id (homeassis- event() (homeassistant.components.calendar.CalendarEventDevice tant.helpers.entity_registry.RegistryEntry property), 22 attribute), 115 EventBus (class in homeassistant.core), 68 entity_id() (homeassis- EventOrigin (class in homeassistant.core), 68 tant.helpers.template.TemplateState property), execute_service() (homeassis- 141 tant.helpers.service.ReloadServiceHelper entity_id() (in module homeassis- method), 132 tant.helpers.config_validation), 96 expand() (in module homeassistant.helpers.template), entity_ids() (homeassistant.core.StateMachine 142 method), 72 ExtendedJSONEncoder (class in homeassis- entity_ids() (in module homeassis- tant.helpers.json), 128 tant.helpers.config_validation), 96 extra_authorize_data() (homeassis- entity_picture() (homeassis- tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler tant.components.camera.Camera property), property), 91 17 extra_authorize_data() (homeassis- entity_picture() (homeassis- tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation tant.components.media_player.MediaPlayerEntity property), 93 property), 40 extra_state_attributes() (homeassis- entity_picture() (homeassis- tant.helpers.entity.Entity property), 108 tant.helpers.entity.Entity property), 108 extra_urls (homeassis- entity_registry_enabled_default (home- tant.components.media_player.MediaPlayerImageView assistant.helpers.entity.EntityDescription attribute), 44 attribute), 109 extract_domain_configs() (in module homeas- entity_registry_enabled_default() (home- sistant.helpers), 79 assistant.helpers.entity.Entity property), 108 extract_entity_ids() (in module homeassis- entity_service_call() (in module homeassis- tant.helpers.service), 136 tant.helpers.service), 136 extract_inputs() (in module homeassis- entity_sources() (in module homeassis- tant.util.yaml), 155 tant.helpers.entity), 110 EntityComponent (class in homeassis- F tant.helpers.entity_component), 111 fahrenheit_to_celsius() (in module homeassis- EntityDescription (class in homeassis- tant.util.temperature), 165 tant.helpers.entity), 109 fail_when_undefined() (in module homeassis- EntityPlatform (class in homeassis- tant.helpers.template), 143 tant.helpers.entity_platform), 112 fan_mode() (homeassis- EntityRegistry (class in homeassis- tant.components.climate.ClimateEntity prop-

192 Index Home Assistant Documentation, Release 2021.10.0.dev0

erty), 24 homeassistant.util.json), 161 fan_modes() (homeassis- frame_interval() (homeassis- tant.components.climate.ClimateEntity prop- tant.components.camera.Camera property), erty), 24 17 FanEntity (class in homeassistant.components.fan), from_csv_row() (homeassis- 30 tant.components.light.Profile class method), FanEntityDescription (class in homeassis- 35 tant.components.fan), 32 from_dict() (homeassistant.core.State class method), filter() (homeassis- 71 tant.util.logging.HideSensitiveDataFilter from_dict() (homeassis- method), 162 tant.helpers.restore_state.StoredState class filter_turn_off_params() (in module homeas- method), 130 sistant.components.light), 36 from_json() (in module homeassis- filter_turn_on_params() (in module homeassis- tant.helpers.template), 143 tant.components.light), 36 from_node() (homeassistant.util.yaml.Input class find_coordinates() (in module homeassis- method), 154 tant.helpers.location), 128 function() (homeassis- find_next_time_expression_time() (in mod- tant.helpers.debounce.Debouncer property), ule homeassistant.util.dt), 159 100 find_paths_unserializable_data() (in mod- ule homeassistant.util.json), 160 G fire() (homeassistant.core.EventBus method), 68 g (homeassistant.util.color.RGBColor attribute), 156 fire_coroutine_threadsafe() (in module gallon_to_liter() (in module homeassis- homeassistant.util.async_), 155 tant.util.volume), 166 FlowError, 75 GamutType (class in homeassistant.util.color), 156 FlowHandler (class in homeassis- gather_with_concurrency() (in module home- tant.data_entry_flow), 75 assistant.util.async_), 156 FlowManager (class in homeassis- gen_result_wrapper() (in module homeassis- tant.data_entry_flow), 75 tant.helpers.template), 143 FlowManagerIndexView (class in homeassis- generate_entity_id() (in module homeassis- tant.helpers.data_entry_flow), 99 tant.helpers.entity), 110 FlowManagerResourceView (class in homeassis- generate_filter() (in module homeassis- tant.helpers.data_entry_flow), 99 tant.helpers.entityfilter), 118 FlowResult (class in homeassistant.data_entry_flow), generate_id() (homeassis- 76 tant.helpers.area_registry.AreaEntry method), force_update (homeassis- 80 tant.helpers.entity.EntityDescription attribute), generate_id() (homeassis- 109 tant.helpers.collection.IDManager method), force_update() (homeassistant.helpers.entity.Entity 83 property), 108 get() (homeassistant.components.calendar.CalendarEventView Forecast (class in homeassis- method), 22 tant.components.weather), 56 get() (homeassistant.components.calendar.CalendarListView forecast() (homeassis- method), 22 tant.components.weather.WeatherEntity get() (homeassistant.components.camera.CameraView property), 56 method), 19 forgiving_as_timestamp() (in module homeas- get() (homeassistant.components.media_player.MediaPlayerImageView sistant.helpers.template), 143 method), 44 forgiving_float() (in module homeassis- get() (homeassistant.core.StateMachine method), 72 tant.helpers.template), 143 get() (homeassistant.helpers.config_entry_oauth2_flow.OAuth2AuthorizeCallbackView forgiving_round() (in module homeassis- method), 93 tant.helpers.template), 143 get() (homeassistant.helpers.data_entry_flow.FlowManagerResourceView format_mac() (in module homeassis- method), 99 tant.helpers.device_registry), 104 get() (homeassistant.helpers.entity_values.EntityValues format_unserializable_data() (in module method), 117

Index 193 Home Assistant Documentation, Release 2021.10.0.dev0

get() (homeassistant.util.yaml.Secrets method), 154 129 get_age() (in module homeassistant.util.dt), 160 green (homeassistant.util.color.GamutType attribute), get_astral_event_date() (in module homeassis- 156 tant.helpers.sun), 138 Group (class in homeassistant.auth.models),7 get_astral_event_next() (in module homeassis- group_members() (homeassis- tant.helpers.sun), 138 tant.components.media_player.MediaPlayerEntity get_astral_location() (in module homeassis- property), 40 tant.helpers.sun), 138 groups (homeassistant.auth.models.User attribute),8 get_auth_mfa_module() (homeassis- tant.auth.AuthManager method),4 H get_auth_provider() (homeassis- handle() (homeassis- tant.auth.AuthManager method),4 tant.components.camera.CameraImageView get_auth_providers() (homeassis- method), 19 tant.auth.AuthManager method),4 handle() (homeassis- get_browse_image_url() (homeassis- tant.components.camera.CameraMjpegStream tant.components.media_player.MediaPlayerEntity method), 19 method), 40 handle() (homeassis- get_capability() (in module homeassis- tant.components.camera.CameraView method), tant.helpers.entity), 110 19 get_changed_since() (in module homeassis- handle() (homeassis- tant.helpers.state), 137 tant.util.logging.HomeAssistantQueueHandler get_closest_point_to_line() (in module method), 162 homeassistant.util.color), 158 handle_async_mjpeg_stream() (homeassis- get_closest_point_to_point() (in module tant.components.camera.Camera method), homeassistant.util.color), 158 18 get_component() (homeassistant.loader.Integration handle_async_still_stream() (homeassis- method), 149 tant.components.camera.Camera method), get_date() (in module homeassis- 18 tant.components.calendar), 23 has_any_selector() (homeassis- get_deprecated() (in module homeassis- tant.helpers.service.ServiceTargetSelector tant.helpers.deprecation), 100 property), 133 get_device_class() (in module homeassis- has_at_least_one_key() (in module homeassis- tant.helpers.entity), 110 tant.helpers.config_validation), 96 get_distance_between_two_points() (in has_at_most_one_key() (in module homeassis- module homeassistant.util.color), 159 tant.helpers.config_validation), 96 get_entity() (homeassis- has_id() (homeassis- tant.helpers.entity_component.EntityComponent tant.helpers.collection.IDManager method), method), 112 83 get_local_ip (in module homeassistant.util), 153 has_location() (in module homeassis- get_location_astral_event_next() (in mod- tant.helpers.location), 128 ule homeassistant.helpers.sun), 138 has_service() (homeassistant.core.ServiceRegistry get_platform() (homeassistant.loader.Integration method), 71 method), 149 hass (homeassistant.components.notify.BaseNotificationService get_random_string() (in module homeassis- attribute), 45 tant.util), 153 hass (homeassistant.helpers.entity.Entity attribute), 108 get_supported_color_modes() (in module hass (homeassistant.helpers.event.SunListener at- homeassistant.components.light), 36 tribute), 118 get_supported_features() (in module homeas- hass (homeassistant.helpers.intent.Intent attribute), 126 sistant.helpers.entity), 111 hass (homeassistant.helpers.template.Template at- get_time_zone() (in module homeassistant.util.dt), tribute), 140 160 hass() (homeassistant.helpers.collection.StorageCollection get_unit_of_measurement() (in module home- property), 84 assistant.helpers.entity), 111 HassJob (class in homeassistant.core), 69 get_url() (in module homeassistant.helpers.network), HassJobType (class in homeassistant.core), 69

194 Index Home Assistant Documentation, Release 2021.10.0.dev0

head() (homeassistant.components.webhook.WebhookViewhomeassistant.exceptions (module), 77 method), 58 homeassistant.helpers (module), 79 Helpers (class in homeassistant.loader), 149 homeassistant.helpers.aiohttp_client HideSensitiveDataFilter (class in homeassis- (module), 79 tant.util.logging), 162 homeassistant.helpers.area_registry HomeAssistant (class in homeassistant.core), 69 (module), 80 homeassistant.auth (module),3 homeassistant.helpers.check_config (mod- homeassistant.auth.auth_store (module),5 ule), 82 homeassistant.auth.const (module),6 homeassistant.helpers.collection (mod- homeassistant.auth.models (module),7 ule), 82 homeassistant.bootstrap (module),9 homeassistant.helpers.condition (module), homeassistant.components.air_quality 85 (module), 11 homeassistant.helpers.config_entry_flow homeassistant.components.alarm_control_panel (module), 89 (module), 12 homeassistant.helpers.config_entry_oauth2_flow homeassistant.components.binary_sensor (module), 91 (module), 15 homeassistant.helpers.config_validation homeassistant.components.calendar (mod- (module), 95 ule), 22 homeassistant.helpers.data_entry_flow homeassistant.components.camera (module), (module), 99 17 homeassistant.helpers.debounce (module), homeassistant.components.climate (mod- 99 ule), 23 homeassistant.helpers.deprecation (mod- homeassistant.components.conversation ule), 100 (module), 27 homeassistant.helpers.device_registry homeassistant.components.cover (module), (module), 100 28 homeassistant.helpers.discovery (module), homeassistant.components.device_tracker 104 (module), 30 homeassistant.helpers.dispatcher (mod- homeassistant.components.fan (module), 30 ule), 105 homeassistant.components.light (module), homeassistant.helpers.entity (module), 106 34 homeassistant.helpers.entity_component homeassistant.components.lock (module), 37 (module), 111 homeassistant.components.media_player homeassistant.helpers.entity_platform (module), 38 (module), 112 homeassistant.components.notify (module), homeassistant.helpers.entity_registry 45 (module), 114 homeassistant.components.remote (module), homeassistant.helpers.entity_values 46 (module), 117 homeassistant.components.sensor (module), homeassistant.helpers.entityfilter (mod- 49 ule), 118 homeassistant.components.switch (module), homeassistant.helpers.event (module), 118 47 homeassistant.helpers.icon (module), 125 homeassistant.components.vacuum (module), homeassistant.helpers.integration_platform 50 (module), 125 homeassistant.components.water_heater homeassistant.helpers.intent (module), 126 (module), 53 homeassistant.helpers.json (module), 128 homeassistant.components.weather (mod- homeassistant.helpers.location (module), ule), 56 128 homeassistant.components.webhook (mod- homeassistant.helpers.logging (module), ule), 58 129 homeassistant.config_entries (module), 61 homeassistant.helpers.network (module), homeassistant.core (module), 67 129 homeassistant.data_entry_flow (module), 75 homeassistant.helpers.restore_state

Index 195 Home Assistant Documentation, Release 2021.10.0.dev0

(module), 130 humidity() (homeassis- homeassistant.helpers.script (module), 131 tant.components.weather.WeatherEntity homeassistant.helpers.service (module), property), 56 132 hvac_action() (homeassis- homeassistant.helpers.signal (module), 136 tant.components.climate.ClimateEntity prop- homeassistant.helpers.state (module), 137 erty), 24 homeassistant.helpers.storage (module), hvac_mode() (homeassis- 137 tant.components.climate.ClimateEntity prop- homeassistant.helpers.sun (module), 138 erty), 24 homeassistant.helpers.system_info (mod- hvac_modes() (homeassis- ule), 139 tant.components.climate.ClimateEntity prop- homeassistant.helpers.temperature (mod- erty), 24 ule), 139 homeassistant.helpers.template (module), I 139 icon (homeassistant.helpers.entity.EntityDescription at- homeassistant.helpers.translation (mod- tribute), 109 ule), 145 icon (homeassistant.helpers.entity_registry.RegistryEntry homeassistant.helpers.typing (module), 146 attribute), 115 homeassistant.helpers.update_coordinatoricon() (homeassistant.helpers.entity.Entity property), (module), 146 108 homeassistant.loader (module), 149 icon() (in module homeassis- homeassistant.util (module), 153 tant.helpers.config_validation), 97 homeassistant.util.aiohttp (module), 155 icon_for_battery_level() (in module homeas- homeassistant.util.async_ (module), 155 sistant.helpers.icon), 125 homeassistant.util.color (module), 156 icon_for_signal_level() (in module homeassis- homeassistant.util.decorator (module), 159 tant.helpers.icon), 125 homeassistant.util.distance (module), 159 id (homeassistant.auth.models.Credentials attribute),7 homeassistant.util.dt (module), 159 id (homeassistant.auth.models.Group attribute),7 homeassistant.util.json (module), 160 id (homeassistant.auth.models.RefreshToken attribute), homeassistant.util.location (module), 161 7 homeassistant.util.logging (module), 162 id (homeassistant.auth.models.User attribute),8 homeassistant.util.network (module), 163 id (homeassistant.helpers.area_registry.AreaEntry at- homeassistant.util.package (module), 164 tribute), 80 homeassistant.util.pil (module), 164 id (homeassistant.helpers.device_registry.DeletedDeviceEntry homeassistant.util.pressure (module), 164 attribute), 100 homeassistant.util.ssl (module), 165 id (homeassistant.helpers.device_registry.DeviceEntry homeassistant.util.temperature (module), attribute), 101 165 identifiers (homeassis- homeassistant.util.unit_system (module), tant.helpers.device_registry.DeletedDeviceEntry 165 attribute), 100 homeassistant.util.volume (module), 166 identifiers (homeassis- homeassistant.util.yaml (module), 154 tant.helpers.device_registry.DeviceEntry HomeAssistantConfig (class in homeassis- attribute), 101 tant.helpers.check_config), 82 identifiers (homeassis- HomeAssistantError, 77 tant.helpers.entity.DeviceInfo attribute), HomeAssistantQueueHandler (class in homeas- 106 sistant.util.logging), 162 IDLessCollection (class in homeassis- homekit() (homeassistant.loader.Integration prop- tant.helpers.collection), 83 erty), 150 IDManager (class in homeassistant.helpers.collection), hs_color (homeassistant.components.light.Profile at- 83 tribute), 35 Image (class in homeassistant.components.camera), 19 hs_color() (homeassis- indirectly_referenced (homeassis- tant.components.light.LightEntity property), tant.helpers.service.SelectedEntities attribute), 34 133

196 Index Home Assistant Documentation, Release 2021.10.0.dev0

Input (class in homeassistant.util.yaml), 154 is_closing() (homeassis- install_package() (in module homeassis- tant.components.cover.CoverEntity property), tant.util.package), 164 29 Integration (class in homeassistant.loader), 149 is_complex() (in module homeassis- IntegrationError, 77 tant.helpers.template), 143 IntegrationNotFound, 150 is_device_attr() (in module homeassis- Intent (class in homeassistant.helpers.intent), 126 tant.helpers.template), 143 intent_type (homeassistant.helpers.intent.Intent at- is_docker_env() (in module homeassis- tribute), 126 tant.util.package), 164 intent_type (homeassis- is_installed() (in module homeassis- tant.helpers.intent.IntentHandler attribute), tant.util.package), 164 126 is_internal_request() (in module homeassis- IntentError, 126 tant.helpers.network), 129 IntentHandleError, 126 is_invalid() (in module homeassis- IntentHandler (class in homeassis- tant.util.network), 163 tant.helpers.intent), 126 is_ip_address() (in module homeassis- IntentResponse (class in homeassis- tant.util.network), 163 tant.helpers.intent), 126 is_jammed() (homeassis- IntentUnexpectedError, 127 tant.components.lock.LockEntity property), invalidate_permission_cache() (homeassis- 37 tant.auth.models.User method),8 is_link_local() (in module homeassis- InvalidAuthError,5 tant.util.network), 163 InvalidEntityFormatError, 77 is_local() (in module homeassistant.util.network), InvalidProvider,5 163 InvalidSlotInfo, 127 is_locked() (homeassis- InvalidStateError, 77 tant.components.lock.LockEntity property), iot_class() (homeassistant.loader.Integration prop- 37 erty), 150 is_locking() (homeassis- ip (homeassistant.util.location.LocationInfo attribute), tant.components.lock.LockEntity property), 161 37 is_active (homeassistant.auth.models.User at- is_loopback() (in module homeassis- tribute),8 tant.util.network), 163 is_active (homeassistant.auth.models.UserMeta at- is_metric() (homeassis- tribute),8 tant.util.unit_system.UnitSystem property), is_admin() (homeassistant.auth.models.User prop- 165 erty),8 is_new (homeassistant.auth.models.Credentials at- is_allowed_external_url() (homeassis- tribute),7 tant.core.Config method), 67 is_new (homeassistant.helpers.device_registry.DeviceEntry is_allowed_path() (homeassistant.core.Config attribute), 101 method), 67 is_number() (in module homeassis- is_aux_heat() (homeassis- tant.helpers.template), 143 tant.components.climate.ClimateEntity prop- is_offset_reached() (in module homeassis- erty), 24 tant.components.calendar), 23 is_away_mode_on() (homeassis- is_on() (homeassistant.components.binary_sensor.BinarySensorEntity tant.components.water_heater.WaterHeaterEntity property), 15 property), 53 is_on() (homeassistant.components.camera.Camera is_built_in() (homeassistant.loader.Integration property), 18 property), 150 is_on() (homeassistant.components.fan.FanEntity is_callback() (in module homeassistant.core), 73 property), 31 is_closed() (homeassis- is_on() (homeassistant.helpers.entity.ToggleEntity tant.components.cover.CoverEntity property), property), 110 28 is_on() (in module homeassis- is_closed() (in module homeassis- tant.components.device_tracker), 30 tant.components.cover), 30 is_on() (in module homeassistant.components.fan), 33

Index 197 Home Assistant Documentation, Release 2021.10.0.dev0

is_on() (in module homeassistant.components.light), property), 40 36 isdevice() (in module homeassis- is_on() (in module homeassis- tant.helpers.config_validation), 97 tant.components.media_player), 45 isdir() (in module homeassis- is_on() (in module homeassis- tant.helpers.config_validation), 97 tant.components.remote), 47 isfile() (in module homeassis- is_on() (in module homeassistant.components.switch), tant.helpers.config_validation), 97 48 issue_tracker() (homeassistant.loader.Integration is_on() (in module homeassis- property), 150 tant.components.vacuum), 52 item (homeassistant.helpers.collection.CollectionChangeSet is_opening() (homeassis- attribute), 82 tant.components.cover.CoverEntity property), item_id (homeassistant.helpers.collection.CollectionChangeSet 29 attribute), 82 is_owner (homeassistant.auth.models.User attribute), item_id_key() (homeassis- 8 tant.helpers.collection.StorageCollectionWebsocket is_private() (in module homeassis- property), 84 tant.util.network), 163 ItemNotFound, 83 is_recording() (homeassis- tant.components.camera.Camera property), J 18 job (homeassistant.helpers.event.SunListener attribute), is_regex() (in module homeassis- 118 tant.helpers.config_validation), 97 join_players() (homeassis- is_running() (homeassistant.core.HomeAssistant tant.components.media_player.MediaPlayerEntity property), 70 method), 40 is_running() (homeassistant.helpers.script.Script json() (homeassistant.util.aiohttp.MockRequest property), 131 method), 155 is_safe_attribute() (homeassis- JSONEncoder (class in homeassistant.helpers.json), tant.helpers.template.TemplateEnvironment 128 method), 141 jwt_key (homeassistant.auth.models.RefreshToken at- is_safe_callable() (homeassis- tribute),7 tant.helpers.template.TemplateEnvironment method), 141 K is_state() (homeassistant.core.StateMachine kelvin_to_celsius() (in module homeassis- method), 72 tant.util.temperature), 165 is_state() (in module homeassis- key (homeassistant.components.alarm_control_panel.AlarmControlPanelEntityDescription tant.helpers.template), 143 attribute), 14 is_state_attr() (in module homeassis- key (homeassistant.components.binary_sensor.BinarySensorEntityDescription tant.helpers.template), 143 attribute), 16 is_static (homeassistant.helpers.template.Template key (homeassistant.components.camera.CameraEntityDescription attribute), 140 attribute), 18 is_stopping() (homeassistant.core.HomeAssistant key (homeassistant.components.climate.ClimateEntityDescription property), 70 attribute), 26 is_template_string() (in module homeassis- key (homeassistant.components.cover.CoverEntityDescription tant.helpers.template), 143 attribute), 29 is_unlocking() (homeassis- key (homeassistant.components.fan.FanEntityDescription tant.components.lock.LockEntity property), attribute), 32 37 key (homeassistant.components.light.LightEntityDescription is_up() (in module homeassistant.helpers.sun), 138 attribute), 35 is_valid_unit() (in module homeassis- key (homeassistant.components.lock.LockEntityDescription tant.util.unit_system), 166 attribute), 38 is_virtual_env() (in module homeassis- key (homeassistant.components.media_player.MediaPlayerEntityDescription tant.util.package), 164 attribute), 44 is_volume_muted() (homeassis- key (homeassistant.components.remote.RemoteEntityDescription tant.components.media_player.MediaPlayerEntity attribute), 47

198 Index Home Assistant Documentation, Release 2021.10.0.dev0 key (homeassistant.components.switch.SwitchEntityDescriptionLight (class in homeassistant.components.light), 34 attribute), 48 LightEntity (class in homeassis- key (homeassistant.components.vacuum.StateVacuumEntityDescriptiontant.components.light), 34 attribute), 51 LightEntityDescription (class in homeassis- key (homeassistant.components.vacuum.VacuumEntityDescription tant.components.light), 35 attribute), 52 listen() (homeassistant.core.EventBus method), 68 key (homeassistant.components.water_heater.WaterHeaterEntityEntityDescriptionlisten_once() (homeassistant.core.EventBus attribute), 55 method), 68 key (homeassistant.components.weather.WeatherEntityDescriptionlisteners() (homeassistant.core.EventBus property), attribute), 57 68 key (homeassistant.helpers.entity.EntityDescription at- liter_to_gallon() (in module homeassis- tribute), 109 tant.util.volume), 166 key (homeassistant.helpers.entity.ToggleEntityDescription load_json() (in module homeassistant.util.json), 161 attribute), 110 load_platform() (in module homeassis- key_dependency() (in module homeassis- tant.helpers.discovery), 105 tant.helpers.config_validation), 97 load_translations_files() (in module home- key_value_schemas() (in module homeassis- assistant.helpers.translation), 145 tant.helpers.config_validation), 97 load_yaml() (in module homeassistant.util.yaml), 154 KeywordMessage (class in homeassis- LoaderError, 150 tant.helpers.logging), 129 LocalOAuth2Implementation (class in homeas- KeywordStyleAdapter (class in homeassis- sistant.helpers.config_entry_oauth2_flow), 92 tant.helpers.logging), 129 LocationInfo (class in homeassistant.util.location), 161 L lock() (homeassistant.components.lock.LockEntity last_changed() (homeassis- method), 37 tant.helpers.template.TemplateState property), LockDevice (class in homeassistant.components.lock), 141 37 last_reset (homeassis- LockEntity (class in homeassistant.components.lock), tant.components.sensor.SensorEntityDescription 37 attribute), 49 LockEntityDescription (class in homeassis- last_reset() (homeassis- tant.components.lock), 37 tant.components.sensor.SensorEntity property), log() (homeassistant.helpers.logging.KeywordStyleAdapter 49 method), 129 last_result (homeassis- log_exception() (in module homeassis- tant.helpers.event.TrackTemplateResult at- tant.util.logging), 163 tribute), 119 log_missing() (homeassis- last_updated() (homeassis- tant.helpers.service.SelectedEntities method), tant.helpers.template.TemplateState property), 133 141 logarithm() (in module homeassis- last_used_at (homeassis- tant.helpers.template), 143 tant.auth.models.RefreshToken attribute), logger() (homeassis- 7 tant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandler last_used_ip (homeassis- property), 91 tant.auth.models.RefreshToken attribute), LoggingUndefined (class in homeassis- 8 tant.helpers.template), 139 latitude (homeassistant.util.location.LocationInfo at- longitude (homeassistant.util.location.LocationInfo tribute), 161 attribute), 161 learn_command() (homeassis- tant.components.remote.RemoteEntity method), M 46 make_entity_service_schema() (in module legacy_supported_features() (in module homeassistant.helpers.config_validation), 97 homeassistant.components.light), 36 make_script_schema() (in module homeassis- length() (homeassistant.util.unit_system.UnitSystem tant.helpers.script), 132 method), 165 Manifest (class in homeassistant.loader), 150

Index 199 Home Assistant Documentation, Release 2021.10.0.dev0 manifest_from_legacy_module() (in module property), 41 homeassistant.loader), 151 media_image_remotely_accessible() (home- manufacturer (homeassis- assistant.components.media_player.MediaPlayerEntity tant.helpers.device_registry.DeviceEntry property), 41 attribute), 101 media_image_url() (homeassis- manufacturer (homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.entity.DeviceInfo attribute), property), 41 106 media_next_track() (homeassis- match_all() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.config_validation), 97 method), 41 matches_regex() (in module homeassis- media_pause() (homeassis- tant.helpers.config_validation), 97 tant.components.media_player.MediaPlayerEntity max_humidity() (homeassis- method), 41 tant.components.climate.ClimateEntity prop- media_play() (homeassis- erty), 24 tant.components.media_player.MediaPlayerEntity max_mireds() (homeassis- method), 41 tant.components.light.LightEntity property), media_playlist() (homeassis- 34 tant.components.media_player.MediaPlayerEntity max_temp() (homeassis- property), 41 tant.components.climate.ClimateEntity prop- media_position() (homeassis- erty), 24 tant.components.media_player.MediaPlayerEntity max_temp() (homeassis- property), 41 tant.components.water_heater.WaterHeaterEntity media_position_updated_at() (homeassis- property), 53 tant.components.media_player.MediaPlayerEntity MaxLengthExceeded, 77 property), 41 media_album_artist() (homeassis- media_previous_track() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 method), 41 media_album_name() (homeassis- media_season() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 property), 41 media_artist() (homeassis- media_seek() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 method), 41 media_channel() (homeassis- media_series_title() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 property), 42 media_content_id() (homeassis- media_stop() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 method), 42 media_content_type() (homeassis- media_title() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 property), 42 media_duration() (homeassis- media_track() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player.MediaPlayerEntity property), 41 property), 42 media_episode() (homeassis- MediaPlayerDevice (class in homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player), 38 property), 41 MediaPlayerEntity (class in homeassis- media_image_hash() (homeassis- tant.components.media_player), 39 tant.components.media_player.MediaPlayerEntityMediaPlayerEntityDescription (class in home- property), 41 assistant.components.media_player), 43 media_image_local() (homeassis- MediaPlayerImageView (class in homeassis- tant.components.media_player.MediaPlayerEntity tant.components.media_player), 44

200 Index Home Assistant Documentation, Release 2021.10.0.dev0

message (homeassistant.helpers.check_config.CheckConfigErrorname (homeassistant.components.camera.CameraImageView attribute), 82 attribute), 19 min_humidity() (homeassis- name (homeassistant.components.camera.CameraMjpegStream tant.components.climate.ClimateEntity prop- attribute), 19 erty), 24 name (homeassistant.components.conversation.ConversationProcessView min_mireds() (homeassis- attribute), 27 tant.components.light.LightEntity property), name (homeassistant.components.light.Profile attribute), 34 35 min_temp() (homeassis- name (homeassistant.components.media_player.MediaPlayerImageView tant.components.climate.ClimateEntity prop- attribute), 44 erty), 24 name (homeassistant.components.webhook.WebhookView min_temp() (homeassis- attribute), 58 tant.components.water_heater.WaterHeaterEntity name (homeassistant.helpers.area_registry.AreaEntry at- property), 53 tribute), 81 missing_areas (homeassis- name (homeassistant.helpers.config_entry_oauth2_flow.OAuth2AuthorizeCallbackView tant.helpers.service.SelectedEntities attribute), attribute), 93 133 name (homeassistant.helpers.device_registry.DeviceEntry missing_devices (homeassis- attribute), 101 tant.helpers.service.SelectedEntities attribute), name (homeassistant.helpers.entity.DeviceInfo at- 133 tribute), 106 mock_source (homeassis- name (homeassistant.helpers.entity.EntityDescription at- tant.util.aiohttp.MockRequest attribute), tribute), 109 155 name (homeassistant.helpers.entity_registry.RegistryEntry MockRequest (class in homeassistant.util.aiohttp), 155 attribute), 115 MockStreamReader (class in homeassis- name (homeassistant.util.yaml.Input attribute), 154 tant.util.aiohttp), 155 name() (homeassistant.core.State property), 71 model (homeassistant.helpers.device_registry.DeviceEntryname() (homeassistant.helpers.config_entry_oauth2_flow.AbstractOAuth2Implementation attribute), 101 property), 92 model (homeassistant.helpers.entity.DeviceInfo at- name() (homeassistant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation tribute), 106 property), 93 model() (homeassistant.components.camera.Camera name() (homeassistant.helpers.entity.Entity property), property), 18 108 ModuleWrapper (class in homeassistant.loader), 150 name() (homeassistant.helpers.template.TemplateState motion_detection_enabled() (homeassis- property), 141 tant.components.camera.Camera property), name() (homeassistant.loader.Integration property), 18 150 mqtt() (homeassistant.loader.Integration property), name_by_user (homeassis- 150 tant.helpers.device_registry.DeviceEntry multi_select (class in homeassis- attribute), 101 tant.helpers.config_validation), 97 native_unit_of_measurement (homeassis- multiply() (in module homeassis- tant.components.sensor.SensorEntityDescription tant.helpers.template), 143 attribute), 49 mute_volume() (homeassis- native_unit_of_measurement() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.sensor.SensorEntity property), method), 42 49 native_value() (homeassis- N tant.components.sensor.SensorEntity property), name (homeassistant.auth.models.Group attribute),7 49 name (homeassistant.auth.models.User attribute),8 nitrogen_dioxide() (homeassis- name (homeassistant.auth.models.UserMeta attribute),8 tant.components.air_quality.AirQualityEntity name (homeassistant.components.calendar.CalendarEventView property), 11 attribute), 22 nitrogen_monoxide() (homeassis- name (homeassistant.components.calendar.CalendarListView tant.components.air_quality.AirQualityEntity attribute), 22 property), 11

Index 201 Home Assistant Documentation, Release 2021.10.0.dev0 nitrogen_oxide() (homeassis- OptionsFlow (class in homeassistant.config_entries), tant.components.air_quality.AirQualityEntity 64 property), 11 OptionsFlowManager (class in homeassis- NoEntitySpecifiedError, 78 tant.config_entries), 64 normalize_area_name() (in module homeassis- OrderedEnum (class in homeassistant.util), 153 tant.helpers.area_registry), 81 ordinal() (in module homeassis- normalize_event() (in module homeassis- tant.helpers.template), 143 tant.components.calendar), 23 original_icon (homeassis- normalize_url() (in module homeassis- tant.helpers.entity_registry.RegistryEntry tant.util.network), 163 attribute), 116 normalized_name (homeassis- original_name (homeassis- tant.helpers.area_registry.AreaEntry attribute), tant.helpers.entity_registry.RegistryEntry 81 attribute), 116 notify_changes() (homeassis- orphaned_timestamp (homeassis- tant.helpers.collection.ObservableCollection tant.helpers.device_registry.DeletedDeviceEntry method), 83 attribute), 101 NotValidPresetModeError, 32 oscillate() (homeassis- NotValidSpeedError, 33 tant.components.fan.FanEntity method), NoURLAvailableError, 129 31 NoValidSpeedsError, 32 oscillating() (homeassis- now() (in module homeassistant.helpers.template), 143 tant.components.fan.FanEntity property), now() (in module homeassistant.util.dt), 160 31 numeric_state() (in module homeassis- output() (homeassistant.exceptions.ConditionError tant.helpers.condition), 88 method), 77 output() (homeassis- O tant.exceptions.ConditionErrorContainer OAuth2AuthorizeCallbackView (class in home- method), 77 assistant.helpers.config_entry_oauth2_flow), output() (homeassis- 93 tant.exceptions.ConditionErrorIndex method), OAuth2Session (class in homeassis- 77 tant.helpers.config_entry_oauth2_flow), output() (homeassis- 93 tant.exceptions.ConditionErrorMessage object_id() (homeassis- method), 77 tant.helpers.template.TemplateState property), ozone() (homeassistant.components.air_quality.AirQualityEntity 141 property), 11 ObservableCollection (class in homeassis- ozone() (homeassistant.components.weather.WeatherEntity tant.helpers.collection), 83 property), 56 offset (homeassistant.helpers.event.SunListener at- tribute), 118 P open() (homeassistant.components.lock.LockEntity parallel_updates (homeassis- method), 37 tant.helpers.entity.Entity attribute), 108 open_cover() (homeassis- parse_date() (in module homeassistant.util.dt), 160 tant.components.cover.CoverEntity method), parse_datetime() (in module homeassis- 29 tant.util.dt), 160 open_cover_tilt() (homeassis- parse_time() (in module homeassistant.util.dt), 160 tant.components.cover.CoverEntity method), parse_time_expression() (in module homeassis- 29 tant.util.dt), 160 open_hass_ui() (in module homeassis- parse_yaml() (in module homeassistant.util.yaml), tant.bootstrap),9 154 operation_list() (homeassis- particulate_matter_0_1() (homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.air_quality.AirQualityEntity property), 53 property), 11 OperationNotAllowed, 64 particulate_matter_10() (homeassis- tant.components.air_quality.AirQualityEntity

202 Index Home Assistant Documentation, Release 2021.10.0.dev0

property), 11 precipitation (homeassis- particulate_matter_2_5() (homeassis- tant.components.weather.Forecast attribute), tant.components.air_quality.AirQualityEntity 56 property), 11 precipitation_probability (homeassis- path() (homeassistant.core.Config method), 67 tant.components.weather.Forecast attribute), path() (homeassistant.helpers.storage.Store property), 56 138 precision() (homeassis- path() (in module homeassis- tant.components.climate.ClimateEntity prop- tant.helpers.config_validation), 97 erty), 24 pause() (homeassistant.components.vacuum.StateVacuumEntityprecision() (homeassis- method), 50 tant.components.water_heater.WaterHeaterEntity percentage() (homeassis- property), 53 tant.components.fan.FanEntity property), precision() (homeassis- 31 tant.components.weather.WeatherEntity percentage_step() (homeassis- property), 57 tant.components.fan.FanEntity property), preprocess_turn_on_alternatives() (in 31 module homeassistant.components.light), 36 percentage_to_speed() (homeassis- preset_mode() (homeassis- tant.components.fan.FanEntity method), tant.components.climate.ClimateEntity prop- 31 erty), 25 perm_lookup (homeassistant.auth.models.User preset_mode() (homeassis- attribute),8 tant.components.fan.FanEntity property), permissions() (homeassistant.auth.models.User 31 property),8 preset_modes() (homeassis- platform (homeassis- tant.components.climate.ClimateEntity prop- tant.helpers.discovery.DiscoveryDict attribute), erty), 25 104 preset_modes() (homeassis- platform (homeassistant.helpers.entity.Entity at- tant.components.fan.FanEntity property), tribute), 108 31 platform (homeassis- preset_modes_from_speed_list() (in module tant.helpers.entity_registry.RegistryEntry homeassistant.components.fan), 33 attribute), 116 pressure (homeassis- platform (homeassistant.helpers.intent.Intent at- tant.components.weather.Forecast attribute), tribute), 126 56 PlatformNotReady, 78 pressure() (homeassis- platforms (homeassis- tant.components.weather.WeatherEntity tant.helpers.intent.IntentHandler attribute), property), 57 126 pressure() (homeassis- play_media() (homeassis- tant.util.unit_system.UnitSystem method), tant.components.media_player.MediaPlayerEntity 166 method), 42 process() (homeassis- policy (homeassistant.auth.models.Group attribute),7 tant.helpers.logging.KeywordStyleAdapter positive_timedelta() (in module homeassis- method), 129 tant.helpers.config_validation), 97 process_state_match() (in module homeassis- post() (homeassistant.components.conversation.ConversationProcessViewtant.helpers.event), 123 method), 27 Profile (class in homeassistant.components.light), 35 post() (homeassistant.components.webhook.WebhookViewProfiles (class in homeassistant.components.light), method), 58 35 post() (homeassistant.helpers.data_entry_flow.FlowManagerIndexViewprotect_loop() (in module homeassis- method), 99 tant.util.async_), 156 post() (homeassistant.helpers.data_entry_flow.FlowManagerResourceViewput() (homeassistant.components.webhook.WebhookView method), 99 method), 58 post() (homeassistant.util.aiohttp.MockRequest method), 155

Index 203 Home Assistant Documentation, Release 2021.10.0.dev0

Q region_code (homeassis- quality_scale() (homeassistant.loader.Integration tant.util.location.LocationInfo attribute), property), 150 161 query() (homeassistant.util.aiohttp.MockRequest region_name (homeassis- property), 155 tant.util.location.LocationInfo attribute), 161 R register() (homeassistant.core.ServiceRegistry method), 71 r (homeassistant.util.color.RGBColor attribute), 157 register() (homeassistant.util.decorator.Registry raise_if_invalid_filename() (in module method), 159 homeassistant.util), 153 register_discovery_flow() (in module home- raise_if_invalid_path() (in module homeassis- assistant.helpers.config_entry_flow), 90 tant.util), 153 register_webhook_flow() (in module homeassis- random_every_time() (in module homeassis- tant.helpers.config_entry_flow), 90 tant.helpers.template), 143 registered_targets (homeassis- rate_limit (homeassis- tant.components.notify.BaseNotificationService tant.helpers.event.TrackTemplate attribute), attribute), 45 119 Registry (class in homeassistant.util.decorator), 159 read() (homeassistant.util.aiohttp.MockStreamReader registry_entry (homeassistant.helpers.entity.Entity method), 155 attribute), 108 recoverable() (homeassis- RegistryEntry (class in homeassis- tant.config_entries.ConfigEntryState property), tant.helpers.entity_registry), 115 63 relative_time() (in module homeassis- recursive_flatten() (in module homeassis- tant.helpers.template), 144 tant.helpers.translation), 145 ReloadServiceHelper (class in homeassis- red (homeassistant.util.color.GamutType attribute), 156 tant.helpers.service), 132 redirect_uri() (homeassis- RemoteDevice (class in homeassis- tant.helpers.config_entry_oauth2_flow.LocalOAuth2Implementation tant.components.remote), 46 property), 93 RemoteEntity (class in homeassis- referenced (homeassis- tant.components.remote), 46 tant.helpers.service.SelectedEntities attribute), RemoteEntityDescription (class in homeassis- 133 tant.components.remote), 47 referenced_areas() (homeassis- remove() (homeassistant.core.ServiceRegistry tant.helpers.script.Script property), 131 method), 71 referenced_devices (homeassis- remove() (homeassistant.core.StateMachine method), tant.helpers.service.SelectedEntities attribute), 72 133 remove_falsy() (in module homeassis- referenced_devices() (homeassis- tant.helpers.config_validation), 97 tant.helpers.script.Script property), 131 render() (homeassistant.helpers.template.Template referenced_entities() (homeassis- method), 140 tant.helpers.script.Script property), 131 render_complex() (in module homeassis- refresh_tokens (homeassistant.auth.models.User tant.helpers.template), 144 attribute),8 render_result (homeassis- RefreshToken (class in homeassistant.auth.models),7 tant.helpers.template.ResultWrapper attribute), regex_findall() (in module homeassis- 139 tant.helpers.template), 143 render_result (homeassis- regex_findall_index() (in module homeassis- tant.helpers.template.TupleWrapper attribute), tant.helpers.template), 144 141 regex_match() (in module homeassis- render_with_possible_json_value() (home- tant.helpers.template), 144 assistant.helpers.template.Template method), regex_replace() (in module homeassis- 140 tant.helpers.template), 144 RenderInfo (class in homeassistant.helpers.template), regex_search() (in module homeassis- 139 tant.helpers.template), 144 repeat() (homeassis-

204 Index Home Assistant Documentation, Release 2021.10.0.dev0

tant.components.media_player.MediaPlayerEntity tant.util), 154 property), 42 sanitize_path() (in module homeassistant.util), repr_helper() (in module homeassistant.util), 153 154 RequiredParameterMissing, 78 save_json() (in module homeassistant.util.json), 161 requirements() (homeassistant.loader.Integration save_yaml() (in module homeassistant.util.yaml), 154 property), 150 schedule_update_ha_state() (homeassis- requires_auth (homeassis- tant.helpers.entity.Entity method), 108 tant.components.camera.CameraView at- SCHEMA (homeassistant.components.light.Profile at- tribute), 19 tribute), 35 requires_auth (homeassis- schema_with_slug_keys() (in module homeassis- tant.components.media_player.MediaPlayerImageView tant.helpers.config_validation), 98 attribute), 44 Script (class in homeassistant.helpers.script), 131 requires_auth (homeassis- script_action() (in module homeassis- tant.components.webhook.WebhookView tant.helpers.config_validation), 98 attribute), 58 secret_yaml() (in module homeassistant.util.yaml), requires_auth (homeassis- 154 tant.helpers.config_entry_oauth2_flow.OAuth2AuthorizeCallbackViewSecrets (class in homeassistant.util.yaml), 154 attribute), 93 select_sound_mode() (homeassis- resolve_dependencies() (homeassis- tant.components.media_player.MediaPlayerEntity tant.loader.Integration method), 150 method), 42 resolve_from_root() (homeassis- select_source() (homeassis- tant.loader.Integration class method), 150 tant.components.media_player.MediaPlayerEntity RestoreEntity (class in homeassis- method), 42 tant.helpers.restore_state), 130 SelectedEntities (class in homeassis- RestoreStateData (class in homeassis- tant.helpers.service), 133 tant.helpers.restore_state), 130 send_command() (homeassis- result (homeassistant.helpers.event.TrackTemplateResult tant.components.remote.RemoteEntity method), attribute), 119 46 result() (homeassistant.helpers.template.RenderInfo send_message() (homeassis- method), 139 tant.components.notify.BaseNotificationService result_as_boolean() (in module homeassis- method), 46 tant.helpers.template), 144 SensorEntity (class in homeassis- ResultWrapper (class in homeassis- tant.components.sensor), 49 tant.helpers.template), 139 SensorEntityDescription (class in homeassis- rgb_color() (homeassis- tant.components.sensor), 49 tant.components.light.LightEntity property), SerializationError, 160 34 server_context_intermediate() (in module rgb_hex_to_rgb_list() (in module homeassis- homeassistant.util.ssl), 165 tant.util.color), 159 server_context_modern() (in module homeassis- RGBColor (class in homeassistant.util.color), 156 tant.util.ssl), 165 rgbw_color() (homeassis- Service (class in homeassistant.core), 70 tant.components.light.LightEntity property), service (homeassistant.helpers.discovery.DiscoveryDict 34 attribute), 104 rgbww_color() (homeassis- service (homeassistant.helpers.service.ServiceParams tant.components.light.LightEntity property), attribute), 133 34 service() (in module homeassis- run() (homeassistant.helpers.script.Script method), 131 tant.helpers.config_validation), 98 run_callback_threadsafe() (in module home- service_data (homeassis- assistant.util.async_), 156 tant.helpers.service.ServiceParams attribute), runs() (homeassistant.helpers.script.Script property), 133 131 ServiceCall (class in homeassistant.core), 70 ServiceIntentHandler (class in homeassis- S tant.helpers.intent), 127 sanitize_filename() (in module homeassis- ServiceNotFound, 78

Index 205 Home Assistant Documentation, Release 2021.10.0.dev0

ServiceParams (class in homeassis- method), 25 tant.helpers.service), 133 set_temperature() (homeassis- ServiceRegistry (class in homeassistant.core), 70 tant.components.water_heater.WaterHeaterEntity services() (homeassistant.core.ServiceRegistry method), 53 property), 71 set_time_zone() (homeassistant.core.Config ServiceTargetSelector (class in homeassis- method), 67 tant.helpers.service), 133 set_volume_level() (homeassis- set() (homeassistant.core.StateMachine method), 73 tant.components.media_player.MediaPlayerEntity set_cover_position() (homeassis- method), 42 tant.components.cover.CoverEntity method), setup() (homeassistant.helpers.entity_component.EntityComponent 29 method), 112 set_cover_tilt_position() (homeassis- should_poll() (homeassis- tant.components.cover.CoverEntity method), tant.components.camera.Camera property), 29 18 set_default_time_zone() (in module homeassis- should_poll() (homeassistant.helpers.entity.Entity tant.util.dt), 160 property), 109 set_direction() (homeassis- should_poll() (homeassis- tant.components.fan.FanEntity method), tant.helpers.update_coordinator.CoordinatorEntity 31 property), 146 set_fan_mode() (homeassis- show_advanced_options() (homeassis- tant.components.climate.ClimateEntity tant.data_entry_flow.FlowHandler property), method), 25 75 set_humidity() (homeassis- shuffle() (homeassis- tant.components.climate.ClimateEntity tant.components.media_player.MediaPlayerEntity method), 25 property), 42 set_hvac_mode() (homeassis- shutdown_run_callback_threadsafe() (in tant.components.climate.ClimateEntity module homeassistant.util.async_), 156 method), 25 sine() (in module homeassistant.helpers.template), set_operation_mode() (homeassis- 144 tant.components.water_heater.WaterHeaterEntity slot_schema (homeassis- method), 53 tant.helpers.intent.IntentHandler attribute), set_percentage() (homeassis- 126 tant.components.fan.FanEntity method), slot_schema (homeassis- 32 tant.helpers.intent.ServiceIntentHandler set_preset_mode() (homeassis- attribute), 127 tant.components.climate.ClimateEntity slots (homeassistant.helpers.intent.Intent attribute), method), 25 126 set_preset_mode() (homeassis- slug() (in module homeassis- tant.components.fan.FanEntity method), tant.helpers.config_validation), 98 32 slugify() (in module homeassis- set_repeat() (homeassis- tant.helpers.config_validation), 98 tant.components.media_player.MediaPlayerEntityslugify() (in module homeassistant.util), 154 method), 42 socket_timeout() (in module homeassis- set_shuffle() (homeassis- tant.helpers.config_validation), 98 tant.components.media_player.MediaPlayerEntitysound_mode() (homeassis- method), 42 tant.components.media_player.MediaPlayerEntity set_speed() (homeassis- property), 42 tant.components.fan.FanEntity method), sound_mode_list() (homeassis- 32 tant.components.media_player.MediaPlayerEntity set_swing_mode() (homeassis- property), 42 tant.components.climate.ClimateEntity source() (homeassis- method), 25 tant.components.media_player.MediaPlayerEntity set_temperature() (homeassis- property), 42 tant.components.climate.ClimateEntity source() (homeassis-

206 Index Home Assistant Documentation, Release 2021.10.0.dev0

tant.data_entry_flow.FlowHandler property), state() (homeassistant.components.water_heater.WaterHeaterEntity 75 property), 53 source_list() (homeassis- state() (homeassistant.components.weather.WeatherEntity tant.components.media_player.MediaPlayerEntity property), 57 property), 42 state() (homeassistant.helpers.entity.Entity property), speed() (homeassistant.components.fan.FanEntity 109 property), 32 state() (homeassistant.helpers.entity.ToggleEntity speed_count() (homeassis- property), 110 tant.components.fan.FanEntity property), state() (homeassistant.helpers.template.TemplateState 32 property), 141 speed_list() (homeassis- state() (in module homeassistant.helpers.condition), tant.components.fan.FanEntity property), 88 32 state_as_number() (in module homeassis- speed_list_without_preset_modes() (in tant.helpers.state), 137 module homeassistant.components.fan), 33 state_attr() (in module homeassis- speed_to_percentage() (homeassis- tant.helpers.template), 144 tant.components.fan.FanEntity method), state_attributes() (homeassis- 32 tant.components.air_quality.AirQualityEntity split_entity_id() (in module homeassis- property), 11 tant.core), 73 state_attributes() (homeassis- square_root() (in module homeassis- tant.components.alarm_control_panel.AlarmControlPanelEntity tant.helpers.template), 144 property), 13 ssdp() (homeassistant.loader.Integration property), state_attributes() (homeassis- 150 tant.components.calendar.CalendarEventDevice start() (homeassistant.components.vacuum.StateVacuumEntity property), 22 method), 51 state_attributes() (homeassis- start() (homeassistant.core.HomeAssistant method), tant.components.camera.Camera property), 70 18 start_of_local_day() (in module homeassis- state_attributes() (homeassis- tant.util.dt), 160 tant.components.climate.ClimateEntity prop- start_pause() (homeassis- erty), 25 tant.components.vacuum.VacuumEntity state_attributes() (homeassis- method), 52 tant.components.cover.CoverEntity property), State (class in homeassistant.core), 71 29 state() (homeassistant.components.air_quality.AirQualityEntitystate_attributes() (homeassis- property), 11 tant.components.fan.FanEntity property), state() (homeassistant.components.binary_sensor.BinarySensorEntity32 property), 15 state_attributes() (homeassis- state() (homeassistant.components.calendar.CalendarEventDevicetant.components.light.LightEntity property), property), 22 34 state() (homeassistant.components.camera.Camera state_attributes() (homeassis- property), 18 tant.components.lock.LockEntity property), state() (homeassistant.components.climate.ClimateEntity 37 property), 25 state_attributes() (homeassis- state() (homeassistant.components.cover.CoverEntity tant.components.media_player.MediaPlayerEntity property), 29 property), 42 state() (homeassistant.components.lock.LockEntity state_attributes() (homeassis- property), 37 tant.components.remote.RemoteEntity prop- state() (homeassistant.components.media_player.MediaPlayerEntityerty), 46 property), 42 state_attributes() (homeassis- state() (homeassistant.components.sensor.SensorEntity tant.components.sensor.SensorEntity property), property), 49 49 state() (homeassistant.components.vacuum.StateVacuumEntitystate_attributes() (homeassis- property), 51 tant.components.switch.SwitchEntity property),

Index 207 Home Assistant Documentation, Release 2021.10.0.dev0

48 string_with_no_html() (in module homeassis- state_attributes() (homeassis- tant.helpers.config_validation), 98 tant.components.vacuum.VacuumEntity prop- strptime() (in module homeassis- erty), 52 tant.helpers.template), 144 state_attributes() (homeassis- substitute() (in module homeassistant.util.yaml), tant.components.water_heater.WaterHeaterEntity 155 property), 54 suggested_area (homeassis- state_attributes() (homeassis- tant.helpers.device_registry.DeviceEntry tant.components.weather.WeatherEntity attribute), 101 property), 57 suggested_area (homeassis- state_attributes() (homeassis- tant.helpers.entity.DeviceInfo attribute), tant.helpers.entity.Entity property), 109 106 state_class (homeassis- sulphur_dioxide() (homeassis- tant.components.sensor.SensorEntityDescription tant.components.air_quality.AirQualityEntity attribute), 49 property), 12 state_class() (homeassis- sun() (in module homeassistant.helpers.condition), 88 tant.components.sensor.SensorEntity property), sun_from_config() (in module homeassis- 49 tant.helpers.condition), 88 STATE_CONDITION_SCHEMA() (in module homeas- SunListener (class in homeassistant.helpers.event), sistant.helpers.config_validation), 95 118 state_from_config() (in module homeassis- support_clear_playlist() (homeassis- tant.helpers.condition), 88 tant.components.media_player.MediaPlayerEntity state_with_unit() (homeassis- property), 42 tant.helpers.template.TemplateState property), support_entry_unload() (in module homeassis- 141 tant.config_entries), 65 StateMachine (class in homeassistant.core), 72 support_grouping() (homeassis- StateVacuumDevice (class in homeassis- tant.components.media_player.MediaPlayerEntity tant.components.vacuum), 50 property), 42 StateVacuumEntity (class in homeassis- support_next_track() (homeassis- tant.components.vacuum), 50 tant.components.media_player.MediaPlayerEntity StateVacuumEntityDescription (class in home- property), 43 assistant.components.vacuum), 51 support_pause() (homeassis- status() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.vacuum.VacuumEntity prop- property), 43 erty), 52 support_play() (homeassis- stop() (homeassistant.core.HomeAssistant method), 70 tant.components.media_player.MediaPlayerEntity stop_cover() (homeassis- property), 43 tant.components.cover.CoverEntity method), support_play_media() (homeassis- 29 tant.components.media_player.MediaPlayerEntity stop_cover_tilt() (homeassis- property), 43 tant.components.cover.CoverEntity method), support_previous_track() (homeassis- 29 tant.components.media_player.MediaPlayerEntity StorageCollection (class in homeassis- property), 43 tant.helpers.collection), 83 support_seek() (homeassis- StorageCollectionWebsocket (class in homeas- tant.components.media_player.MediaPlayerEntity sistant.helpers.collection), 84 property), 43 Store (class in homeassistant.helpers.storage), 137 support_select_sound_mode() (homeassis- StoredState (class in homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.restore_state), 130 property), 43 stream_source() (homeassis- support_select_source() (homeassis- tant.components.camera.Camera method), tant.components.media_player.MediaPlayerEntity 18 property), 43 string() (in module homeassis- support_shuffle_set() (homeassis- tant.helpers.config_validation), 98 tant.components.media_player.MediaPlayerEntity

208 Index Home Assistant Documentation, Release 2021.10.0.dev0

property), 43 erty), 25 support_stop() (homeassis- SwitchDevice (class in homeassis- tant.components.media_player.MediaPlayerEntity tant.components.switch), 47 property), 43 SwitchEntity (class in homeassis- support_volume_mute() (homeassis- tant.components.switch), 47 tant.components.media_player.MediaPlayerEntitySwitchEntityDescription (class in homeassis- property), 43 tant.components.switch), 48 support_volume_set() (homeassis- sync_entity_lifecycle() (in module homeassis- tant.components.media_player.MediaPlayerEntity tant.helpers.collection), 85 property), 43 system_generated (homeassis- supported_color_modes() (homeassis- tant.auth.models.Group attribute),7 tant.components.light.LightEntity property), system_generated (homeassis- 34 tant.auth.models.User attribute),8 supported_features (homeassis- tant.helpers.entity_registry.RegistryEntry T attribute), 116 tangent() (in module homeassis- supported_features() (homeassis- tant.helpers.template), 144 tant.components.alarm_control_panel.AlarmControlPanelEntitytarget (homeassistant.helpers.service.ServiceParams property), 13 attribute), 133 supported_features() (homeassis- target_humidity() (homeassis- tant.components.camera.Camera property), tant.components.climate.ClimateEntity prop- 18 erty), 25 supported_features() (homeassis- target_temperature() (homeassis- tant.components.climate.ClimateEntity prop- tant.components.climate.ClimateEntity prop- erty), 25 erty), 25 supported_features() (homeassis- target_temperature() (homeassis- tant.components.cover.CoverEntity property), tant.components.water_heater.WaterHeaterEntity 29 property), 54 supported_features() (homeassis- target_temperature_high() (homeassis- tant.components.fan.FanEntity property), tant.components.climate.ClimateEntity prop- 32 erty), 25 supported_features() (homeassis- target_temperature_high() (homeassis- tant.components.light.LightEntity property), tant.components.water_heater.WaterHeaterEntity 34 property), 54 supported_features() (homeassis- target_temperature_low() (homeassis- tant.components.media_player.MediaPlayerEntity tant.components.climate.ClimateEntity prop- property), 43 erty), 25 supported_features() (homeassis- target_temperature_low() (homeassis- tant.components.remote.RemoteEntity prop- tant.components.water_heater.WaterHeaterEntity erty), 47 property), 54 supported_features() (homeassis- target_temperature_step() (homeassis- tant.helpers.entity.Entity property), 109 tant.components.climate.ClimateEntity prop- supports_max() (homeassistant.helpers.script.Script erty), 25 property), 131 temperature (homeassis- sw_version (homeassis- tant.components.weather.Forecast attribute), tant.helpers.device_registry.DeviceEntry 56 attribute), 101 temperature() (homeassis- sw_version (homeassistant.helpers.entity.DeviceInfo tant.components.weather.WeatherEntity attribute), 106 property), 57 swing_mode() (homeassis- temperature() (homeassis- tant.components.climate.ClimateEntity prop- tant.util.unit_system.UnitSystem method), erty), 25 166 swing_modes() (homeassis- temperature_unit() (homeassis- tant.components.climate.ClimateEntity prop- tant.components.climate.ClimateEntity prop-

Index 209 Home Assistant Documentation, Release 2021.10.0.dev0

erty), 26 tant.helpers.template), 144 temperature_unit() (homeassis- timestamp_utc() (in module homeassis- tant.components.water_heater.WaterHeaterEntity tant.helpers.template), 144 property), 54 to_device_entry() (homeassis- temperature_unit() (homeassis- tant.helpers.device_registry.DeletedDeviceEntry tant.components.weather.WeatherEntity method), 101 property), 57 to_json() (in module homeassis- temperature_unit() (in module homeassis- tant.helpers.template), 144 tant.helpers.config_validation), 98 today_energy_kwh() (homeassis- Template (class in homeassistant.helpers.template), tant.components.switch.SwitchEntity property), 140 48 template (homeassistant.helpers.event.TrackTemplate toggle() (homeassis- attribute), 119 tant.components.cover.CoverEntity method), template (homeassis- 29 tant.helpers.event.TrackTemplateResult at- toggle() (homeassistant.helpers.entity.ToggleEntity tribute), 119 method), 110 template (homeassistant.helpers.template.Template toggle_tilt() (homeassis- attribute), 140 tant.components.cover.CoverEntity method), template() (in module homeassis- 29 tant.helpers.condition), 88 ToggleEntity (class in homeassistant.helpers.entity), template() (in module homeassis- 109 tant.helpers.config_validation), 98 ToggleEntityDescription (class in homeassis- template_complex() (in module homeassis- tant.helpers.entity), 110 tant.helpers.config_validation), 98 token (homeassistant.auth.models.RefreshToken at- TemplateEnvironment (class in homeassis- tribute),8 tant.helpers.template), 140 token() (homeassistant.helpers.config_entry_oauth2_flow.OAuth2Session TemplateError, 78 property), 93 TemplateState (class in homeassis- token_type (homeassistant.auth.models.RefreshToken tant.helpers.template), 141 attribute),8 templow (homeassistant.components.weather.Forecast trace_action() (in module homeassis- attribute), 56 tant.helpers.script), 132 text() (homeassistant.util.aiohttp.MockRequest trace_condition() (in module homeassis- method), 155 tant.helpers.condition), 88 text_input (homeassistant.helpers.intent.Intent at- trace_condition_function() (in module home- tribute), 126 assistant.helpers.condition), 89 threaded_listener_factory() (in module track_point_in_time() (in module homeassis- homeassistant.helpers.event), 123 tant.helpers.event), 123 Throttle (class in homeassistant.util), 153 track_point_in_utc_time() (in module home- time() (in module homeassistant.helpers.condition), 88 assistant.helpers.event), 123 time() (in module homeassis- track_same_state() (in module homeassis- tant.helpers.config_validation), 98 tant.helpers.event), 123 time_from_config() (in module homeassis- track_state_change() (in module homeassis- tant.helpers.condition), 88 tant.helpers.event), 123 time_period_seconds() (in module homeassis- track_sunrise() (in module homeassis- tant.helpers.config_validation), 98 tant.helpers.event), 124 time_period_str() (in module homeassis- track_sunset() (in module homeassis- tant.helpers.config_validation), 98 tant.helpers.event), 124 time_zone (homeassistant.util.location.LocationInfo track_template() (in module homeassis- attribute), 161 tant.helpers.event), 124 time_zone() (in module homeassis- track_time_change() (in module homeassis- tant.helpers.config_validation), 98 tant.helpers.event), 124 timestamp_custom() (in module homeassis- track_time_interval() (in module homeassis- tant.helpers.template), 144 tant.helpers.event), 124 timestamp_local() (in module homeassis- track_utc_time_change() (in module homeassis-

210 Index Home Assistant Documentation, Release 2021.10.0.dev0

tant.helpers.event), 124 unique_id (homeassis- TrackStates (class in homeassistant.helpers.event), tant.helpers.entity_registry.RegistryEntry 118 attribute), 116 TrackTemplate (class in homeassis- unique_id() (homeassis- tant.helpers.event), 119 tant.config_entries.ConfigFlow property), TrackTemplateResult (class in homeassis- 64 tant.helpers.event), 119 unique_id() (homeassistant.helpers.entity.Entity transition (homeassistant.components.light.Profile property), 109 attribute), 35 unit_of_measurement (homeassis- TupleWrapper (class in homeassis- tant.components.sensor.SensorEntityDescription tant.helpers.template), 141 attribute), 50 turn_aux_heat_off() (homeassis- unit_of_measurement (homeassis- tant.components.climate.ClimateEntity tant.helpers.entity.EntityDescription attribute), method), 26 109 turn_aux_heat_on() (homeassis- unit_of_measurement (homeassis- tant.components.climate.ClimateEntity tant.helpers.entity_registry.RegistryEntry method), 26 attribute), 116 turn_away_mode_off() (homeassis- unit_of_measurement() (homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.air_quality.AirQualityEntity method), 54 property), 12 turn_away_mode_on() (homeassis- unit_of_measurement() (homeassis- tant.components.water_heater.WaterHeaterEntity tant.components.sensor.SensorEntity property), method), 54 49 turn_off() (homeassis- unit_of_measurement() (homeassis- tant.components.camera.Camera method), tant.helpers.entity.Entity property), 109 18 UnitSystem (class in homeassistant.util.unit_system), turn_off() (homeassis- 165 tant.components.media_player.MediaPlayerEntityunjoin_player() (homeassis- method), 43 tant.components.media_player.MediaPlayerEntity turn_off() (homeassis- method), 43 tant.components.vacuum.VacuumEntity UnknownEntry, 65 method), 52 UnknownFlow, 76 turn_off() (homeassis- UnknownHandler, 76 tant.helpers.entity.ToggleEntity method), UnknownIntent, 127 110 UnknownStep, 76 turn_on() (homeassis- UnknownUser, 78 tant.components.camera.Camera method), unlock() (homeassistant.components.lock.LockEntity 18 method), 37 turn_on() (homeassistant.components.fan.FanEntity update_logger() (homeassis- method), 32 tant.helpers.script.Script method), 131 turn_on() (homeassis- UpdateFailed, 147 tant.components.media_player.MediaPlayerEntityurl (homeassistant.components.calendar.CalendarEventView method), 43 attribute), 22 turn_on() (homeassis- url (homeassistant.components.calendar.CalendarListView tant.components.vacuum.VacuumEntity attribute), 22 method), 52 url (homeassistant.components.camera.CameraImageView turn_on() (homeassistant.helpers.entity.ToggleEntity attribute), 19 method), 110 url (homeassistant.components.camera.CameraMjpegStream attribute), 19 U url (homeassistant.components.conversation.ConversationProcessView Unauthorized, 78 attribute), 27 UndefinedSubstitution, 154 url (homeassistant.components.media_player.MediaPlayerImageView UndefinedType (class in homeassis- attribute), 44 tant.helpers.typing), 146 url (homeassistant.components.webhook.WebhookView

Index 211 Home Assistant Documentation, Release 2021.10.0.dev0

attribute), 58 via_device (homeassistant.helpers.entity.DeviceInfo url (homeassistant.helpers.config_entry_oauth2_flow.OAuth2AuthorizeCallbackViewattribute), 106 attribute), 93 via_device_id (homeassis- url() (in module homeassis- tant.helpers.device_registry.DeviceEntry tant.helpers.config_validation), 98 attribute), 101 url_no_path() (in module homeassis- vincenty() (in module homeassistant.util.location), tant.helpers.config_validation), 99 162 urlencode() (in module homeassis- visibility() (homeassis- tant.helpers.template), 144 tant.components.weather.WeatherEntity usb() (homeassistant.loader.Integration property), 150 property), 57 use_metric (homeassistant.util.location.LocationInfo volume() (homeassistant.util.unit_system.UnitSystem attribute), 161 method), 166 User (class in homeassistant.auth.models),8 volume_level() (homeassis- user (homeassistant.auth.models.RefreshToken at- tant.components.media_player.MediaPlayerEntity tribute),8 property), 43 UserMeta (class in homeassistant.auth.models),8 utc_from_timestamp() (in module homeassis- W tant.util.dt), 160 WaterHeaterDevice (class in homeassis- utcnow() (in module homeassistant.helpers.template), tant.components.water_heater), 53 144 WaterHeaterEntity (class in homeassis- utcnow() (in module homeassistant.util.dt), 160 tant.components.water_heater), 53 uuid4_hex() (in module homeassis- WaterHeaterEntityEntityDescription (class tant.helpers.config_validation), 99 in homeassistant.components.water_heater), 54 V WeatherEntity (class in homeassis- VacuumDevice (class in homeassis- tant.components.weather), 56 tant.components.vacuum), 51 WeatherEntityDescription (class in homeassis- VacuumEntity (class in homeassis- tant.components.weather), 57 tant.components.vacuum), 51 webhook_async_remove_entry() (in module VacuumEntityDescription (class in homeassis- homeassistant.helpers.config_entry_flow), 90 tant.components.vacuum), 52 WebhookFlowHandler (class in homeassis- valid_entity_id() (in module homeassis- tant.helpers.config_entry_flow), 90 tant.core), 73 WebhookView (class in homeassis- valid_state() (in module homeassistant.core), 73 tant.components.webhook), 58 valid_supported_color_modes() (in module websocket_browse_media() (in module homeas- homeassistant.components.light), 36 sistant.components.media_player), 45 valid_token() (homeassis- websocket_camera_thumbnail() (in module tant.helpers.config_entry_oauth2_flow.OAuth2Session homeassistant.components.camera), 21 property), 93 websocket_get_agent_info() (in module home- variables (homeassis- assistant.components.conversation), 27 tant.helpers.event.TrackTemplate attribute), websocket_get_prefs() (in module homeassis- 119 tant.components.camera), 21 verify_domain_control() (in module homeassis- websocket_handle_thumbnail() (in module tant.helpers.service), 136 homeassistant.components.media_player), 45 version (homeassistant.auth.models.RefreshToken at- websocket_list() (in module homeassis- tribute),8 tant.components.webhook), 58 VERSION (homeassistant.helpers.config_entry_flow.DiscoveryFlowHandlerwebsocket_process() (in module homeassis- attribute), 89 tant.components.conversation), 27 VERSION (homeassistant.helpers.config_entry_flow.WebhookFlowHandlerwebsocket_set_onboarding() (in module home- attribute), 90 assistant.components.conversation), 27 VERSION (homeassistant.helpers.config_entry_oauth2_flow.AbstractOAuth2FlowHandlerwebsocket_update_prefs() (in module homeas- attribute), 91 sistant.components.camera), 21 version() (homeassistant.loader.Integration prop- white_value() (homeassis- erty), 150 tant.components.light.LightEntity property),

212 Index Home Assistant Documentation, Release 2021.10.0.dev0

34 zone_from_config() (in module homeassis- whitespace() (in module homeassis- tant.helpers.condition), 89 tant.helpers.config_validation), 99 wind_bearing (homeassis- tant.components.weather.Forecast attribute), 56 wind_bearing() (homeassis- tant.components.weather.WeatherEntity property), 57 wind_speed (homeassis- tant.components.weather.Forecast attribute), 56 wind_speed() (homeassis- tant.components.weather.WeatherEntity property), 57 write_unavailable_state() (homeassis- tant.helpers.entity_registry.RegistryEntry method), 116 WriteError, 160 ws_camera_stream() (in module homeassis- tant.components.camera), 21 ws_create_item() (homeassis- tant.helpers.collection.StorageCollectionWebsocket method), 84 ws_delete_item() (homeassis- tant.helpers.collection.StorageCollectionWebsocket method), 84 ws_list_item() (homeassis- tant.helpers.collection.StorageCollectionWebsocket method), 84 ws_update_item() (homeassis- tant.helpers.collection.StorageCollectionWebsocket method), 84 X x (homeassistant.util.color.XYPoint attribute), 157 x10_address() (in module homeassis- tant.helpers.config_validation), 99 xy_color() (homeassis- tant.components.light.LightEntity property), 35 XYPoint (class in homeassistant.util.color), 157 Y y (homeassistant.util.color.XYPoint attribute), 157 YamlCollection (class in homeassis- tant.helpers.collection), 84 Z zeroconf() (homeassistant.loader.Integration prop- erty), 150 zip_code (homeassistant.util.location.LocationInfo at- tribute), 162 zone() (in module homeassistant.helpers.condition), 89

Index 213