Skip to content

Commit edb79b0

Browse files
authored
Change sounds list source for Alexa Devices (#151317)
1 parent 41f33a1 commit edb79b0

File tree

8 files changed

+93
-965
lines changed

8 files changed

+93
-965
lines changed

homeassistant/components/alexa_devices/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "cloud_polling",
99
"loggers": ["aioamazondevices"],
1010
"quality_scale": "silver",
11-
"requirements": ["aioamazondevices==5.0.1"]
11+
"requirements": ["aioamazondevices==6.0.0"]
1212
}

homeassistant/components/alexa_devices/services.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414

1515
ATTR_TEXT_COMMAND = "text_command"
1616
ATTR_SOUND = "sound"
17-
ATTR_SOUND_VARIANT = "sound_variant"
1817
SERVICE_TEXT_COMMAND = "send_text_command"
1918
SERVICE_SOUND_NOTIFICATION = "send_sound"
2019

2120
SCHEMA_SOUND_SERVICE = vol.Schema(
2221
{
2322
vol.Required(ATTR_SOUND): cv.string,
24-
vol.Required(ATTR_SOUND_VARIANT): cv.positive_int,
2523
vol.Required(ATTR_DEVICE_ID): cv.string,
2624
},
2725
)
@@ -75,17 +73,14 @@ async def _async_execute_action(call: ServiceCall, attribute: str) -> None:
7573
coordinator = config_entry.runtime_data
7674

7775
if attribute == ATTR_SOUND:
78-
variant: int = call.data[ATTR_SOUND_VARIANT]
79-
pad = "_" if variant > 10 else "_0"
80-
file = f"{value}{pad}{variant!s}"
81-
if value not in SOUNDS_LIST or variant > SOUNDS_LIST[value]:
76+
if value not in SOUNDS_LIST:
8277
raise ServiceValidationError(
8378
translation_domain=DOMAIN,
8479
translation_key="invalid_sound_value",
85-
translation_placeholders={"sound": value, "variant": str(variant)},
80+
translation_placeholders={"sound": value},
8681
)
8782
await coordinator.api.call_alexa_sound(
88-
coordinator.data[device.serial_number], file
83+
coordinator.data[device.serial_number], value
8984
)
9085
elif attribute == ATTR_TEXT_COMMAND:
9186
await coordinator.api.call_alexa_text_command(

0 commit comments

Comments
 (0)