Add support for new select selector properties#68952
Add support for new select selector properties#68952emontnemery merged 4 commits intohome-assistant:devfrom
Conversation
| vol.Required("options"): vol.All( | ||
| vol.Any([str], [select_option]), vol.Length(min=1) | ||
| ) | ||
| vol.Required("options"): vol.All(vol.Any([str], [select_option])), |
There was a problem hiding this comment.
maybe I missed this but shouldn't we make this Optional by default, add the length of at least one back (so no need for an empty list, either you provide a list or you don't), and then add a custom validator that makes this required if custom_value is False? This makes it so you can create an options selector with an empty list regardless of whether custom values are supported or not (and it requires you to create at least an empty list always)
There was a problem hiding this comment.
I see this is similar to the question Frenck asked here: #68952 (comment)
|
should we allow for an empty list to be returned? That wasn't an explicitly intentional design choice by me, it was just a scenario I hadn't thought of |
It looks like the UI won't let you provide an empty string as a value, but it will let you provide an empty list by selecting and removing an option. This probably needs to be improved in the frontend if we want to block this behavior CC @zsarnett |
* Add support for new select selector properties * fix mode option * Apply suggestions from code review * Correct validation for empty options, update tests Co-authored-by: Erik Montnemery <erik@montnemery.com>
Proposed change
Implemented the following new config options for the
selectselector from home-assistant/frontend#12099 :multiple: Allows the user to select multiple items from the listmode:listforces a radio button list,dropdownforces a dropdown, nothing lets the frontend decidecustom_value: Allows users to enter custom values into the selectorType 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.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: