Home Assistant Documentation Release 2021.10.0.Dev0
Total Page:16
File Type:pdf, Size:1020Kb
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.