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
Alexa Intent: Use the 'id' field and expose nearest resolutions as variables #86709
Alexa Intent: Use the 'id' field and expose nearest resolutions as variables #86709
Conversation
Hi AzonInc It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
Hey there @home-assistant/cloud, @ochlocracy, @jbouwh, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Please help me to understand why how this ID field would help. This is a part that I am not yet quite familiar with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the errors, and tests. The PR code breaks the alexa integration code.
354e45c
to
6d1c77e
Compare
Sorry for that, I'm quite new and I'm not sure where these errors come from. I rebased to get up with the latest commits - dunno if it's fixed now due to some work in progress in dev branch before. |
The ID field would help whenever we want to pass some custom IDs (for example train Station Location IDs) to Homeassistant Automations (or Node-RED Addon Flows). It was initially removed because people thought there is no use because they can generate their entity ids by the name. However there are people out there, that dont want to use the Slot Value ID as entity ID, but as a real ID for TV Apps or Train Station IDs. I hope I could explain it. |
From what I see in the local tests they need to be fixed:
The changed code seems not to be called during normal operation. So I do not really get when this code is used. Could you tell me step by step how to set up a test environment to be able to test/debug your code in real live. |
I finally figured how to properly run the Tests and Test Enviroment. All Tests are passing now. I added two more Tests to cover all scenarios of the new variables. |
bad3871
to
6236fb5
Compare
I updated the branch to reflect the most recent changes to the tests file. |
Can you answer my questions on how this is supposed to be used and especially how I can test your code, and decide if this would fit or not. This might save you a lot of time, |
Scenareo: Problem:
Solution: Homeassistant Intent:
Entities: Now you can ask Alexa for the next Tram to some Station. The Intent is setting the input value to the nerest resolution tram station id and press the button in nodered to start the flow. |
bcba0f8
to
78b1918
Compare
Actually it could be way easier with only that one new Slot ID variable and a behaviour change which would lead to a breaking change tho. I don't know why it is useful to prevent using the Slot resolutions when there is more than one possible resolution. Let's say we have an Intent Configuration like this: Behavior of the current implementation:
If I say "Alexa, show me a route to (West Street | West Station | Apple Street | Junior Street)", it will never use any of the resolutions bacause amazon is resolving them all as there are two values ending with street and two starting with west. Suggestion: New implementation
As far as I have seen and tested, the first resolution has always been the correct one. Let me know what you think about it. |
I have invest some time to understand what you are suggestion and what would break. If we break anything it would be nice if we could have some backwards compatibility and a deprecation warning (repair). Don't know if that is possible though. |
btw: i see that the merging of dev pushed a lot of non related commits. to solve this you can do:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left one suggestion.
We could add a deprecation warning now for a future release and introduce the changes in the future release. |
78b1918
to
7a19e55
Compare
7a19e55
to
bcadf99
Compare
Now its only the most necessary changes |
Looks good. Now we need to get the CI tests to work first. Needs to wait: https://www.githubstatus.com/ |
Expose nearest Resolution (ID and Value) as Variables
67ff50a
to
a1f058f
Compare
The previous CI run failed on one Job without any details and some others were skipped. Most probably due to the degraded performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍,
Thnx @AzonInc !
Cool :) Thanks a lot for your support and patience with me. What would be the process for the other suggested logic change PR? |
It's up to you. |
Proposed change
Expose nearest Resolution (ID and Value) as Variables
Using the id value can be valuable if you don't want to use the id for entities but to process it in scripts for example. The ID Value is exposed as SlotName_ID variable.
In addition to the single value it could be useful to have the nearest resolution always available.
For example:
In that case I wouldn't get the correct resolution, as it's more than one. So it defaults to the spoken value.
However the first resolution is always the one that fits best.
For that reason I exposed two more variables named "SlotName_NEAREST" and "SlotName_NEAREST_ID".
That way people can use it when they need it and can't rely on the default spoken value.
Type of change
Additional information
Checklist
black --fast 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
..coveragerc
.To help with the load of incoming pull requests: