homeassistant.components

air_quality

Component for handling Air Quality data for your location.

class homeassistant.components.air_quality.AirQualityEntity[source]

Bases: homeassistant.helpers.entity.Entity

ABC for air quality data.

property air_quality_index

Return the Air Quality Index (AQI).

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.

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: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the air quality component.

async homeassistant.components.air_quality.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.air_quality.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

alarm_control_panel

Component to interface with an alarm control panel.

class homeassistant.components.alarm_control_panel.AlarmControlPanelEntity[source]

Bases: homeassistant.helpers.entity.Entity

An abstract class for alarm control entities.

alarm_arm_away(code: str | None = None) → None[source]

Send arm away command.

alarm_arm_custom_bypass(code: str | None = None) → None[source]

Send arm custom bypass command.

alarm_arm_home(code: str | None = None) → None[source]

Send arm home command.

alarm_arm_night(code: str | None = None) → None[source]

Send arm night command.

alarm_arm_vacation(code: str | None = None) → None[source]

Send arm vacation command.

alarm_disarm(code: str | None = None) → None[source]

Send disarm command.

alarm_trigger(code: str | None = None) → None[source]

Send alarm trigger command.

async async_alarm_arm_away(code: str | None = None) → None[source]

Send arm away command.

async async_alarm_arm_custom_bypass(code: str | None = None) → None[source]

Send arm custom bypass command.

async async_alarm_arm_home(code: str | None = None) → None[source]

Send arm home command.

async async_alarm_arm_night(code: str | None = None) → None[source]

Send arm night command.

async async_alarm_arm_vacation(code: str | None = None) → None[source]

Send arm vacation command.

async async_alarm_disarm(code: str | None = None) → None[source]

Send disarm command.

async async_alarm_trigger(code: str | None = None) → None[source]

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.

class homeassistant.components.alarm_control_panel.AlarmControlPanelEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes alarm control panel entities.

key = None
async homeassistant.components.alarm_control_panel.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for sensors.

async homeassistant.components.alarm_control_panel.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.alarm_control_panel.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

binary_sensor

Component to interface with binary sensors.

class homeassistant.components.binary_sensor.BinarySensorDeviceClass[source]

Bases: homeassistant.backports.enum.StrEnum

Device class for binary sensors.

BATTERY = 'battery'
BATTERY_CHARGING = 'battery_charging'
CO = 'carbon_monoxide'
COLD = 'cold'
CONNECTIVITY = 'connectivity'
DOOR = 'door'
GARAGE_DOOR = 'garage_door'
GAS = 'gas'
HEAT = 'heat'
LIGHT = 'light'
LOCK = 'lock'
MOISTURE = 'moisture'
MOTION = 'motion'
MOVING = 'moving'
OCCUPANCY = 'occupancy'
OPENING = 'opening'
PLUG = 'plug'
POWER = 'power'
PRESENCE = 'presence'
PROBLEM = 'problem'
RUNNING = 'running'
SAFETY = 'safety'
SMOKE = 'smoke'
SOUND = 'sound'
TAMPER = 'tamper'
UPDATE = 'update'
VIBRATION = 'vibration'
WINDOW = 'window'
class homeassistant.components.binary_sensor.BinarySensorEntity[source]

Bases: homeassistant.helpers.entity.Entity

Represent a binary sensor.

property device_class

Return the class of this entity.

entity_description = None
property is_on

Return true if the binary sensor is on.

property state

Return the state of the binary sensor.

class homeassistant.components.binary_sensor.BinarySensorEntityDescription(key: str, device_class: BinarySensorDeviceClass | str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes binary sensor entities.

device_class: BinarySensorDeviceClass | str | None = None
async homeassistant.components.binary_sensor.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for binary sensors.

async homeassistant.components.binary_sensor.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.binary_sensor.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

camera

Component to interface with cameras.

class homeassistant.components.camera.Camera[source]

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[source]

Return bytes of camera image.

async async_create_stream() → Stream | None[source]

Create a Stream for stream_source.

async async_disable_motion_detection() → None[source]

Call the job and disable motion detection.

async async_enable_motion_detection() → None[source]

Call the job and enable motion detection.

async async_handle_web_rtc_offer(offer_sdp: str) → str | None[source]

Handle the WebRTC offer and return an answer.

This is used by cameras with SUPPORT_STREAM and STREAM_TYPE_WEB_RTC.

Integrations can override with a native WebRTC implementation.

async async_internal_added_to_hass() → None[source]

Run when entity about to be added to hass.

async async_refresh_providers() → None[source]

Determine if any of the registered providers are suitable for this entity.

This affects state attributes, so it should be invoked any time the registered providers or inputs to the state attributes change.

Returns True if any state was updated (and needs to be written)

async async_turn_off() → None[source]

Turn off camera.

async async_turn_on() → None[source]

Turn off camera.

async_update_token() → None[source]

Update the used token.

async_warn_old_async_camera_image_signature() → None[source]

Warn once when calling async_camera_image with the function old signature.

property available

Return True if entity is available.

property brand

Return the camera brand.

camera_image(width: int | None = None, height: int | None = None) → bytes | None[source]

Return bytes of camera image.

disable_motion_detection() → None[source]

Disable motion detection in camera.

enable_motion_detection() → None[source]

Enable motion detection in the camera.

property entity_picture

Return a link to the camera feed as entity picture.

property frame_interval

Return the interval between frames of the mjpeg stream.

property frontend_stream_type

Return the type of stream supported by this camera.

A camera may have a single stream type which is used to inform the frontend which camera attributes and player to use. The default type is to use HLS, and components can override to change the type.

async handle_async_mjpeg_stream(request: web.Request) → web.StreamResponse | None[source]

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[source]

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 is_streaming

Return true if the device is streaming.

property model

Return the camera model.

property motion_detection_enabled

Return the camera motion detection status.

property state

Return the camera state.

property state_attributes

Return the camera state attributes.

async stream_source() → str | None[source]

Return the source of the stream.

This is used by cameras with SUPPORT_STREAM and STREAM_TYPE_HLS.

property supported_features

Flag supported features.

turn_off() → None[source]

Turn off camera.

turn_on() → None[source]

Turn off camera.

class homeassistant.components.camera.CameraEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes camera entities.

key = None
class homeassistant.components.camera.CameraImageView(component: homeassistant.helpers.entity_component.EntityComponent)[source]

Bases: homeassistant.components.camera.CameraView

Camera view to serve an image.

async handle(request: aiohttp.web_request.Request, camera: homeassistant.components.camera.Camera) → aiohttp.web_response.Response[source]

Serve camera image.

name = 'api:camera:image'
url: str | None = '/api/camera_proxy/{entity_id}'
class homeassistant.components.camera.CameraMjpegStream(component: homeassistant.helpers.entity_component.EntityComponent)[source]

Bases: homeassistant.components.camera.CameraView

Camera View to serve an MJPEG stream.

async handle(request: aiohttp.web_request.Request, camera: homeassistant.components.camera.Camera) → aiohttp.web_response.StreamResponse[source]

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: homeassistant.helpers.entity_component.EntityComponent)[source]

Bases: homeassistant.components.http.view.HomeAssistantView

Base CameraView.

async get(request: aiohttp.web_request.Request, entity_id: str) → aiohttp.web_response.StreamResponse[source]

Start a GET request.

async handle(request: aiohttp.web_request.Request, camera: homeassistant.components.camera.Camera) → aiohttp.web_response.StreamResponse[source]

Handle the camera request.

requires_auth = False
class homeassistant.components.camera.Image(content_type: str, content: bytes)[source]

Bases: object

Represent an image.

content = None
content_type = None
async homeassistant.components.camera.async_get_image(hass: HomeAssistant, entity_id: str, timeout: int = 10, width: int | None = None, height: int | None = None) → Image[source]

Fetch an image from a camera entity.

width and height will be passed to the underlying camera.

async homeassistant.components.camera.async_get_mjpeg_stream(hass: HomeAssistant, request: web.Request, entity_id: str) → web.StreamResponse | None[source]

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]], content_type: str, interval: float) → web.StreamResponse[source]

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: HomeAssistant, entity_id: str) → str | None[source]

Fetch the stream source for a camera entity.

async homeassistant.components.camera.async_handle_play_stream_service(camera: homeassistant.components.camera.Camera, service_call: homeassistant.core.ServiceCall) → None[source]

Handle play stream services calls.

async homeassistant.components.camera.async_handle_record_service(camera: homeassistant.components.camera.Camera, service_call: homeassistant.core.ServiceCall) → None[source]

Handle stream recording service calls.

async homeassistant.components.camera.async_handle_snapshot_service(camera: homeassistant.components.camera.Camera, service_call: homeassistant.core.ServiceCall) → None[source]

Handle snapshot services calls.

homeassistant.components.camera.async_register_rtsp_to_web_rtc_provider()[source]

Register an RTSP to WebRTC provider.

The first provider to satisfy the offer will be used.

async homeassistant.components.camera.async_request_stream(hass: homeassistant.core.HomeAssistant, entity_id: str, fmt: str) → str[source]

Request a stream for a camera entity.

async homeassistant.components.camera.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the camera component.

async homeassistant.components.camera.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.camera.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.camera.websocket_camera_thumbnail(hass: homeassistant.core.HomeAssistant, connection: homeassistant.components.websocket_api.connection.ActiveConnection, msg: dict) → None[source]

Handle get camera thumbnail websocket command.

Async friendly.

homeassistant.components.camera.websocket_get_prefs(hass: homeassistant.core.HomeAssistant, connection: homeassistant.components.websocket_api.connection.ActiveConnection, msg: dict) → None[source]

Handle request for account info.

homeassistant.components.camera.websocket_update_prefs(hass: homeassistant.core.HomeAssistant, connection: homeassistant.components.websocket_api.connection.ActiveConnection, msg: dict) → None[source]

