Skip to content

Add routine management to Alexa Devices#166291

Merged
joostlek merged 6 commits into
home-assistant:devfrom
chemelli74:chemelli74-alexa-routines
Apr 29, 2026
Merged

Add routine management to Alexa Devices#166291
joostlek merged 6 commits into
home-assistant:devfrom
chemelli74:chemelli74-alexa-routines

Conversation

@chemelli74
Copy link
Copy Markdown
Contributor

@chemelli74 chemelli74 commented Mar 23, 2026

Proposed change

New feature to run Alexa routines from Home Assistant

Needs #166346

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@chemelli74 chemelli74 added this to the 2026.4.0b0 milestone Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 20:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_devices service 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.

Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/__init__.py Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 16:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/__init__.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 24, 2026 17:51
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/alexa_devices/__init__.py Outdated
Comment thread homeassistant/components/alexa_devices/services.py
Comment thread homeassistant/components/alexa_devices/services.py Outdated
Comment thread homeassistant/components/alexa_devices/strings.json Outdated
@chemelli74 chemelli74 force-pushed the chemelli74-alexa-routines branch from f06a4f4 to f743def Compare April 13, 2026 17:47
@chemelli74 chemelli74 marked this pull request as ready for review April 13, 2026 18:43
Comment thread homeassistant/components/alexa_devices/button.py Outdated
Comment thread homeassistant/components/alexa_devices/entity.py Outdated
Comment thread tests/components/alexa_devices/test_button.py
@home-assistant home-assistant Bot marked this pull request as draft April 14, 2026 15:50
@chemelli74 chemelli74 marked this pull request as ready for review April 14, 2026 19:11
@home-assistant home-assistant Bot requested a review from joostlek April 14, 2026 19:11
Comment thread homeassistant/components/alexa_devices/entity.py Outdated
Comment on lines +70 to +83
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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't reflect a real life unique id btw

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, fixed !

@home-assistant home-assistant Bot marked this pull request as draft April 17, 2026 21:46
@chemelli74 chemelli74 marked this pull request as ready for review April 18, 2026 22:11
@home-assistant home-assistant Bot requested a review from joostlek April 18, 2026 22:11
@chemelli74 chemelli74 added this to the 2026.5.0b0 milestone Apr 21, 2026
@joostlek joostlek merged commit f4637db into home-assistant:dev Apr 29, 2026
33 checks passed
@chemelli74 chemelli74 deleted the chemelli74-alexa-routines branch April 29, 2026 09:45
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alexa Devices - Send text command does not work for Alexa Routines

4 participants