Improve logging of google_assistant messages (#110637)

* Improve logging of google_assistant messages

* Add tests

* Add test
This commit is contained in:
Erik Montnemery 2024-02-26 11:43:31 +01:00 committed by GitHub
parent 7b059b3dff
commit 9b91da23c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1301 additions and 47 deletions

View file

@ -330,10 +330,20 @@ class CloudGoogleConfig(AbstractConfig):
"""Return if we have a Agent User Id registered."""
return len(self.async_get_agent_users()) > 0
def get_agent_user_id(self, context: Any) -> str:
def get_agent_user_id_from_context(self, context: Any) -> str:
"""Get agent user ID making request."""
return self.agent_user_id
def get_agent_user_id_from_webhook(self, webhook_id: str) -> str | None:
"""Map webhook ID to a Google agent user ID.
Return None if no agent user id is found for the webhook_id.
"""
if webhook_id != self._prefs.google_local_webhook_id:
return None
return self.agent_user_id
def _2fa_disabled_legacy(self, entity_id: str) -> bool | None:
"""If an entity should be checked for 2FA."""
entity_configs = self._prefs.google_entity_configs