Create helper to OR values from one sensor

I have a need to OR the value of a sensor for use in a Trigger.

From what I can tell, a Trigger will “AND” all the entries (a Condition can be setup to “OR” using “Building Blocks”). I need to test when a sensor values whether it is ( ( 1 < val < 10 ) OR ( 20 < val < 30 ) ) etc.

I can’t figure out how to do that with an automation or a Helper.

triggers are “or”.

if any of the trigger (not all) happen, the automation will trigger.

so you could create 2 triggers and that would work.

you could also put it together in 1 template trigger if you want:

{{ (1 < (states('sensor.whatever') | int ) < 10) or 
  (20 < (states('sensor.whatever') | int ) < 30) }}
1 Like

As mentioned, triggers are OR logic.

trigger:
  - platform: numeric_state
    entity_id: sensor.foobar
    above: 1
    below: 10
  - platform: numeric_state
    entity_id: sensor.foobar
    above: 20
    below: 30