Handle request for account info.

homeassistant.components.camera.ws_camera_stream(hass: homeassistant.core.HomeAssistant, connection: homeassistant.components.websocket_api.connection.ActiveConnection, msg: dict) → None[source]

Handle get camera stream websocket command.

Async friendly.

homeassistant.components.camera.ws_camera_web_rtc_offer(hass: homeassistant.core.HomeAssistant, connection: homeassistant.components.websocket_api.connection.ActiveConnection, msg: dict) → None[source]

Handle the signal path for a WebRTC stream.

This signal path is used to route the offer created by the client to the camera device through the integration for negotiation on initial setup, which returns an answer. The actual streaming is handled entirely between the client and camera device.

Async friendly.

calendar

Support for Google Calendar event device sensors.

class homeassistant.components.calendar.CalendarEventDevice[source]

Bases: homeassistant.helpers.entity.Entity

Base class for calendar event entities.

async async_get_events(hass, start_date, end_date)[source]

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: homeassistant.helpers.entity_component.EntityComponent)[source]

Bases: homeassistant.components.http.view.HomeAssistantView

View to retrieve calendar content.

async get(request, entity_id)[source]

Return calendar events.

name = 'api:calendars:calendar'
url: str | None = '/api/calendars/{entity_id}'
class homeassistant.components.calendar.CalendarListView(component: homeassistant.helpers.entity_component.EntityComponent)[source]

Bases: homeassistant.components.http.view.HomeAssistantView

View to retrieve calendar list.

async get(request: aiohttp.web_request.Request) → aiohttp.web_response.Response[source]

Retrieve calendar list.

name = 'api:calendars'
url: str | None = '/api/calendars'
async homeassistant.components.calendar.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for calendars.

async homeassistant.components.calendar.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.calendar.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.calendar.calculate_offset(event, offset)[source]

Calculate event offset.

Return the updated event with the offset_time included.

homeassistant.components.calendar.get_date(date)[source]

Get the dateTime from date or dateTime as a local.

homeassistant.components.calendar.is_offset_reached(event)[source]

Have we reached the offset time specified in the event title.

homeassistant.components.calendar.normalize_event(event)[source]

Normalize a calendar event.

climate

Provides functionality to interact with climate devices.

class homeassistant.components.climate.ClimateEntity[source]

Bases: homeassistant.helpers.entity.Entity

Base class for climate entities.

async async_set_fan_mode(fan_mode: str) → None[source]

Set new target fan mode.

async async_set_humidity(humidity: int) → None[source]

Set new target humidity.

async async_set_hvac_mode(hvac_mode: str) → None[source]

Set new target hvac mode.

async async_set_preset_mode(preset_mode: str) → None[source]

Set new preset mode.

async async_set_swing_mode(swing_mode: str) → None[source]

Set new target swing operation.

async async_set_temperature(**kwargs) → None[source]

Set new target temperature.

async async_turn_aux_heat_off() → None[source]

Turn auxiliary heater off.

async async_turn_aux_heat_on() → None[source]

Turn auxiliary heater on.

async async_turn_off() → None[source]

Turn the entity off.

async async_turn_on() → None[source]

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.

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[source]

Set new target fan mode.

set_humidity(humidity: int) → None[source]

Set new target humidity.

set_hvac_mode(hvac_mode: str) → None[source]

Set new target hvac mode.

set_preset_mode(preset_mode: str) → None[source]

Set new preset mode.

set_swing_mode(swing_mode: str) → None[source]

Set new target swing operation.

set_temperature(**kwargs) → None[source]

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.

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[source]

Turn auxiliary heater off.

turn_aux_heat_on() → None[source]

Turn auxiliary heater on.

class homeassistant.components.climate.ClimateEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes climate entities.

key = None
async homeassistant.components.climate.async_service_aux_heat(entity: homeassistant.components.climate.ClimateEntity, service_call: homeassistant.core.ServiceCall) → None[source]

Handle aux heat service.

async homeassistant.components.climate.async_service_temperature_set(entity: homeassistant.components.climate.ClimateEntity, service_call: homeassistant.core.ServiceCall) → None[source]

Handle set temperature service.

async homeassistant.components.climate.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up climate entities.

async homeassistant.components.climate.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.climate.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

conversation

Support for functionality to have conversations with Home Assistant.

class homeassistant.components.conversation.ConversationProcessView[source]

Bases: homeassistant.components.http.view.HomeAssistantView

View to process text.

name = 'api:conversation:process'
async post(request, data)[source]

Send a request for processing.

url: str | None = '/api/conversation/process'
homeassistant.components.conversation.async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent | None)[source]

Set the agent to handle the conversations.

async homeassistant.components.conversation.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Register the process service.

homeassistant.components.conversation.websocket_get_agent_info(hass, connection, msg)[source]

Do we need onboarding.

homeassistant.components.conversation.websocket_process(hass, connection, msg)[source]

Process text.

homeassistant.components.conversation.websocket_set_onboarding(hass, connection, msg)[source]

Set onboarding status.

cover

Support for Cover devices.

class homeassistant.components.cover.CoverDeviceClass[source]

Bases: homeassistant.backports.enum.StrEnum

Device class for cover.

AWNING = 'awning'
BLIND = 'blind'
CURTAIN = 'curtain'
DAMPER = 'damper'
DOOR = 'door'
GARAGE = 'garage'
GATE = 'gate'
SHADE = 'shade'
SHUTTER = 'shutter'
WINDOW = 'window'
class homeassistant.components.cover.CoverEntity[source]

Bases: homeassistant.helpers.entity.Entity

Base class for cover entities.

async async_close_cover(**kwargs)[source]

Close cover.

async async_close_cover_tilt(**kwargs)[source]

Close the cover tilt.

async async_open_cover(**kwargs)[source]

Open the cover.

async async_open_cover_tilt(**kwargs)[source]

Open the cover tilt.

async async_set_cover_position(**kwargs)[source]

Move the cover to a specific position.

async async_set_cover_tilt_position(**kwargs)[source]

Move the cover tilt to a specific position.

async async_stop_cover(**kwargs)[source]

Stop the cover.

async async_stop_cover_tilt(**kwargs)[source]

Stop the cover.

async async_toggle(**kwargs)[source]

Toggle the entity.

async async_toggle_tilt(**kwargs)[source]

Toggle the entity.

close_cover(**kwargs: Any) → None[source]

Close cover.

close_cover_tilt(**kwargs: Any) → None[source]

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.

property device_class

Return the class of this entity.

entity_description = None
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[source]

Open the cover.

open_cover_tilt(**kwargs: Any) → None[source]

Open the cover tilt.

set_cover_position(**kwargs)[source]

Move the cover to a specific position.

set_cover_tilt_position(**kwargs)[source]

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)[source]

Stop the cover.

stop_cover_tilt(**kwargs)[source]

Stop the cover.

property supported_features

Flag supported features.

toggle(**kwargs: Any) → None[source]

Toggle the entity.

toggle_tilt(**kwargs: Any) → None[source]

Toggle the entity.

class homeassistant.components.cover.CoverEntityDescription(key: str, device_class: CoverDeviceClass | str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes cover entities.

device_class: CoverDeviceClass | str | None = None
async homeassistant.components.cover.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for covers.

async homeassistant.components.cover.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.cover.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.cover.is_closed(hass, entity_id)[source]

Return if the cover is closed based on the statemachine.

device_tracker

Provide functionality to keep track of devices.

async homeassistant.components.device_tracker.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the device tracker.

homeassistant.components.device_tracker.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool[source]

Return the state if any or a specified device is home.

fan

Provides functionality to interact with fans.

class homeassistant.components.fan.FanEntity[source]

Bases: homeassistant.helpers.entity.ToggleEntity

Base class for fan entities.

async async_decrease_speed(percentage_step: int | None = None) → None[source]

Decrease the speed of the fan.

async async_increase_speed(percentage_step: int | None = None) → None[source]

Increase the speed of the fan.

async async_oscillate(oscillating: bool)[source]

Oscillate the fan.

async async_set_direction(direction: str)[source]

Set the direction of the fan.

async async_set_percentage(percentage: int) → None[source]

Set the speed of the fan, as a percentage.

async async_set_preset_mode(preset_mode: str) → None[source]

Set new preset mode.

async async_set_speed(speed: str)[source]

Set the speed of the fan.

async async_set_speed_deprecated(speed: str)[source]

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[source]

Turn on the fan.

async async_turn_on_compat(speed: str | None = None, percentage: int | None = None, preset_mode: str | None = None, **kwargs) → None[source]

Turn on the fan.

This _compat version wraps async_turn_on with backwards and forward compatibility.

This compatibility shim will be removed in 2022.3

property capability_attributes

Return capability attributes.

property current_direction

Return the current direction of the fan.

entity_description = None
property is_on

Return true if the entity is on.

oscillate(oscillating: bool) → None[source]

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[source]

Map a percentage to a legacy speed.

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.

set_direction(direction: str) → None[source]

Set the direction of the fan.

set_percentage(percentage: int) → None[source]

Set the speed of the fan, as a percentage.

set_preset_mode(preset_mode: str) → None[source]

Set new preset mode.

set_speed(speed: str) → None[source]

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[source]

Map a legacy speed to a percentage.

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[source]

Turn on the fan.

class homeassistant.components.fan.FanEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.ToggleEntityDescription

A class that describes fan entities.

key = None
exception homeassistant.components.fan.NoValidSpeedsError[source]

Bases: ValueError

Exception class when there are no valid speeds.

exception homeassistant.components.fan.NotValidPresetModeError[source]

Bases: ValueError

Exception class when the preset_mode in not in the preset_modes list.

exception homeassistant.components.fan.NotValidSpeedError[source]

Bases: ValueError

Exception class when the speed in not in the speed list.

async homeassistant.components.fan.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Expose fan control via statemachine and services.

async homeassistant.components.fan.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.fan.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.fan.is_on(hass, entity_id: str) → bool[source]

Return if the fans are on based on the statemachine.

light

Provides functionality to interact with lights.

class homeassistant.components.light.LightEntity[source]

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.

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, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

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, transition: int | None = None)[source]

Bases: object

Representation of a profile.

SCHEMA = <Schema(Any(ExactSequence([<class 'str'>, Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None), Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None), Any(All(Coerce(int, msg=None), Range(min=0, max=255, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None)]), ExactSequence([<class 'str'>, Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None), Any(All(Coerce(float, msg=None), Range(min=0, max=1, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None), Any(All(Coerce(int, msg=None), Range(min=0, max=255, min_included=True, max_included=True, msg=None), msg=None), <function _coerce_none>, msg=None), Any(All(Coerce(float, msg=None), Clamp(min=0, max=6553), msg=None), <function _coerce_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) → homeassistant.components.light.Profile[source]

Create profile from a CSV row tuple.

hs_color = None
name = None
transition: int | None = None
class homeassistant.components.light.Profiles(hass: homeassistant.core.HomeAssistant)[source]

Bases: object

Representation of available color profiles.

apply_default(entity_id: str, state_on: bool, params: dict) → None[source]

Return the default profile for the given light.

apply_profile(name: str, params: dict) → None[source]

Apply a profile.

async async_initialize() → None[source]

Load and cache profiles.

async homeassistant.components.light.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Expose light control via state machine and services.

async homeassistant.components.light.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.light.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.light.brightness_supported(color_modes: Iterable[str] | None) → bool[source]

Test if brightness is supported.

homeassistant.components.light.color_supported(color_modes: Iterable[str] | None) → bool[source]

Test if color is supported.

homeassistant.components.light.color_temp_supported(color_modes: Iterable[str] | None) → bool[source]

Test if color temperature is supported.

homeassistant.components.light.filter_turn_off_params(light, params)[source]

Filter out params not used in turn off or not supported by the light.

homeassistant.components.light.filter_turn_on_params(light, params)[source]

Filter out params not supported by the light.

homeassistant.components.light.get_supported_color_modes(hass: HomeAssistant, entity_id: str) → set | None[source]

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[source]

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[source]

Calculate supported features with backwards compatibility.

homeassistant.components.light.preprocess_turn_on_alternatives(hass, params)[source]

Process extra data for turn light on request.

Async friendly.

homeassistant.components.light.valid_supported_color_modes()[source]

Validate the given color modes.

lock

Component to interface with locks that can be controlled remotely.

class homeassistant.components.lock.LockEntity[source]

Bases: homeassistant.helpers.entity.Entity

Base class for lock entities.

async async_lock(**kwargs: Any) → None[source]

Lock the lock.

async async_open(**kwargs: Any) → None[source]

Open the door latch.

async async_unlock(**kwargs: Any) → None[source]

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[source]

Lock the lock.

open(**kwargs: Any) → None[source]

Open the door latch.

property state

Return the state.

property state_attributes

Return the state attributes.

unlock(**kwargs: Any) → None[source]

Unlock the lock.

class homeassistant.components.lock.LockEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes lock entities.

key = None
async homeassistant.components.lock.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for locks.

async homeassistant.components.lock.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.lock.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

media_player

Component to interface with various media players.

class homeassistant.components.media_player.MediaPlayerDeviceClass[source]

Bases: homeassistant.backports.enum.StrEnum

Device class for media players.

RECEIVER = 'receiver'
SPEAKER = 'speaker'
TV = 'tv'
class homeassistant.components.media_player.MediaPlayerEntity[source]

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[source]

Return a BrowseMedia instance.

The BrowseMedia instance will be used by the “media_player/browse_media” websocket command.

async async_clear_playlist()[source]

Clear players playlist.

async async_get_browse_image(media_content_type: str, media_content_id: str, media_image_id: str | None = None) → tuple[bytes | None, str | None][source]

Optionally fetch internally accessible image for media browser.

Must be implemented by integration.

async async_get_media_image() → tuple[bytes | None, str | None][source]

Fetch media image of current playing image.

async async_join_players(group_members)[source]

Join group_members as a player group with the current player.

async async_media_next_track()[source]

Send next track command.

async async_media_pause()[source]

Send pause command.

async async_media_play()[source]

Send play command.

async async_media_play_pause()[source]

Play or pause the media player.

async async_media_previous_track()[source]

Send previous track command.

async async_media_seek(position)[source]

Send seek command.

async async_media_stop()[source]

Send stop command.

async async_mute_volume(mute)[source]

Mute the volume.

async async_play_media(media_type, media_id, **kwargs)[source]

Play a piece of media.

async async_select_sound_mode(sound_mode)[source]

Select sound mode.

async async_select_source(source)[source]

Select input source.

async async_set_repeat(repeat)[source]

Set repeat mode.

async async_set_shuffle(shuffle)[source]

Enable/disable shuffle mode.

async async_set_volume_level(volume)[source]

Set volume level, range 0..1.

async async_toggle()[source]

Toggle the power on the media player.

async async_turn_off()[source]

Turn the media player off.

async async_turn_on()[source]

Turn the media player on.

async async_unjoin_player()[source]

Remove this player from any group.

async async_volume_down()[source]

Turn volume down for media player.

This method is a coroutine.

async async_volume_up()[source]

Turn volume up for media player.

This method is a coroutine.

property capability_attributes

Return capability attributes.

clear_playlist()[source]

Clear players playlist.

property device_class

Return the class of this entity.

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[source]

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.

join_players(group_members)[source]

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()[source]

Send next track command.

media_pause()[source]

Send pause command.

media_play()[source]

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()[source]

Send previous track command.

property media_season

Season of current playing media, TV show only.

media_seek(position)[source]

Send seek command.

property media_series_title

Title of series of current playing media, TV show only.

media_stop()[source]

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)[source]

Mute the volume.

play_media(media_type, media_id, **kwargs)[source]

Play a piece of media.

property repeat

Return current repeat mode.

select_sound_mode(sound_mode)[source]

Select sound mode.

select_source(source)[source]

Select input source.

set_repeat(repeat)[source]

Set repeat mode.

set_shuffle(shuffle)[source]

Enable/disable shuffle mode.

set_volume_level(volume)[source]

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.

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()[source]

Turn the media player off.

turn_on()[source]

Turn the media player on.

unjoin_player()[source]

Remove this player from any group.

property volume_level

Volume level of the media player (0..1).

class homeassistant.components.media_player.MediaPlayerEntityDescription(key: str, device_class: MediaPlayerDeviceClass | str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes media player entities.

device_class: MediaPlayerDeviceClass | str | None = None
class homeassistant.components.media_player.MediaPlayerImageView(component: homeassistant.helpers.entity_component.EntityComponent)[source]

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, media_content_id: str | None = None) → web.Response[source]

Start a get request.

name = 'api:media_player:image'
requires_auth = False
url: str | None = '/api/media_player_proxy/{entity_id}'
async homeassistant.components.media_player.async_fetch_image(logger: logging.Logger, hass: HomeAssistant, url: str) → tuple[bytes | None, str | None][source]

Retrieve an image.

async homeassistant.components.media_player.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for media_players.

async homeassistant.components.media_player.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.media_player.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.media_player.is_on(hass, entity_id=None)[source]

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)[source]

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, connection, msg)[source]

Handle get media player cover command.

Async friendly.

notify

Provides functionality to notify people.

async homeassistant.components.notify.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the notify services.

remote

Support to interface with universal remote control devices.

class homeassistant.components.remote.RemoteEntity[source]

Bases: homeassistant.helpers.entity.ToggleEntity

Base class for remote entities.

property activity_list

List of available activities.

async async_delete_command(**kwargs: Any) → None[source]

Delete commands from the database.

async async_learn_command(**kwargs: Any) → None[source]

Learn a command from a device.

async async_send_command()[source]

Send commands to a device.

property current_activity

Active activity.

delete_command(**kwargs: Any) → None[source]

Delete commands from the database.

entity_description = None
learn_command(**kwargs: Any) → None[source]

Learn a command from a device.

send_command()[source]

Send commands to a device.

property state_attributes

Return optional state attributes.

property supported_features

Flag supported features.

class homeassistant.components.remote.RemoteEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.ToggleEntityDescription

A class that describes remote entities.

key = None
async homeassistant.components.remote.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for remotes.

async homeassistant.components.remote.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.remote.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.remote.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool[source]

Return if the remote is on based on the statemachine.

switch

Component to interface with switches that can be controlled remotely.

class homeassistant.components.switch.SwitchDeviceClass[source]

Bases: homeassistant.backports.enum.StrEnum

Device class for switches.

OUTLET = 'outlet'
SWITCH = 'switch'
class homeassistant.components.switch.SwitchEntity[source]

Bases: homeassistant.helpers.entity.ToggleEntity

Base class for switch entities.

property current_power_w

Return the current power usage in W.

property device_class

Return the class of this entity.

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, device_class: SwitchDeviceClass | str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.ToggleEntityDescription

A class that describes switch entities.

device_class: SwitchDeviceClass | str | None = None
async homeassistant.components.switch.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for switches.

async homeassistant.components.switch.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.switch.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.switch.is_on(hass: homeassistant.core.HomeAssistant, entity_id: str) → bool[source]

Return if the switch is on based on the statemachine.

Async friendly.

sensor

Component to interface with various sensors that can be monitored.

class homeassistant.components.sensor.RestoreSensor[source]

Bases: homeassistant.components.sensor.SensorEntity, homeassistant.helpers.restore_state.RestoreEntity

Mixin class for restoring previous sensor state.

async async_get_last_sensor_data() → SensorExtraStoredData | None[source]

Restore native_value and native_unit_of_measurement.

entity_description = None
property extra_restore_state_data

Return sensor specific state data to be restored.

class homeassistant.components.sensor.SensorDeviceClass[source]

Bases: homeassistant.backports.enum.StrEnum

Device class for sensors.

APPARENT_POWER = 'apparent_power'
AQI = 'aqi'
BATTERY = 'battery'
CO = 'carbon_monoxide'
CO2 = 'carbon_dioxide'
CURRENT = 'current'
DATE = 'date'
ENERGY = 'energy'
FREQUENCY = 'frequency'
GAS = 'gas'
HUMIDITY = 'humidity'
ILLUMINANCE = 'illuminance'
MONETARY = 'monetary'
NITROGEN_DIOXIDE = 'nitrogen_dioxide'
NITROGEN_MONOXIDE = 'nitrogen_monoxide'
NITROUS_OXIDE = 'nitrous_oxide'
OZONE = 'ozone'
PM1 = 'pm1'
PM10 = 'pm10'
PM25 = 'pm25'
POWER = 'power'
POWER_FACTOR = 'power_factor'
PRESSURE = 'pressure'
REACTIVE_POWER = 'reactive_power'
SIGNAL_STRENGTH = 'signal_strength'
SULPHUR_DIOXIDE = 'sulphur_dioxide'
TEMPERATURE = 'temperature'
TIMESTAMP = 'timestamp'
VOLATILE_ORGANIC_COMPOUNDS = 'volatile_organic_compounds'
VOLTAGE = 'voltage'
class homeassistant.components.sensor.SensorEntity[source]

Bases: homeassistant.helpers.entity.Entity

Base class for sensor entities.

property capability_attributes

Return the capability attributes.

property device_class

Return the class of this entity.

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, if any.

property unit_of_measurement

Return the unit of measurement of the entity, after unit conversion.

class homeassistant.components.sensor.SensorEntityDescription(key: str, device_class: SensorDeviceClass | str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: None = None, last_reset: datetime | None = None, native_unit_of_measurement: str | None = None, state_class: SensorStateClass | str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes sensor entities.

device_class: SensorDeviceClass | str | None = None
last_reset: datetime | None = None
native_unit_of_measurement: str | None = None
state_class: SensorStateClass | str | None = None
unit_of_measurement: None = None
class homeassistant.components.sensor.SensorExtraStoredData(native_value: StateType | date | datetime, native_unit_of_measurement: str | None)[source]

Bases: homeassistant.helpers.restore_state.ExtraStoredData

Object to hold extra stored data.

as_dict() → dict[source]

Return a dict representation of the sensor data.

classmethod from_dict(restored: dict[str, Any]) → SensorExtraStoredData | None[source]

Initialize a stored sensor state from a dict.

native_unit_of_measurement = None
native_value = None
class homeassistant.components.sensor.SensorStateClass[source]

Bases: homeassistant.backports.enum.StrEnum

State class for sensors.

MEASUREMENT = 'measurement'
TOTAL = 'total'
TOTAL_INCREASING = 'total_increasing'
async homeassistant.components.sensor.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Track states and offer events for sensors.

async homeassistant.components.sensor.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.sensor.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

vacuum

Support for vacuum cleaner robots (botvacs).

class homeassistant.components.vacuum.StateVacuumEntity[source]

Bases: homeassistant.components.vacuum._BaseVacuum

Representation of a vacuum cleaner robot that supports states.

async async_pause()[source]

Pause the cleaning task.

This method must be run in the event loop.

async async_start()[source]

Start or resume the cleaning task.

This method must be run in the event loop.

async async_toggle(**kwargs)[source]

Not supported.

async async_turn_off(**kwargs)[source]

Not supported.

async async_turn_on(**kwargs)[source]

Not supported.

property battery_icon

Return the battery icon for the vacuum cleaner.

entity_description: StateVacuumEntityDescription = None
pause()[source]

Pause the cleaning task.

start()[source]

Start or resume the cleaning task.

property state

Return the state of the vacuum cleaner.

class homeassistant.components.vacuum.StateVacuumEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes vacuum entities.

key = None
class homeassistant.components.vacuum.VacuumEntity[source]

Bases: homeassistant.components.vacuum._BaseVacuum, homeassistant.helpers.entity.ToggleEntity

Representation of a vacuum cleaner robot.

async async_pause()[source]

Not supported.

async async_start()[source]

Not supported.

async async_start_pause(**kwargs)[source]

Start, pause or resume the cleaning task.

This method must be run in the event loop.

async async_turn_off(**kwargs)[source]

Turn the vacuum off stopping the cleaning and returning home.

This method must be run in the event loop.

async async_turn_on(**kwargs)[source]

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)[source]

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)[source]

Turn the vacuum off stopping the cleaning and returning home.

turn_on(**kwargs)[source]

Turn the vacuum on and start cleaning.

class homeassistant.components.vacuum.VacuumEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.ToggleEntityDescription

A class that describes vacuum entities.

key = None
async homeassistant.components.vacuum.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the vacuum component.

async homeassistant.components.vacuum.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.vacuum.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

homeassistant.components.vacuum.is_on(hass, entity_id)[source]

Return if the vacuum is on based on the statemachine.

water_heater

Support for water heater devices.

class homeassistant.components.water_heater.WaterHeaterEntity[source]

Bases: homeassistant.helpers.entity.Entity

Base class for water heater entities.

async async_set_operation_mode(operation_mode)[source]

Set new target operation mode.

async async_set_temperature(**kwargs)[source]

Set new target temperature.

async async_turn_away_mode_off()[source]

Turn away mode off.

async async_turn_away_mode_on()[source]

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)[source]

Set new target operation mode.

set_temperature(**kwargs)[source]

Set new target temperature.

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()[source]

Turn away mode off.

turn_away_mode_on()[source]

Turn away mode on.

class homeassistant.components.water_heater.WaterHeaterEntityEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

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)[source]

Handle away mode service.

async homeassistant.components.water_heater.async_service_temperature_set(entity, service)[source]

Handle set temperature service.

async homeassistant.components.water_heater.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up water_heater devices.

async homeassistant.components.water_heater.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.water_heater.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

weather

Weather component that handles meteorological data for your location.

class homeassistant.components.weather.Forecast[source]

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[source]

Bases: homeassistant.helpers.entity.Entity

ABC for weather data.

property condition

Return the current condition.

entity_description = None
property forecast

Return the forecast in native units.

property humidity

Return the humidity in native units.

property ozone

Return the ozone level.

property precipitation_unit

Return the native unit of measurement for accumulated precipitation.

property precision

Return the precision of the temperature value, after unit conversion.

property pressure

Return the pressure in native units.

property pressure_unit

Return the native unit of measurement for pressure.

property state

Return the current state.

property state_attributes

Return the state attributes, converted from native units to user-configured units.

property temperature

Return the platform temperature in native units (i.e. not converted).

property temperature_unit

Return the native unit of measurement for temperature.

property visibility

Return the visibility in native units.

property visibility_unit

Return the native unit of measurement for visibility.

property wind_bearing

Return the wind bearing.

property wind_speed

Return the wind speed in native units.

property wind_speed_unit

Return the native unit of measurement for wind speed.

class homeassistant.components.weather.WeatherEntityDescription(key: str, device_class: str | None = None, entity_category: EntityCategory | Literal['config', 'diagnostic', 'system'] | None = None, entity_registry_enabled_default: bool = True, force_update: bool = False, icon: str | None = None, name: str | None = None, unit_of_measurement: str | None = None)[source]

Bases: homeassistant.helpers.entity.EntityDescription

A class that describes weather entities.

key = None
async homeassistant.components.weather.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Set up the weather component.

async homeassistant.components.weather.async_setup_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Set up a config entry.

async homeassistant.components.weather.async_unload_entry(hass: homeassistant.core.HomeAssistant, entry: homeassistant.config_entries.ConfigEntry) → bool[source]

Unload a config entry.

webhook

Webhooks for Home Assistant.

class homeassistant.components.webhook.WebhookView[source]

Bases: homeassistant.components.http.view.HomeAssistantView

Handle incoming webhook requests.

cors_allowed = True
async head(request: aiohttp.web_request.Request, webhook_id: str) → aiohttp.web_response.Response[source]

Handle webhook call.

name = 'api:webhook'
async post(request: aiohttp.web_request.Request, webhook_id: str) → aiohttp.web_response.Response[source]

Handle webhook call.

async put(request: aiohttp.web_request.Request, webhook_id: str) → aiohttp.web_response.Response[source]

Handle webhook call.

requires_auth = False
url: str | None = '/api/webhook/{webhook_id}'
homeassistant.components.webhook.async_generate_id() → str[source]

Generate a webhook_id.

homeassistant.components.webhook.async_generate_path(webhook_id: str) → str[source]

Generate the path component for a webhook_id.

homeassistant.components.webhook.async_generate_url(hass: homeassistant.core.HomeAssistant, webhook_id: str) → str[source]

Generate the full URL for a webhook_id.

async homeassistant.components.webhook.async_handle_webhook(hass: homeassistant.core.HomeAssistant, webhook_id: str, request: aiohttp.web_request.Request) → aiohttp.web_response.Response[source]

Handle a webhook.

homeassistant.components.webhook.async_register(hass: HomeAssistant, domain: str, name: str, webhook_id: str, handler: Callable[[HomeAssistant, str, Request], Awaitable[Response | None]], *, local_only=False) → None[source]

Register a webhook.

async homeassistant.components.webhook.async_setup(hass: homeassistant.core.HomeAssistant, config: dict) → bool[source]

Initialize the webhook component.

homeassistant.components.webhook.async_unregister(hass: homeassistant.core.HomeAssistant, webhook_id: str) → None[source]

Remove a webhook.

homeassistant.components.webhook.websocket_handle(hass, connection, msg)[source]

Handle an incoming webhook via the WS API.

homeassistant.components.webhook.websocket_list(hass, connection, msg)[source]

Return a list of webhooks.