Add support for "alias" in script steps device, device_condition, and conditions#46647
Conversation
|
I think I already have a PR up that does this. On my phone right now but will try to find in a few minutes. EDIT: Ha, nevermind. I see your note now that this IS my PR, just updated with better tests :P Didn't see that when I skimmed on my phone. Carry on, and thanks! |
|
@donkawechico that's right, your PR was great, I'm just adding some tests. Do you have any suggestion for how to verify the condition aliases? They're currently not used for anything, unlike the action aliases which are used for logging. |
@emontnemery By "how to verify the condition aliases" do you mean "how to write unit tests for conditional schemas"? Or do you mean how to verify that this PR successfully adds support for aliases in conditionals. If you mean unit tests, I remember having some difficulty figuring out how to write a unit test against conditional schemas. I forget what the difficulty was though. If you mean verifying the change, then I think all you have to do is find a script/automation that uses a conditional step and try adding an |
homeassistant/helpers/script.py
Outdated
| msg, *args, level=level, **kwargs | ||
| ) | ||
|
|
||
| def _step_log(self, default_message, delay=None): |
There was a problem hiding this comment.
Shouldn't delay be called timeout, as it's how long we're going to wait for something ?
|
We should make sure the documentation for this is updated |
Proposed change
See: WTH can’t we annotate sequence steps for logging?.
The backend already has the
aliasfield to mostly achieve this WTH. Butaliasis not supported for all action steps.This PR:
aliasto the following action step type schemas:devicescenechoosechoicesaliasto all conditions -- "numeric_state", "state", "sun", etc..self._log("Executing step ...into a common methodThis is #40772 by @donkawechico, with updated tests.
Type of change
Example entry for
configuration.yaml: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.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: