Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.camera.Camera Class Reference
Inheritance diagram for homeassistant.components.camera.Camera:
[legend]
Collaboration diagram for homeassistant.components.camera.Camera:
[legend]

Public Member Functions

None __init__ (self)
 
bytes|None async_camera_image (self, int|None width=None, int|None height=None)
 
Stream|None async_create_stream (self)
 
None async_disable_motion_detection (self)
 
None async_enable_motion_detection (self)
 
WebRTCClientConfiguration async_get_webrtc_client_configuration (self)
 
None async_handle_async_webrtc_offer (self, str offer_sdp, str session_id, WebRTCSendMessage send_message)
 
str|None async_handle_web_rtc_offer (self, str offer_sdp)
 
None async_internal_added_to_hass (self)
 
None async_on_webrtc_candidate (self, str session_id, RTCIceCandidateInit candidate)
 
None async_refresh_providers (self, *bool write_state=True)
 
None async_turn_off (self)
 
None async_turn_on (self)
 
None async_update_token (self)
 
None async_write_ha_state (self)
 
bool available (self)
 
str|None brand (self)
 
CameraCapabilities camera_capabilities (self)
 
bytes|None camera_image (self, int|None width=None, int|None height=None)
 
None close_webrtc_session (self, str session_id)
 
None disable_motion_detection (self)
 
None enable_motion_detection (self)
 
str entity_picture (self)
 
float frame_interval (self)
 
StreamType|None frontend_stream_type (self)
 
web.StreamResponse|None handle_async_mjpeg_stream (self, web.Request request)
 
web.StreamResponse handle_async_still_stream (self, web.Request request, float interval)
 
bool is_on (self)
 
bool is_recording (self)
 
bool is_streaming (self)
 
str|None model (self)
 
bool motion_detection_enabled (self)
 
str state (self)
 
