Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger Alexa routines from toggles and buttons #67889

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

mdegat01
Copy link
Contributor

@mdegat01 mdegat01 commented Mar 9, 2022

Proposed change

Switches and input booleans are double listed as both Alexa.PowerController and Alexa.ContactSensor interfaces. This enables users to trigger routines from their state changes using the smart home option. Buttons and input buttons are also double listed as Alexa.SceneController and Alexa.EventDetectionSensor, the latter specifically with supportsNotDetected set to false. This enables users to make routines which trigger when the button is pressed.

This change really has no impact on existing use cases with Alexa. I specifically did not change the display categories so devices appear exactly as they did before and work in the same use cases they did before (alexa can press buttons and change switches/toggles from routines). They just now also appear as routine starter options under "smart home".

It's a bit unintuitive in this particular menu since you see this UI for buttons:

Button pretending its a presence detector

image

And this for switches and toggles:
Switch pretending its a contact sensor

image

But it is in line with what users were already doing to solve this use case, it just makes it easier (no YAML/template knowledge required). And we can guide them through it with a bit of documentation.

This will help users interested in HA but invested in Alexa able to transition more slowly by leveraging their existing routines. It also gives all users a way to leverage devices and services which can be integrated with Alexa but not with HA.

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @home-assistant/cloud, @ochlocracy, mind taking a look at this pull request as it has been labeled with an integration (alexa) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@mdegat01 mdegat01 changed the title Trigger Alexa routines from toggless and buttons Trigger Alexa routines from toggles and buttons Mar 9, 2022
@mdegat01 mdegat01 force-pushed the trigger-alexa-routines branch 2 times, most recently from 54d244c to 8107727 Compare March 11, 2022 06:00
@mdegat01 mdegat01 marked this pull request as ready for review March 11, 2022 06:00
@mdegat01 mdegat01 requested a review from ochlocracy as a code owner March 11, 2022 06:00
@mdegat01
Copy link
Contributor Author

Bonehead move on my part. I was not getting events because I forgot to put endpoint, client_id and client_secret into the config of my test system. Now that I set up proactive events correctly this works great. Pressing buttons and toggling switches triggers my routines.

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Mar 27, 2022
@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @mdegat01 👍

@frenck frenck force-pushed the trigger-alexa-routines branch from 8107727 to de655d9 Compare June 29, 2022 09:47
@frenck frenck merged commit 9392f59 into dev Jun 29, 2022
@frenck frenck deleted the trigger-alexa-routines branch June 29, 2022 11:56
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed core has-tests integration: alexa new-feature small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants