1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -49,24 +49,23 @@ class GoogleConfig(AbstractConfig):
expose_by_default = self._config.get(CONF_EXPOSE_BY_DEFAULT)
exposed_domains = self._config.get(CONF_EXPOSED_DOMAINS)
if state.attributes.get('view') is not None:
if state.attributes.get("view") is not None:
# Ignore entities that are views
return False
if state.entity_id in CLOUD_NEVER_EXPOSED_ENTITIES:
return False
explicit_expose = \
self.entity_config.get(state.entity_id, {}).get(CONF_EXPOSE)
explicit_expose = self.entity_config.get(state.entity_id, {}).get(CONF_EXPOSE)
domain_exposed_by_default = \
domain_exposed_by_default = (
expose_by_default and state.domain in exposed_domains
)
# Expose an entity if the entity's domain is exposed by default and
# the configuration doesn't explicitly exclude it from being
# exposed, or if the entity is explicitly exposed
is_default_exposed = \
domain_exposed_by_default and explicit_expose is not False
is_default_exposed = domain_exposed_by_default and explicit_expose is not False
return is_default_exposed or explicit_expose
@@ -85,7 +84,7 @@ class GoogleAssistantView(HomeAssistantView):
"""Handle Google Assistant requests."""
url = GOOGLE_ASSISTANT_API_ENDPOINT
name = 'api:google_assistant'
name = "api:google_assistant"
requires_auth = True
def __init__(self, config):
@@ -96,8 +95,6 @@ class GoogleAssistantView(HomeAssistantView):
"""Handle Google Assistant requests."""
message = await request.json() # type: dict
result = await async_handle_message(
request.app['hass'],
self.config,
request['hass_user'].id,
message)
request.app["hass"], self.config, request["hass_user"].id, message
)
return self.json(result)