dict[str, str|Nonestate_attributes (self)
 
str|None stream_source (self)
 
CameraEntityFeature supported_features (self)
 
CameraEntityFeature supported_features_compat (self)
 
None turn_off (self)
 
None turn_on (self)
 
bool use_stream_for_stills (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.Entity
None __init_subclass__ (cls, **Any kwargs)
 
str __repr__ (self)
 
None add_to_platform_abort (self)
 
None add_to_platform_finish (self)
 
None add_to_platform_start (self, HomeAssistant hass, EntityPlatform platform, asyncio.Semaphore|None parallel_updates)
 
bool assumed_state (self)
 
None async_added_to_hass (self)
 
None async_device_update (self, bool warning=True)
 
None async_internal_will_remove_from_hass (self)
 
None async_on_remove (self, CALLBACK_TYPE func)
 
None async_registry_entry_updated (self)
 
None async_remove (self, *bool force_remove=False)
 
None async_removed_from_registry (self)
 
None async_schedule_update_ha_state (self, bool force_refresh=False)
 
None async_set_context (self, Context context)
 
None async_update_ha_state (self, bool force_refresh=False)
 
None async_will_remove_from_hass (self)
 
str|None attribution (self)
 
dict[str, Any]|None capability_attributes (self)
 
str|None device_class (self)
 
DeviceInfo|None device_info (self)
 
bool enabled (self)
 
EntityCategory|None entity_category (self)
 
bool entity_registry_enabled_default (self)
 
bool entity_registry_visible_default (self)
 
Mapping[str, Any]|None extra_state_attributes (self)
 
bool force_update (self)
 
HassJobType get_hassjob_type (self, str function_name)
 
er.EntityOptionsType|None get_initial_entity_options (self)
 
bool has_entity_name (self)
 
str|None icon (self)
 
str|UndefinedType|None name (self)
 
None schedule_update_ha_state (self, bool force_refresh=False)
 
bool should_poll (self)
 
str|None suggested_object_id (self)
 
str|None translation_key (self)
 
Mapping[str, strtranslation_placeholders (self)
 
str|None unique_id (self)
 
str|None unit_of_measurement (self)
 
bool use_device_name (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.CachedProperties
None __init__ (cls, str name, tuple[type,...] bases, dict[Any, Any] namespace, **Any kwargs)
 
Any __new__ (mcs, str name, tuple[type,...] bases, dict[Any, Any] namespace, set[str]|None cached_properties=None, **Any kwargs)
 

Public Attributes

 stream
 
- Public Attributes inherited from homeassistant.helpers.entity.Entity
 device_entry
 
 entity_id
 
 hass
 
 parallel_updates
 
 platform
 
 registry_entry
 

Static Public Attributes

 bool
 
 CameraEntityFeature
 
 float
 
 None
 
- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 

Private Member Functions

WebRTCClientConfiguration _async_get_webrtc_client_configuration (self)
 
None _invalidate_camera_capabilities_cache (self)
 
_T|None _T (self, Callable[[HomeAssistant, Camera], Coroutine[None, None, _T|None]] fn)
 

Private Attributes

 __supports_stream
 
 _create_stream_lock
 
 _deprecate_attr_frontend_stream_type_logged
 
 _legacy_webrtc_provider
 
 _supports_native_async_webrtc
 
 _supports_native_sync_webrtc
 
 _warned_old_signature
 
 _webrtc_provider
 

Static Private Attributes

 _entity_component_unrecorded_attributes
 

Detailed Description

The base class for camera entities.

Definition at line 461 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.camera.Camera.__init__ (   self)
Initialize a camera.

Definition at line 484 of file __init__.py.

Member Function Documentation

◆ _async_get_webrtc_client_configuration()

WebRTCClientConfiguration homeassistant.components.camera.Camera._async_get_webrtc_client_configuration (   self)
private
Return the WebRTC client configuration adjustable per integration.

Reimplemented in homeassistant.components.nest.camera.NestWebRTCEntity.

Definition at line 874 of file __init__.py.

◆ _invalidate_camera_capabilities_cache()

None homeassistant.components.camera.Camera._invalidate_camera_capabilities_cache (   self)
private
Invalidate the camera capabilities cache.

Definition at line 917 of file __init__.py.

◆ _T()

_T | None homeassistant.components.camera.Camera._T (   self,
Callable[[HomeAssistant, Camera], Coroutine[None, None, _T | None]]   fn 
)
private
Get first provider that supports this camera.

Definition at line 864 of file __init__.py.

◆ async_camera_image()

bytes | None homeassistant.components.camera.Camera.async_camera_image (   self,
int | None   width = None,
int | None   height = None 
)
Return bytes of camera image.

Reimplemented in homeassistant.components.yi.camera.YiCamera, homeassistant.components.yale.camera.YaleCamera, homeassistant.components.xiaomi.camera.XiaomiCamera, homeassistant.components.xeoma.camera.XeomaCamera, homeassistant.components.unifiprotect.camera.ProtectCamera, homeassistant.components.trafikverket_camera.camera.TVCamera, homeassistant.components.synology_dsm.camera.SynoDSMCamera, homeassistant.components.skybell.camera.SkybellCamera, homeassistant.components.ring.camera.RingCam, homeassistant.components.reolink.camera.ReolinkCamera, homeassistant.components.push.camera.PushCamera, homeassistant.components.prusalink.camera.PrusaLinkJobPreviewEntity, homeassistant.components.proxy.camera.ProxyCamera, homeassistant.components.prosegur.camera.ProsegurCamera, homeassistant.components.onvif.camera.ONVIFCameraEntity, homeassistant.components.netatmo.camera.NetatmoCamera, homeassistant.components.nest.camera.NestWebRTCEntity, homeassistant.components.mqtt.camera.MqttCamera, homeassistant.components.mjpeg.camera.MjpegCamera, homeassistant.components.hyperion.camera.HyperionCamera, homeassistant.components.homekit_controller.camera.HomeKitCamera, homeassistant.components.generic.camera.GenericCamera, homeassistant.components.fully_kiosk.camera.FullyCameraEntity, homeassistant.components.ffmpeg.camera.FFmpegCamera, homeassistant.components.familyhub.camera.FamilyHubCamera, homeassistant.components.ezviz.camera.EzvizCamera, homeassistant.components.esphome.camera.EsphomeCamera, homeassistant.components.doorbird.camera.DoorBirdCamera, homeassistant.components.demo.camera.DemoCamera, homeassistant.components.canary.camera.CanaryCamera, homeassistant.components.buienradar.camera.BuienradarCam, homeassistant.components.august.camera.AugustCamera, and homeassistant.components.amcrest.camera.AmcrestCam.

Definition at line 724 of file __init__.py.

◆ async_create_stream()

Stream | None homeassistant.components.camera.Camera.async_create_stream (   self)
Create a Stream for stream_source.

Definition at line 615 of file __init__.py.

◆ async_disable_motion_detection()

◆ async_enable_motion_detection()

◆ async_get_webrtc_client_configuration()

WebRTCClientConfiguration homeassistant.components.camera.Camera.async_get_webrtc_client_configuration (   self)
Return the WebRTC client configuration and extend it with the registered ice servers.

Definition at line 880 of file __init__.py.

◆ async_handle_async_webrtc_offer()

None homeassistant.components.camera.Camera.async_handle_async_webrtc_offer (   self,
str  offer_sdp,
str  session_id,
WebRTCSendMessage   send_message 
)
Handle the async WebRTC offer.

Async means that it could take some time to process the offer and responses/message
will be sent with the send_message callback.
This method is used by cameras with CameraEntityFeature.STREAM.
An integration overriding this method must also implement async_on_webrtc_candidate.

Integrations can override with a native WebRTC implementation.

Reimplemented in homeassistant.components.ring.camera.RingCam, and homeassistant.components.nest.camera.NestWebRTCEntity.

Definition at line 655 of file __init__.py.

◆ async_handle_web_rtc_offer()

str | None homeassistant.components.camera.Camera.async_handle_web_rtc_offer (   self,
str  offer_sdp 
)
Handle the WebRTC offer and return an answer.

This is used by cameras with CameraEntityFeature.STREAM
and StreamType.WEB_RTC.

Integrations can override with a native WebRTC implementation.

Definition at line 646 of file __init__.py.

◆ async_internal_added_to_hass()

None homeassistant.components.camera.Camera.async_internal_added_to_hass (   self)
Run when entity about to be added to hass.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 823 of file __init__.py.

◆ async_on_webrtc_candidate()

None homeassistant.components.camera.Camera.async_on_webrtc_candidate (   self,
str  session_id,
RTCIceCandidateInit   candidate 
)
Handle a WebRTC candidate.

Reimplemented in homeassistant.components.ring.camera.RingCam, and homeassistant.components.nest.camera.NestWebRTCEntity.

Definition at line 901 of file __init__.py.

◆ async_refresh_providers()

None homeassistant.components.camera.Camera.async_refresh_providers (   self,
*bool   write_state = True 
)
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.

Definition at line 831 of file __init__.py.

◆ async_turn_off()

◆ async_turn_on()

◆ async_update_token()

None homeassistant.components.camera.Camera.async_update_token (   self)
Update the used token.

Definition at line 818 of file __init__.py.

◆ async_write_ha_state()

None homeassistant.components.camera.Camera.async_write_ha_state (   self)
Write the state to the state machine.

Schedules async_refresh_providers if support of streams have changed.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 939 of file __init__.py.

◆ available()

◆ brand()

◆ camera_capabilities()

CameraCapabilities homeassistant.components.camera.Camera.camera_capabilities (   self)
Return the camera capabilities.

Definition at line 923 of file __init__.py.

◆ camera_image()

◆ close_webrtc_session()

None homeassistant.components.camera.Camera.close_webrtc_session (   self,
str  session_id 
)
Close a WebRTC session.

Reimplemented in homeassistant.components.ring.camera.RingCam, and homeassistant.components.nest.camera.NestWebRTCEntity.

Definition at line 911 of file __init__.py.

◆ disable_motion_detection()

None homeassistant.components.camera.Camera.disable_motion_detection (   self)

◆ enable_motion_detection()

None homeassistant.components.camera.Camera.enable_motion_detection (   self)

◆ entity_picture()

str homeassistant.components.camera.Camera.entity_picture (   self)
Return a link to the camera feed as entity picture.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 515 of file __init__.py.

◆ frame_interval()

float homeassistant.components.camera.Camera.frame_interval (   self)
Return the interval between frames of the mjpeg stream.

Reimplemented in homeassistant.components.vivotek.camera.VivotekCam, and homeassistant.components.rpi_camera.camera.RaspberryCamera.

Definition at line 570 of file __init__.py.

◆ frontend_stream_type()

StreamType | None homeassistant.components.camera.Camera.frontend_stream_type (   self)
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.

Definition at line 575 of file __init__.py.

◆ handle_async_mjpeg_stream()

web.StreamResponse | None homeassistant.components.camera.Camera.handle_async_mjpeg_stream (   self,
web.Request   request 
)

◆ handle_async_still_stream()

web.StreamResponse homeassistant.components.camera.Camera.handle_async_still_stream (   self,
web.Request  request,
float   interval 
)
Generate an HTTP MJPEG stream from camera images.

Definition at line 732 of file __init__.py.

◆ is_on()

◆ is_recording()

◆ is_streaming()

bool homeassistant.components.camera.Camera.is_streaming (   self)
Return true if the device is streaming.

Definition at line 550 of file __init__.py.

◆ model()

◆ motion_detection_enabled()

◆ state()

str homeassistant.components.camera.Camera.state (   self)
Return the camera state.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 752 of file __init__.py.

◆ state_attributes()

dict[str, str | None] homeassistant.components.camera.Camera.state_attributes (   self)
Return the camera state attributes.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 799 of file __init__.py.

◆ stream_source()

◆ supported_features()

CameraEntityFeature homeassistant.components.camera.Camera.supported_features (   self)

◆ supported_features_compat()

CameraEntityFeature homeassistant.components.camera.Camera.supported_features_compat (   self)
Return the supported features as CameraEntityFeature.

Remove this compatibility shim in 2025.1 or later.

Definition at line 532 of file __init__.py.

◆ turn_off()

None homeassistant.components.camera.Camera.turn_off (   self)
Turn off camera.

Reimplemented in homeassistant.components.abode.camera.AbodeCamera.

Definition at line 765 of file __init__.py.

◆ turn_on()

None homeassistant.components.camera.Camera.turn_on (   self)
Turn on camera.

Reimplemented in homeassistant.components.abode.camera.AbodeCamera.

Definition at line 773 of file __init__.py.

◆ use_stream_for_stills()

bool homeassistant.components.camera.Camera.use_stream_for_stills (   self)

Member Data Documentation

◆ __supports_stream

homeassistant.components.camera.Camera.__supports_stream
private

Definition at line 826 of file __init__.py.

◆ _create_stream_lock

homeassistant.components.camera.Camera._create_stream_lock
private

Definition at line 619 of file __init__.py.

◆ _deprecate_attr_frontend_stream_type_logged

homeassistant.components.camera.Camera._deprecate_attr_frontend_stream_type_logged
private

Definition at line 503 of file __init__.py.

◆ _entity_component_unrecorded_attributes

homeassistant.components.camera.Camera._entity_component_unrecorded_attributes
staticprivate

Definition at line 464 of file __init__.py.

◆ _legacy_webrtc_provider

homeassistant.components.camera.Camera._legacy_webrtc_provider
private

Definition at line 859 of file __init__.py.

◆ _supports_native_async_webrtc

homeassistant.components.camera.Camera._supports_native_async_webrtc
private

Definition at line 499 of file __init__.py.

◆ _supports_native_sync_webrtc

homeassistant.components.camera.Camera._supports_native_sync_webrtc
private

Definition at line 496 of file __init__.py.

◆ _warned_old_signature

homeassistant.components.camera.Camera._warned_old_signature
private

Definition at line 491 of file __init__.py.

◆ _webrtc_provider

homeassistant.components.camera.Camera._webrtc_provider
private

Definition at line 858 of file __init__.py.

◆ bool

homeassistant.components.camera.Camera.bool
static

Definition at line 473 of file __init__.py.

◆ CameraEntityFeature

homeassistant.components.camera.Camera.CameraEntityFeature
static

Definition at line 480 of file __init__.py.

◆ float

homeassistant.components.camera.Camera.float
static

Definition at line 470 of file __init__.py.

◆ None

homeassistant.components.camera.Camera.None
static

Definition at line 469 of file __init__.py.

◆ stream

homeassistant.components.camera.Camera.stream

Definition at line 626 of file __init__.py.


The documentation for this class was generated from the following file: