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

HASelect.setState() should allow setting -1 #146

Closed
rrozema opened this issue Mar 5, 2023 · 2 comments
Closed

HASelect.setState() should allow setting -1 #146

rrozema opened this issue Mar 5, 2023 · 2 comments
Labels
selected for development Feature will be implemented in the next version

Comments

@rrozema
Copy link

rrozema commented Mar 5, 2023

It would be very helpful to me if HASelect would allow to set the state back to -1 after it has been some valid state. In HA this should result in an update to the same 'unknown' value that is shown initially when no state has been assigned yet.

My scenario is a fake "traffic light", where the 3 lights can be controlled by individual switches per light but the lights can also be controlled via a "traffic light" select. If the individual switches are in a valid "traffic light"-combination (exactly 1 light is on), the "traffic light" select should show this combination's name. When however an invalid combination is chosen (0, 2 or 3 lights are on at the same time) using the switches, the select should be updated to the -1 - 'unknown' value. I do however not want the select to show this "unknown" option to the user to choose from.

My idea is to add some setDefaultOption() method that allows the developer to specify the text for this -1 value.

@rrozema
Copy link
Author

rrozema commented Mar 14, 2023

I've been testing this and I don't know if it's even possible to set a value that is not in the list of options (i.e. this is what would be needed to set -1). So far I haven't been able to do it myself, so I won't blame you if you reject this ;-) , but if you could have a look to see if you can think of a way to (re-)set the select's state -1 and have HA show 'unavailable' (or something like that) I would certainly appreciate it!

@dawidchyrzynski dawidchyrzynski added the selected for development Feature will be implemented in the next version label Jul 1, 2023
@dawidchyrzynski
Copy link
Owner

This feature will be available in the upcoming version of the library. Please refer to the linked Pull Request for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
selected for development Feature will be implemented in the next version
Projects
None yet
Development

No branches or pull requests

2 participants