Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.google_assistant.helpers.AbstractConfig Class Reference
Inheritance diagram for homeassistant.components.google_assistant.helpers.AbstractConfig:
[legend]
Collaboration diagram for homeassistant.components.google_assistant.helpers.AbstractConfig:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass)
 
def async_connect_agent_user (self, str agent_user_id)
 
None async_deinitialize (self)
 
None async_disable_local_sdk (self)
 
None async_disable_report_state (self)
 
def async_disconnect_agent_user (self, str agent_user_id)
 
None async_enable_local_sdk (self)
 
None async_enable_report_state (self)
 
Collection[str] async_get_agent_users (self)
 
None async_initialize (self)
 
HTTPStatus|None async_report_state (self, dict[str, Any] message, str agent_user_id, str|None event_id=None)
 
def async_report_state_all (self, message)
 
def async_schedule_google_sync (self, str agent_user_id)
 
None async_schedule_google_sync_all (self)
 
def async_sync_entities (self, str agent_user_id)
 
int async_sync_entities_all (self)
 
HTTPStatus async_sync_notification (self, str agent_user_id, str event_id, dict[str, Any] payload)
 
HTTPStatus async_sync_notification_all (self, str event_id, dict[str, Any] payload)
 
def enabled (self)
 
def entity_config (self)
 
def get_agent_user_id_from_context (self, context)
 
def get_agent_user_id_from_webhook (self, webhook_id)
 
def get_local_user_id (self, webhook_id)
 
def get_local_webhook_id (self, agent_user_id)
 
bool is_local_connected (self)
 
def is_local_sdk_active (self)
 
def is_reporting_state (self)
 
def secure_devices_pin (self)
 
def should_2fa (self, state)
 
bool should_expose (self, state)
 
def should_report_state (self)
 

Public Attributes

 hass
 

Static Public Attributes

 None
 

Private Member Functions

int _async_request_sync_devices (self, str agent_user_id)
 
def _handle_local_webhook (self, hass, webhook_id, request)
 

Private Attributes

 _local_last_active
 
 _local_sdk_active
 
 _local_sdk_version_warn
 
 _unsub_report_state
 

Detailed Description

Hold the configuration for Google Assistant.

Definition at line 92 of file helpers.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.google_assistant.helpers.AbstractConfig.__init__ (   self,
HomeAssistant  hass 
)
Initialize abstract config.

Definition at line 97 of file helpers.py.

Member Function Documentation

◆ _async_request_sync_devices()

int homeassistant.components.google_assistant.helpers.AbstractConfig._async_request_sync_devices (   self,
str  agent_user_id 
)
private
Trigger a sync with Google.

Return value is the HTTP status code of the sync request.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig, and homeassistant.components.cloud.google_config.CloudGoogleConfig.

Definition at line 298 of file helpers.py.

◆ _handle_local_webhook()

def homeassistant.components.google_assistant.helpers.AbstractConfig._handle_local_webhook (   self,
  hass,
  webhook_id,
  request 
)
private
Handle an incoming local SDK message.

Definition at line 395 of file helpers.py.

◆ async_connect_agent_user()

def homeassistant.components.google_assistant.helpers.AbstractConfig.async_connect_agent_user (   self,
str  agent_user_id 
)
Add a synced and known agent_user_id.

Called before sending a sync response to Google.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig, and homeassistant.components.cloud.google_config.CloudGoogleConfig.

Definition at line 306 of file helpers.py.

◆ async_deinitialize()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_deinitialize (   self)
Remove listeners.

Definition at line 119 of file helpers.py.

◆ async_disable_local_sdk()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_disable_local_sdk (   self)
Disable the local SDK.

Definition at line 378 of file helpers.py.

◆ async_disable_report_state()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_disable_report_state (   self)
Disable report state.

Definition at line 222 of file helpers.py.

◆ async_disconnect_agent_user()

def homeassistant.components.google_assistant.helpers.AbstractConfig.async_disconnect_agent_user (   self,
str  agent_user_id 
)
Turn off report state and disable further state reporting.

Called when:
 - The user disconnects their account from Google.
 - When the cloud configuration is initialized
 - When sync entities fails with 404

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig, and homeassistant.components.cloud.google_config.CloudGoogleConfig.

Definition at line 313 of file helpers.py.

◆ async_enable_local_sdk()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_enable_local_sdk (   self)
Enable the local SDK.

Definition at line 328 of file helpers.py.

◆ async_enable_report_state()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_enable_report_state (   self)
Enable proactive mode.

Definition at line 212 of file helpers.py.

◆ async_get_agent_users()

Collection[str] homeassistant.components.google_assistant.helpers.AbstractConfig.async_get_agent_users (   self)

◆ async_initialize()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_initialize (   self)
Perform async initialization of config.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig, and homeassistant.components.cloud.google_config.CloudGoogleConfig.

Definition at line 107 of file helpers.py.

◆ async_report_state()

HTTPStatus | None homeassistant.components.google_assistant.helpers.AbstractConfig.async_report_state (   self,
dict[str, Any]  message,
str  agent_user_id,
str | None   event_id = None 
)
Send a state report to Google.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 198 of file helpers.py.

◆ async_report_state_all()

def homeassistant.components.google_assistant.helpers.AbstractConfig.async_report_state_all (   self,
  message 
)
Send a state report to Google for all previously synced users.

