Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.unifiprotect.data.ProtectData Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass, ProtectApiClient protect, timedelta update_interval, UFPConfigEntry entry)
 
None async_add_pending_camera_id (self, str camera_id)
 
None async_refresh (self)
 
None async_setup (self)
 
None async_stop (self, *Any args)
 
CALLBACK_TYPE async_subscribe (self, str mac, Callable[[ProtectDeviceType], None] update_callback)
 
None async_subscribe_adopt (self, Callable[[ProtectAdoptableDeviceModel], None] add_callback)
 
bool disable_stream (self)
 
Generator[ProtectAdoptableDeviceModel] get_by_types (self, Iterable[ModelType] device_types, bool ignore_unadopted=True)
 
Generator[Camera] get_cameras (self, bool ignore_unadopted=True)
 
int max_events (self)
 

Public Attributes

 add_signal
 
 adopt_signal
 
 api
 
 channels_signal
 
 last_update_success
 

Private Member Functions

None _async_add_device (self, ProtectAdoptableDeviceModel device)
 
None _async_poll (self, datetime now)
 
None _async_process_updates (self)
 
None _async_process_ws_message (self, WSSubscriptionMessage message)
 
None _async_remove_device (self, ProtectAdoptableDeviceModel device)
 
None _async_signal_device_update (self, ProtectDeviceType device)
 
None _async_unsubscribe (self, str mac, Callable[[ProtectDeviceType], None] update_callback)
 
None _async_update_change (self, bool success, bool force_update=False, Exception|None exception=None)
 
None _async_update_device (self, ProtectAdoptableDeviceModel|NVR device, dict[str, Any] changed_data)
 
None _async_websocket_state_changed (self, WebsocketState state)
 

Private Attributes

 _auth_failures
 
 _entry
 
 _hass
 
 _unsubs
 
 _update_interval
 

Detailed Description

Coordinate updates.

Definition at line 67 of file data.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.unifiprotect.data.ProtectData.__init__ (   self,
HomeAssistant  hass,
ProtectApiClient  protect,
timedelta  update_interval,
UFPConfigEntry  entry 
)
Initialize an subscriber.

Definition at line 70 of file data.py.

Member Function Documentation

◆ _async_add_device()

None homeassistant.components.unifiprotect.data.ProtectData._async_add_device (   self,
ProtectAdoptableDeviceModel  device 
)
private

Definition at line 208 of file data.py.

◆ _async_poll()

None homeassistant.components.unifiprotect.data.ProtectData._async_poll (   self,
datetime  now 
)
private
Poll the Protect API.

Definition at line 305 of file data.py.

◆ _async_process_updates()

None homeassistant.components.unifiprotect.data.ProtectData._async_process_updates (   self)
private
Process update from the protect data.

Definition at line 298 of file data.py.

◆ _async_process_ws_message()

None homeassistant.components.unifiprotect.data.ProtectData._async_process_ws_message (   self,
WSSubscriptionMessage  message 
)
private
Process a message from the websocket.

Definition at line 252 of file data.py.

◆ _async_remove_device()

None homeassistant.components.unifiprotect.data.ProtectData._async_remove_device (   self,
ProtectAdoptableDeviceModel  device 
)
private

Definition at line 217 of file data.py.

◆ _async_signal_device_update()

None homeassistant.components.unifiprotect.data.ProtectData._async_signal_device_update (   self,
ProtectDeviceType  device 
)
private
Call the callbacks for a device_id.

Definition at line 332 of file data.py.

◆ _async_unsubscribe()

None homeassistant.components.unifiprotect.data.ProtectData._async_unsubscribe (   self,
str  mac,
Callable[[ProtectDeviceType], None]   update_callback 
)
private
Remove a callback subscriber.

Definition at line 323 of file data.py.

◆ _async_update_change()

None homeassistant.components.unifiprotect.data.ProtectData._async_update_change (   self,
bool  success,
bool   force_update = False,
Exception | None   exception = None 
)
private
Process a change in update success.

Definition at line 148 of file data.py.

◆ _async_update_device()

