"on_value_range" definition of "above" and "below"

This might be a stupid question, but what is the exact definition of “above” and “below” of “on_value_range”?

For example, let’s assume we have a pulse_counter:

  • platform: pulse_counter
    pin: GPIO17
    on_value_range:
    - below: 2
    then:

    - above: 2
    below: 10
    then:

    - above: 10
    then:

As you can see, i want to classify those values into three groups:

x < 2
2 <= x < 10
10 <= x

So, back to the initial question:

  • does below: 2 mean x <= 2 or x < 2?
  • What is triggered on value = 2

Edit: Shall i use below: 1.9 e.g. ?

Please use code blocks to format your pasted code, not the quote option.

But “below” means less than. Not less than or equal to.

x < 2

below: 2

2 <= x < 10

above: 1.99
below: 10

10 <= x

above: 9.99

Alternatively if you use lambdas you can use <, <=, >, and >= which may be more easily understood.

1 Like