Google Assistant: Remove speaker type and earlier filter out devices from being locally exposed (#31830)
* Remove speaker type * Do not expose locks or alarms to Google Local
This commit is contained in:
1 parent
52b045ed30
commit
4501471b8c
5 files changed
+27
-6
No files matched your search
@@ -28,6 +28,7 @@ from .const import (
|
||||
DOMAIN,
|
||||
DOMAIN_TO_GOOGLE_TYPES,
|
||||
ERR_FUNCTION_NOT_SUPPORTED,
|
||||
NOT_EXPOSE_LOCAL,
|
||||
SOURCE_LOCAL,
|
||||
STORE_AGENT_USER_IDS,
|
||||
)
|
||||
@@ -351,6 +352,18 @@ class GoogleEntity:
|
||||
"""If entity should be exposed."""
|
||||
return self.config.should_expose(self.state)
|
||||
|
||||
@callback
|
||||
def should_expose_local(self) -> bool:
|
||||
"""Return if the entity should be exposed locally."""
|
||||
return (
|
||||
self.should_expose()
|
||||
and get_google_type(
|
||||
self.state.domain, self.state.attributes.get(ATTR_DEVICE_CLASS)
|
||||
)
|
||||
not in NOT_EXPOSE_LOCAL
|
||||
and not self.might_2fa()
|
||||
)
|
||||
|
||||
@callback
|
||||
def is_supported(self) -> bool:
|
||||
"""Return if the entity is supported by Google."""
|
||||
@@ -401,7 +414,7 @@ class GoogleEntity:
|
||||
if aliases:
|
||||
device["name"]["nicknames"] = [name] + aliases
|
||||
|
||||
if self.config.is_local_sdk_active:
|
||||
if self.config.is_local_sdk_active and self.should_expose_local():
|
||||
device["otherDeviceIds"] = [{"deviceId": self.entity_id}]
|
||||
device["customData"] = {
|
||||
"webhookId": self.config.local_sdk_webhook_id,
|
||||
|
||||
Reference in new issue
Block a user