Definition at line 203 of file helpers.py.

◆ async_schedule_google_sync()

def homeassistant.components.google_assistant.helpers.AbstractConfig.async_schedule_google_sync (   self,
str  agent_user_id 
)
Schedule a sync.

Definition at line 278 of file helpers.py.

◆ async_schedule_google_sync_all()

None homeassistant.components.google_assistant.helpers.AbstractConfig.async_schedule_google_sync_all (   self)
Schedule a sync for all registered agents.

Definition at line 293 of file helpers.py.

◆ async_sync_entities()

def homeassistant.components.google_assistant.helpers.AbstractConfig.async_sync_entities (   self,
str  agent_user_id 
)
Sync all entities to Google.

Definition at line 228 of file helpers.py.

◆ async_sync_entities_all()

int homeassistant.components.google_assistant.helpers.AbstractConfig.async_sync_entities_all (   self)
Sync all entities to Google for all registered agents.

Definition at line 237 of file helpers.py.

◆ async_sync_notification()

HTTPStatus homeassistant.components.google_assistant.helpers.AbstractConfig.async_sync_notification (   self,
str  agent_user_id,
str  event_id,
dict[str, Any]   payload 
)
Sync notifications to Google.

Definition at line 250 of file helpers.py.

◆ async_sync_notification_all()

HTTPStatus homeassistant.components.google_assistant.helpers.AbstractConfig.async_sync_notification_all (   self,
str  event_id,
dict[str, Any]   payload 
)
Sync notification to Google for all registered agents.

Definition at line 262 of file helpers.py.

◆ enabled()

def homeassistant.components.google_assistant.helpers.AbstractConfig.enabled (   self)

◆ entity_config()

def homeassistant.components.google_assistant.helpers.AbstractConfig.entity_config (   self)

◆ get_agent_user_id_from_context()

def homeassistant.components.google_assistant.helpers.AbstractConfig.get_agent_user_id_from_context (   self,
  context 
)
Get agent user ID from context.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 179 of file helpers.py.

◆ get_agent_user_id_from_webhook()

def homeassistant.components.google_assistant.helpers.AbstractConfig.get_agent_user_id_from_webhook (   self,
  webhook_id 
)
Map webhook ID to a Google agent user ID.

Return None if no agent user id is found for the webhook_id.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 183 of file helpers.py.

◆ get_local_user_id()

def homeassistant.components.google_assistant.helpers.AbstractConfig.get_local_user_id (   self,
  webhook_id 
)
Map webhook ID to a Home Assistant user ID.

Any action initiated by Google Assistant via the local SDK will be attributed
to the returned user ID.

Return None if no user id is found for the webhook_id.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 165 of file helpers.py.

◆ get_local_webhook_id()

def homeassistant.components.google_assistant.helpers.AbstractConfig.get_local_webhook_id (   self,
  agent_user_id 
)
Return the webhook ID to be used for actions for a given agent user id via the local SDK.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 175 of file helpers.py.

◆ is_local_connected()

bool homeassistant.components.google_assistant.helpers.AbstractConfig.is_local_connected (   self)
Return if local is connected.

Definition at line 156 of file helpers.py.

◆ is_local_sdk_active()

def homeassistant.components.google_assistant.helpers.AbstractConfig.is_local_sdk_active (   self)
Return if we're actively accepting local messages.

Definition at line 146 of file helpers.py.

◆ is_reporting_state()

def homeassistant.components.google_assistant.helpers.AbstractConfig.is_reporting_state (   self)
Return if we're actively reporting states.

Definition at line 141 of file helpers.py.

◆ secure_devices_pin()

def homeassistant.components.google_assistant.helpers.AbstractConfig.secure_devices_pin (   self)

◆ should_2fa()

def homeassistant.components.google_assistant.helpers.AbstractConfig.should_2fa (   self,
  state 
)
If an entity should have 2FA checked.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 194 of file helpers.py.

◆ should_expose()

bool homeassistant.components.google_assistant.helpers.AbstractConfig.should_expose (   self,
  state 
)
Return if entity should be exposed.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig.

Definition at line 190 of file helpers.py.

◆ should_report_state()

def homeassistant.components.google_assistant.helpers.AbstractConfig.should_report_state (   self)
Return if states should be proactively reported.

Reimplemented in homeassistant.components.google_assistant.http.GoogleConfig, and homeassistant.components.cloud.google_config.CloudGoogleConfig.

Definition at line 152 of file helpers.py.

Member Data Documentation

◆ _local_last_active

homeassistant.components.google_assistant.helpers.AbstractConfig._local_last_active
private

Definition at line 401 of file helpers.py.

◆ _local_sdk_active

homeassistant.components.google_assistant.helpers.AbstractConfig._local_sdk_active
private

Definition at line 101 of file helpers.py.

◆ _local_sdk_version_warn

homeassistant.components.google_assistant.helpers.AbstractConfig._local_sdk_version_warn
private

Definition at line 103 of file helpers.py.

◆ _unsub_report_state

homeassistant.components.google_assistant.helpers.AbstractConfig._unsub_report_state
private

Definition at line 219 of file helpers.py.

◆ hass

homeassistant.components.google_assistant.helpers.AbstractConfig.hass

Definition at line 99 of file helpers.py.

◆ None

homeassistant.components.google_assistant.helpers.AbstractConfig.None
static

Definition at line 95 of file helpers.py.


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