mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Make groups entities again (#12574)
This commit is contained in:
parent
2a4971dec7
commit
de72eb8fe9
@ -391,6 +391,7 @@ class _AlexaTemperatureSensor(_AlexaInterface):
|
|||||||
|
|
||||||
@ENTITY_ADAPTERS.register(alert.DOMAIN)
|
@ENTITY_ADAPTERS.register(alert.DOMAIN)
|
||||||
@ENTITY_ADAPTERS.register(automation.DOMAIN)
|
@ENTITY_ADAPTERS.register(automation.DOMAIN)
|
||||||
|
@ENTITY_ADAPTERS.register(group.DOMAIN)
|
||||||
@ENTITY_ADAPTERS.register(input_boolean.DOMAIN)
|
@ENTITY_ADAPTERS.register(input_boolean.DOMAIN)
|
||||||
class _GenericCapabilities(_AlexaEntity):
|
class _GenericCapabilities(_AlexaEntity):
|
||||||
"""A generic, on/off device.
|
"""A generic, on/off device.
|
||||||
@ -521,16 +522,6 @@ class _ScriptCapabilities(_AlexaEntity):
|
|||||||
supports_deactivation=can_cancel)]
|
supports_deactivation=can_cancel)]
|
||||||
|
|
||||||
|
|
||||||
@ENTITY_ADAPTERS.register(group.DOMAIN)
|
|
||||||
class _GroupCapabilities(_AlexaEntity):
|
|
||||||
def default_display_categories(self):
|
|
||||||
return [_DisplayCategory.SCENE_TRIGGER]
|
|
||||||
|
|
||||||
def interfaces(self):
|
|
||||||
return [_AlexaSceneController(self.entity,
|
|
||||||
supports_deactivation=True)]
|
|
||||||
|
|
||||||
|
|
||||||
@ENTITY_ADAPTERS.register(sensor.DOMAIN)
|
@ENTITY_ADAPTERS.register(sensor.DOMAIN)
|
||||||
class _SensorCapabilities(_AlexaEntity):
|
class _SensorCapabilities(_AlexaEntity):
|
||||||
def default_display_categories(self):
|
def default_display_categories(self):
|
||||||
@ -773,6 +764,8 @@ def extract_entity(funct):
|
|||||||
def async_api_turn_on(hass, config, request, entity):
|
def async_api_turn_on(hass, config, request, entity):
|
||||||
"""Process a turn on request."""
|
"""Process a turn on request."""
|
||||||
domain = entity.domain
|
domain = entity.domain
|
||||||
|
if entity.domain == group.DOMAIN:
|
||||||
|
domain = ha.DOMAIN
|
||||||
|
|
||||||
service = SERVICE_TURN_ON
|
service = SERVICE_TURN_ON
|
||||||
if entity.domain == cover.DOMAIN:
|
if entity.domain == cover.DOMAIN:
|
||||||
@ -928,9 +921,6 @@ def async_api_increase_color_temp(hass, config, request, entity):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_api_activate(hass, config, request, entity):
|
def async_api_activate(hass, config, request, entity):
|
||||||
"""Process an activate request."""
|
"""Process an activate request."""
|
||||||
if entity.domain == group.DOMAIN:
|
|
||||||
domain = ha.DOMAIN
|
|
||||||
else:
|
|
||||||
domain = entity.domain
|
domain = entity.domain
|
||||||
|
|
||||||
yield from hass.services.async_call(domain, SERVICE_TURN_ON, {
|
yield from hass.services.async_call(domain, SERVICE_TURN_ON, {
|
||||||
@ -955,9 +945,6 @@ def async_api_activate(hass, config, request, entity):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_api_deactivate(hass, config, request, entity):
|
def async_api_deactivate(hass, config, request, entity):
|
||||||
"""Process a deactivate request."""
|
"""Process a deactivate request."""
|
||||||
if entity.domain == group.DOMAIN:
|
|
||||||
domain = ha.DOMAIN
|
|
||||||
else:
|
|
||||||
domain = entity.domain
|
domain = entity.domain
|
||||||
|
|
||||||
yield from hass.services.async_call(domain, SERVICE_TURN_OFF, {
|
yield from hass.services.async_call(domain, SERVICE_TURN_OFF, {
|
||||||
|
@ -569,15 +569,11 @@ def test_group(hass):
|
|||||||
appliance = yield from discovery_test(device, hass)
|
appliance = yield from discovery_test(device, hass)
|
||||||
|
|
||||||
assert appliance['endpointId'] == 'group#test'
|
assert appliance['endpointId'] == 'group#test'
|
||||||
assert appliance['displayCategories'][0] == "SCENE_TRIGGER"
|
assert appliance['displayCategories'][0] == "OTHER"
|
||||||
assert appliance['friendlyName'] == "Test group"
|
assert appliance['friendlyName'] == "Test group"
|
||||||
|
assert_endpoint_capabilities(appliance, 'Alexa.PowerController')
|
||||||
|
|
||||||
(capability,) = assert_endpoint_capabilities(
|
yield from assert_power_controller_works(
|
||||||
appliance,
|
|
||||||
'Alexa.SceneController')
|
|
||||||
assert capability['supportsDeactivation']
|
|
||||||
|
|
||||||
yield from assert_scene_controller_works(
|
|
||||||
'group#test',
|
'group#test',
|
||||||
'homeassistant.turn_on',
|
'homeassistant.turn_on',
|
||||||
'homeassistant.turn_off',
|
'homeassistant.turn_off',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user