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

Possible extension to hide_unavailable? #218

Closed
krisnoble opened this issue Dec 19, 2021 · 3 comments
Closed

Possible extension to hide_unavailable? #218

krisnoble opened this issue Dec 19, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@krisnoble
Copy link

Hi, I've been thinking it would be useful to have some more options along the lines of hide_unavailable and think I've come up with a flexible solution although I've no experience in this kind of thing so just hoping it triggers some ideas.

Initially I was just going to propose hide_off: true/false to hide binary sensors where the state is equivalent to off. Then I got thinking it would be cool to be able to set thresholds for any sensor, and then I realised that "unavailable" is also a state so you could have a structure like this:

hide_if:
  attribute: < optional attribute name, default to the main state >
  value: < exact state/attribute value e.g. "off", "0", "on", "unavailable" > 
  above: < upper threshold for state/attr >
  below: < lower threshold for state/attr >

I guess you could combine any given value/above/below combination as ORs although not sure how actually useful that would be.

It does lengthen the current hide_unavailable implementation somewhat but I think that seems a fair price for the added functionality, and maybe hide_unavailable could be kept in for a while to ease the transition.

@krisnoble
Copy link
Author

Some more overnight thoughts - might be useful to accept a list of values in the value field, so you could say "hide this if it's unavailable or turned off", and you could also combine with above/below to say something like "hide this if it's unavailable, turned off or the value is below 10" for example. Hope that makes sense!

@benct benct added the enhancement New feature or request label Dec 22, 2021
@benct
Copy link
Owner

benct commented Dec 23, 2021

Just added a hide_if option in the latest release, working basically as you have requested. Let me know if something does not work as expected.

Thanks for the suggestion :)

@benct benct closed this as completed Dec 23, 2021
@krisnoble
Copy link
Author

Awesome, thank you! Working perfectly in my simple use case :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants