Add routine management to Alexa Devices#166291
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support to the alexa_devices integration for managing and running Alexa routines via new Home Assistant services.
Changes:
- Introduces new services for running a routine and refreshing the routine list.
- Wires service handlers into
alexa_devicesservice execution logic. - Adds corresponding service translations and icons.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/alexa_devices/strings.json | Adds translated names/descriptions for the new routine-related services and fields. |
| homeassistant/components/alexa_devices/services.yaml | Declares the new services and their selectors/fields. |
| homeassistant/components/alexa_devices/services.py | Implements service schemas, handlers, and API calls for routine execution and updates. |
| homeassistant/components/alexa_devices/icons.json | Adds icons for the new services in the UI. |
| homeassistant/components/alexa_devices/init.py | Triggers a routines refresh during config entry setup. |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
f06a4f4 to
f743def
Compare
| identifiers={(DOMAIN, service_device_id(coordinator))}, | ||
| manufacturer="Amazon", | ||
| name=coordinator.config_entry.title, | ||
| entry_type=DeviceEntryType.SERVICE, | ||
| ) | ||
| self.entity_description = description | ||
| self._attr_unique_id = ( | ||
| f"{slugify(coordinator.config_entry.title)}-{description.key}" | ||
| ) | ||
|
|
||
|
|
||
| def service_device_id(coordinator: AmazonDevicesCoordinator) -> str: | ||
| """Return service device id.""" | ||
| return slugify(f"{coordinator.config_entry.title}_service_device") |
There was a problem hiding this comment.
The config entry title can change, so whenever I change the title and reload the integration there are new entities and devices. Why don't we pick the entry unique id? We seem to have one that is for the user which would work
There was a problem hiding this comment.
Done, I used the unique_id configuration entry, which corresponds to the Amazon customer ID: https://github.com/home-assistant/core/blob/dev/homeassistant/components/alexa_devices/config_flow.py#L72
I've aligned the tests to use the correct value.
Let me know if you'd prefer this change be included in a separate PR.
There was a problem hiding this comment.
this doesn't reflect a real life unique id btw
Proposed change
New feature to run Alexa routines from Home Assistant
Needs #166346Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: