Move Google Assistant entity config out of customize (#11499)

* Move Google Assistant entity config out of customize

* CONF_ALIAS -> CONF_ALIASES

* Lint
This commit is contained in:
Paulus Schoutsen 2018-01-09 15:14:56 -08:00 committed by GitHub
parent 13042d5557
commit 8313225b40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 60 deletions

View file

@ -36,6 +36,15 @@ def assistant_client(loop, hass, test_client):
'project_id': PROJECT_ID,
'client_id': CLIENT_ID,
'access_token': ACCESS_TOKEN,
'entity_config': {
'light.ceiling_lights': {
'aliases': ['top lights', 'ceiling lights'],
'name': 'Roof Lights',
},
'switch.decorative_lights': {
'type': 'light'
}
}
}
}))
@ -88,26 +97,6 @@ def hass_fixture(loop, hass):
}]
}))
# Kitchen light is explicitly excluded from being exposed
ceiling_lights_entity = hass.states.get('light.ceiling_lights')
attrs = dict(ceiling_lights_entity.attributes)
attrs[ga.const.ATTR_GOOGLE_ASSISTANT_NAME] = "Roof Lights"
attrs[ga.const.CONF_ALIASES] = ['top lights', 'ceiling lights']
hass.states.async_set(
ceiling_lights_entity.entity_id,
ceiling_lights_entity.state,
attributes=attrs)
# By setting the google_assistant_type = 'light'
# we can override how a device is reported to GA
switch_light = hass.states.get('switch.decorative_lights')
attrs = dict(switch_light.attributes)
attrs[ga.const.ATTR_GOOGLE_ASSISTANT_TYPE] = "light"
hass.states.async_set(
switch_light.entity_id,
switch_light.state,
attributes=attrs)
return hass