mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Changing handling for google_assistant groups to treat them as lights. (#10111)
* Fixed aliases warning message * Fixed test cases * Changing handling for google_assistant groups to treat them as lights - amending to include user info. * Enable brightness, RGB, etc for groups in Google Assistant * Revert color/hue/temp settings * Change servce from light to homeassistant * Fixed config_units * Convert from light to switch * Change group to switch * Update tests to switch instead of light for group
This commit is contained in:
parent
0668fba7bd
commit
282e37ef14
@ -133,6 +133,8 @@ class GoogleAssistantView(HomeAssistantView):
|
||||
(service, service_data) = determine_service(
|
||||
eid, execution.get('command'), execution.get('params'),
|
||||
hass.config.units)
|
||||
if domain == "group":
|
||||
domain = "homeassistant"
|
||||
success = yield from hass.services.async_call(
|
||||
domain, service, service_data, blocking=True)
|
||||
result = {"ids": [eid], "states": {}}
|
||||
|
@ -39,7 +39,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
# Mapping is [actions schema, primary trait, optional features]
|
||||
# optional is SUPPORT_* = (trait, command)
|
||||
MAPPING_COMPONENT = {
|
||||
group.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
||||
group.DOMAIN: [TYPE_SWITCH, TRAIT_ONOFF, None],
|
||||
scene.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
||||
script.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
||||
switch.DOMAIN: [TYPE_SWITCH, TRAIT_ONOFF, None],
|
||||
@ -94,10 +94,11 @@ def entity_to_device(entity: Entity, units: UnitSystem):
|
||||
|
||||
# use aliases
|
||||
aliases = entity.attributes.get(CONF_ALIASES)
|
||||
if isinstance(aliases, list):
|
||||
device['name']['nicknames'] = aliases
|
||||
else:
|
||||
_LOGGER.warning("%s must be a list", CONF_ALIASES)
|
||||
if aliases:
|
||||
if isinstance(aliases, list):
|
||||
device['name']['nicknames'] = aliases
|
||||
else:
|
||||
_LOGGER.warning("%s must be a list", CONF_ALIASES)
|
||||
|
||||
# add trait if entity supports feature
|
||||
if class_data[2]:
|
||||
|
@ -75,16 +75,16 @@ DEMO_DEVICES = [{
|
||||
'name': {
|
||||
'name': 'all lights'
|
||||
},
|
||||
'traits': ['action.devices.traits.Scene'],
|
||||
'type': 'action.devices.types.SCENE',
|
||||
'traits': ['action.devices.traits.OnOff'],
|
||||
'type': 'action.devices.types.SWITCH',
|
||||
'willReportState': False
|
||||
}, {
|
||||
'id': 'group.all_switches',
|
||||
'name': {
|
||||
'name': 'all switches'
|
||||
},
|
||||
'traits': ['action.devices.traits.Scene'],
|
||||
'type': 'action.devices.types.SCENE',
|
||||
'traits': ['action.devices.traits.OnOff'],
|
||||
'type': 'action.devices.types.SWITCH',
|
||||
'willReportState': False
|
||||
}, {
|
||||
'id':
|
||||
@ -131,8 +131,8 @@ DEMO_DEVICES = [{
|
||||
'name': {
|
||||
'name': 'all covers'
|
||||
},
|
||||
'traits': ['action.devices.traits.Scene'],
|
||||
'type': 'action.devices.types.SCENE',
|
||||
'traits': ['action.devices.traits.OnOff'],
|
||||
'type': 'action.devices.types.SWITCH',
|
||||
'willReportState': False
|
||||
}, {
|
||||
'id':
|
||||
@ -199,8 +199,8 @@ DEMO_DEVICES = [{
|
||||
'name': {
|
||||
'name': 'all fans'
|
||||
},
|
||||
'traits': ['action.devices.traits.Scene'],
|
||||
'type': 'action.devices.types.SCENE',
|
||||
'traits': ['action.devices.traits.OnOff'],
|
||||
'type': 'action.devices.types.SWITCH',
|
||||
'willReportState': False
|
||||
}, {
|
||||
'id': 'climate.hvac',
|
||||
|
Loading…
x
Reference in New Issue
Block a user