Numeric comparison of string (like an entity state) #3393
Unanswered
TheFes
asked this question in
Template engine
Replies: 1 comment
-
|
yes please |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the enhancement
The problem I have with the current implementation of HA is that all states are strings, and that makes numeric comparison difficult. Imagine I want to get the names of all battery entities with a value between 10 and 50, I'd need to use a for loop with namespace, or use zip, like this:
Like suggested on GitHub it would be great if
is_numbercould be extended so it would have two additional parameters, one for a test, and one for a value to compare it with. In case the value which is tested isn't numeric (likeunavailableit could just returnfalse)Example usage
Current workarounds
Either using
ziplike shown above of using a for-loop and a namespaceAnything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions