WTH there's no `equals` option for numeric state condition?

Why do I need to use templates like {{ is_state_attr("climate.living_room", "temperature", 21)}} or {{ is_state_attr("cover.living_room", "current_position", 60)}} instead of being able to use the visual editor with an equals condition? The visual editor for numeric state conditions only provides above and below options. The same applies to the device condition. I’d like to have an option to check the exact value directly from the UI, without needing to write templates.

It already exists with the available Above and Below condition option as you mentioned. This has been brought up in previous WTH. Worth a search!

It is totally unclear if below and above are inclusive or not. It is a pain to have to specify above 14.99999 if you want above or equal to 15, or if you should use 14 for integers.

Also, the words above and below sit in the field where the value is entered. The section lower limit is for above, the section upper limit is for below. Totally confusing. Just use arithmetic symbols for mathematical things. Natural language isn’t helping anyone here.

The threshold sensor UI is just as confusing.

triggers:
  - trigger: state
    entity_id: climate.living_room
    attribute: temperature
    to: 21

EDIT:

conditions:
  - condition: state
    entity_id: climate.living_room
    attribute: temperature
    state: 21

Well, this is still yaml, not the visual editor. Visual editor is not supported for that configuration.

I’d argue the opposite, it was a good YAML solution. Your example is VERY specific! If you read the history on this topic, you’ll see you have to consider all variation and changes for each and every intergration sensor values.

State condition is the solution as mentioned several times.

EDIT

Two previous threads :down_arrow:

The visual editor does have state conditions and triggers. You are incorrectly using the numeric state versions. For equals you just use state conditions or triggers. As shown in Hellis’s post.

If I recall correctly from a different thread (credit to TheFes), the visual editor for state triggers/conditions assumes that the value to compare against is always a string – even when matching against an attribute, which can be other variable types. So using the examples above, the visual editor would construct the following YAML, which would never trigger/pass as the comparison would be a string against a number.

triggers:
  - trigger: state
    entity_id: climate.living_room
    attribute: temperature
    to: "21"

conditions:
  - condition: state
    entity_id: climate.living_room
    attribute: temperature
    state: "21"

Ah. I missed it was an attribute. Apologies. Ignore what I said.

This was created in GUI and switched to yaml mode just to copy the code here.
I don’t like posting images of what is actually yaml.
State conditions has existed since forever.

This is a rounding issue IMO but as @Mayhem_SWE stated it’s numeric_state for your climate example!

I wouldn’t say my case is particularly specific. The scenario is as follows: I have two automations:

  • the first one sets the blinds to 60% closed when the TV is turned on (but only under certain conditions, such as the sun’s azimuth, etc.),
  • the second one turns on the light when motion is detected, but I don’t want the light to turn on if the blinds are set to 60%. Checking whether the TV is on is not enough, because that does not always mean the blinds are at 60%, and so on.

I simply want to check whether the blinds are set to exactly 60%. That’s all.

I agree that a state condition can be used here, but the visual editor only supports a string as the value, while I am checking a numeric value. And although it works when I provide 60 as an int, firstly, this is not supported by the visual editor, and secondly, it is not intuitive. The intuitive expectation is that if I want to check a condition against a numeric value, I should use a numeric state condition.

Moreover, since this is a recurring topic and many people keep raising it, I think that shows I’m not an isolated case at all.

You may see it more clearly if you create a input number and test how it currently works. That highlights the complexity of the different Device Classes, Step Sizes and UoMs. Now add in how different intergrations report that state to HA. One will report 21 and another will report 21.0.

With greater platflorm compatibility, you’ll have roadblocks. You are asking for a common denominator that is ever changing.

Above and below 60 does the same at that step size! Are your blinds really showing 60.1 or 59.9?

So are you saying that we are able to determine that 21.5 is greater than 21, but we are not able to determine that 21 is the same as 21.0? Sorry, but I don’t understand that line of argument.

In any case, this discussion should not be about whether it is difficult or easy to implement. My point is - and I stand by it - that when checking a condition involving a numeric value, the intuitive choice is to use a numeric state condition, which in turn, in my humble opinion, should support an equals condition. I don’t want to compare apples to oranges. I want to compare two numeric values and know whether my blinds are set to 60% open - without YAML, without templates, directly from the visual editor.

Well, you’re talking about workarounds, while I’m talking about the native solution. Do you really consider setting above: 60 and below: 60 intuitive? above is not the same as above or equal to. From this point of view setting above: 60 and below: 60 at the same time should not work.

If you are above 59 and below 61 in your example, what is the number?

Let me guess! equals 60?

This allows you to control the trigger range and set the threshold while also covering step sizes. Equal triggers fails a lot from my experience!

For a constant like time EQUAL works!

I’ll also add, how would you address a battery sensor that reports periodically and jumps across the equal state you set? The automation fails to trigger!

Yes, I know. And it was working before as well (with the template I provided as an example). That’s not the point.

You are trying hard to prove that setting a range is better, and that it covers more scenarios (step sizes etc.). That’s fine, but again - I don’t need this. And I don’t want to be forced to do it. I set the temperature of the climate device to 19.5 and ALL I need is to check whether it is 19.5 or not. Simple as that. I don’t care about step sizes. And I also don’t want to set above: 19.4 and below: 19.6. What I want instead is to verify whether it equals: 19.5 or not.

And if I’m being honest, I think it takes quite a bit of intellectual gymnastics to argue that setting a range - that is, providing two different values - is easier, simpler, and more intuitive than setting exactly one.