None homeassistant.components.unifiprotect.data.ProtectData._async_update_device (   self,
ProtectAdoptableDeviceModel | NVR  device,
dict[str, Any]   changed_data 
)
private

Definition at line 229 of file data.py.

◆ _async_websocket_state_changed()

None homeassistant.components.unifiprotect.data.ProtectData._async_websocket_state_changed (   self,
WebsocketState  state 
)
private
Handle a change in the websocket state.

Definition at line 144 of file data.py.

◆ async_add_pending_camera_id()

None homeassistant.components.unifiprotect.data.ProtectData.async_add_pending_camera_id (   self,
str  camera_id 
)
Add pending camera.

A "pending camera" is one that has been adopted by not had its camera channels
initialized yet. Will cause Websocket code to check for channels to be
initialized for the camera and issue a dispatch once they do.

Definition at line 198 of file data.py.

◆ async_refresh()

None homeassistant.components.unifiprotect.data.ProtectData.async_refresh (   self)
Update the data.

Definition at line 179 of file data.py.

◆ async_setup()

None homeassistant.components.unifiprotect.data.ProtectData.async_setup (   self)
Subscribe and do the refresh.

Definition at line 130 of file data.py.

◆ async_stop()

None homeassistant.components.unifiprotect.data.ProtectData.async_stop (   self,
*Any  args 
)
Stop processing data.

Definition at line 172 of file data.py.

◆ async_subscribe()

CALLBACK_TYPE homeassistant.components.unifiprotect.data.ProtectData.async_subscribe (   self,
str  mac,
Callable[[ProtectDeviceType], None]   update_callback 
)
Add an callback subscriber.

Definition at line 315 of file data.py.

◆ async_subscribe_adopt()

None homeassistant.components.unifiprotect.data.ProtectData.async_subscribe_adopt (   self,
Callable[[ProtectAdoptableDeviceModel], None]   add_callback 
)
Add an callback for on device adopt.

Definition at line 104 of file data.py.

◆ disable_stream()

bool homeassistant.components.unifiprotect.data.ProtectData.disable_stream (   self)
Check if RTSP is disabled.

Definition at line 94 of file data.py.

◆ get_by_types()

Generator[ProtectAdoptableDeviceModel] homeassistant.components.unifiprotect.data.ProtectData.get_by_types (   self,
Iterable[ModelType]  device_types,
bool   ignore_unadopted = True 
)
Get all devices matching types.

Definition at line 112 of file data.py.

◆ get_cameras()

Generator[Camera] homeassistant.components.unifiprotect.data.ProtectData.get_cameras (   self,
bool   ignore_unadopted = True 
)
Get all cameras.

Definition at line 123 of file data.py.

◆ max_events()

int homeassistant.components.unifiprotect.data.ProtectData.max_events (   self)
Max number of events to load at once.

Definition at line 99 of file data.py.

Member Data Documentation

◆ _auth_failures

homeassistant.components.unifiprotect.data.ProtectData._auth_failures
private

Definition at line 86 of file data.py.

◆ _entry

homeassistant.components.unifiprotect.data.ProtectData._entry
private

Definition at line 78 of file data.py.

◆ _hass

homeassistant.components.unifiprotect.data.ProtectData._hass
private

Definition at line 79 of file data.py.

◆ _unsubs

homeassistant.components.unifiprotect.data.ProtectData._unsubs
private

Definition at line 135 of file data.py.

◆ _update_interval

homeassistant.components.unifiprotect.data.ProtectData._update_interval
private

Definition at line 80 of file data.py.

◆ add_signal

homeassistant.components.unifiprotect.data.ProtectData.add_signal

Definition at line 90 of file data.py.

◆ adopt_signal

homeassistant.components.unifiprotect.data.ProtectData.adopt_signal

Definition at line 89 of file data.py.

◆ api

homeassistant.components.unifiprotect.data.ProtectData.api

Definition at line 88 of file data.py.

◆ channels_signal

homeassistant.components.unifiprotect.data.ProtectData.channels_signal

Definition at line 91 of file data.py.

◆ last_update_success

homeassistant.components.unifiprotect.data.ProtectData.last_update_success

Definition at line 87 of file data.py.


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