mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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(
|
(service, service_data) = determine_service(
|
||||||
eid, execution.get('command'), execution.get('params'),
|
eid, execution.get('command'), execution.get('params'),
|
||||||
hass.config.units)
|
hass.config.units)
|
||||||
|
if domain == "group":
|
||||||
|
domain = "homeassistant"
|
||||||
success = yield from hass.services.async_call(
|
success = yield from hass.services.async_call(
|
||||||
domain, service, service_data, blocking=True)
|
domain, service, service_data, blocking=True)
|
||||||
result = {"ids": [eid], "states": {}}
|
result = {"ids": [eid], "states": {}}
|
||||||
|
@ -39,7 +39,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
# Mapping is [actions schema, primary trait, optional features]
|
# Mapping is [actions schema, primary trait, optional features]
|
||||||
# optional is SUPPORT_* = (trait, command)
|
# optional is SUPPORT_* = (trait, command)
|
||||||
MAPPING_COMPONENT = {
|
MAPPING_COMPONENT = {
|
||||||
group.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
group.DOMAIN: [TYPE_SWITCH, TRAIT_ONOFF, None],
|
||||||
scene.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
scene.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
||||||
script.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
script.DOMAIN: [TYPE_SCENE, TRAIT_SCENE, None],
|
||||||
switch.DOMAIN: [TYPE_SWITCH, TRAIT_ONOFF, None],
|
switch.DOMAIN: [TYPE_SWITCH, TRAIT_ONOFF, None],
|
||||||
@ -94,10 +94,11 @@ def entity_to_device(entity: Entity, units: UnitSystem):
|
|||||||
|
|
||||||
# use aliases
|
# use aliases
|
||||||
aliases = entity.attributes.get(CONF_ALIASES)
|
aliases = entity.attributes.get(CONF_ALIASES)
|
||||||
if isinstance(aliases, list):
|
if aliases:
|
||||||
device['name']['nicknames'] = aliases
|
if isinstance(aliases, list):
|
||||||
else:
|
device['name']['nicknames'] = aliases
|
||||||
_LOGGER.warning("%s must be a list", CONF_ALIASES)
|
else:
|
||||||
|
_LOGGER.warning("%s must be a list", CONF_ALIASES)
|
||||||
|
|
||||||
# add trait if entity supports feature
|
# add trait if entity supports feature
|
||||||
if class_data[2]:
|
if class_data[2]:
|
||||||
|
@ -75,16 +75,16 @@ DEMO_DEVICES = [{
|
|||||||
'name': {
|
'name': {
|
||||||
'name': 'all lights'
|
'name': 'all lights'
|
||||||
},
|
},
|
||||||
'traits': ['action.devices.traits.Scene'],
|
'traits': ['action.devices.traits.OnOff'],
|
||||||
'type': 'action.devices.types.SCENE',
|
'type': 'action.devices.types.SWITCH',
|
||||||
'willReportState': False
|
'willReportState': False
|
||||||
}, {
|
}, {
|
||||||
'id': 'group.all_switches',
|
'id': 'group.all_switches',
|
||||||
'name': {
|
'name': {
|
||||||
'name': 'all switches'
|
'name': 'all switches'
|
||||||
},
|
},
|
||||||
'traits': ['action.devices.traits.Scene'],
|
'traits': ['action.devices.traits.OnOff'],
|
||||||
'type': 'action.devices.types.SCENE',
|
'type': 'action.devices.types.SWITCH',
|
||||||
'willReportState': False
|
'willReportState': False
|
||||||
}, {
|
}, {
|
||||||
'id':
|
'id':
|
||||||
@ -131,8 +131,8 @@ DEMO_DEVICES = [{
|
|||||||
'name': {
|
'name': {
|
||||||
'name': 'all covers'
|
'name': 'all covers'
|
||||||
},
|
},
|
||||||
'traits': ['action.devices.traits.Scene'],
|
'traits': ['action.devices.traits.OnOff'],
|
||||||
'type': 'action.devices.types.SCENE',
|
'type': 'action.devices.types.SWITCH',
|
||||||
'willReportState': False
|
'willReportState': False
|
||||||
}, {
|
}, {
|
||||||
'id':
|
'id':
|
||||||
@ -199,8 +199,8 @@ DEMO_DEVICES = [{
|
|||||||
'name': {
|
'name': {
|
||||||
'name': 'all fans'
|
'name': 'all fans'
|
||||||
},
|
},
|
||||||
'traits': ['action.devices.traits.Scene'],
|
'traits': ['action.devices.traits.OnOff'],
|
||||||
'type': 'action.devices.types.SCENE',
|
'type': 'action.devices.types.SWITCH',
|
||||||
'willReportState': False
|
'willReportState': False
|
||||||
}, {
|
}, {
|
||||||
'id': 'climate.hvac',
|
'id': 'climate.hvac',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user