mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Only support remote activity on Alexa if feature is set and at least one feature is in the activity_list (#124567)
Only support remote activity on Alexa if feaure is set and at least one feature is in the activity_list
This commit is contained in:
parent
51b520db0c
commit
5550b1a74e
@ -661,6 +661,9 @@ class RemoteCapabilities(AlexaEntity):
|
|||||||
def interfaces(self) -> Generator[AlexaCapability]:
|
def interfaces(self) -> Generator[AlexaCapability]:
|
||||||
"""Yield the supported interfaces."""
|
"""Yield the supported interfaces."""
|
||||||
yield AlexaPowerController(self.entity)
|
yield AlexaPowerController(self.entity)
|
||||||
|
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
||||||
|
activities = self.entity.attributes.get(remote.ATTR_ACTIVITY_LIST) or []
|
||||||
|
if activities and supported & remote.RemoteEntityFeature.ACTIVITY:
|
||||||
yield AlexaModeController(
|
yield AlexaModeController(
|
||||||
self.entity, instance=f"{remote.DOMAIN}.{remote.ATTR_ACTIVITY}"
|
self.entity, instance=f"{remote.DOMAIN}.{remote.ATTR_ACTIVITY}"
|
||||||
)
|
)
|
||||||
|
@ -70,6 +70,7 @@ async def test_discovery_remote(
|
|||||||
{
|
{
|
||||||
"current_activity": current_activity,
|
"current_activity": current_activity,
|
||||||
"activity_list": activity_list,
|
"activity_list": activity_list,
|
||||||
|
"supported_features": 4,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
msg = await smart_home.async_handle_message(hass, get_default_config(hass), request)
|
msg = await smart_home.async_handle_message(hass, get_default_config(hass), request)
|
||||||
@ -790,22 +791,37 @@ async def test_report_remote_activity(hass: HomeAssistant) -> None:
|
|||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"remote.unknown",
|
"remote.unknown",
|
||||||
"on",
|
"on",
|
||||||
{"current_activity": "UNKNOWN"},
|
{
|
||||||
|
"current_activity": "UNKNOWN",
|
||||||
|
"supported_features": 4,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"remote.tv",
|
"remote.tv",
|
||||||
"on",
|
"on",
|
||||||
{"current_activity": "TV", "activity_list": ["TV", "MUSIC", "DVD"]},
|
{
|
||||||
|
"current_activity": "TV",
|
||||||
|
"activity_list": ["TV", "MUSIC", "DVD"],
|
||||||
|
"supported_features": 4,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"remote.music",
|
"remote.music",
|
||||||
"on",
|
"on",
|
||||||
{"current_activity": "MUSIC", "activity_list": ["TV", "MUSIC", "DVD"]},
|
{
|
||||||
|
"current_activity": "MUSIC",
|
||||||
|
"activity_list": ["TV", "MUSIC", "DVD"],
|
||||||
|
"supported_features": 4,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"remote.dvd",
|
"remote.dvd",
|
||||||
"on",
|
"on",
|
||||||
{"current_activity": "DVD", "activity_list": ["TV", "MUSIC", "DVD"]},
|
{
|
||||||
|
"current_activity": "DVD",
|
||||||
|
"activity_list": ["TV", "MUSIC", "DVD"],
|
||||||
|
"supported_features": 4,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
properties = await reported_properties(hass, "remote#unknown")
|
properties = await reported_properties(hass, "remote#unknown")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user