Would it be possible to add the option to use a template value as ‘above’ and ‘below’ in numeric value trigger if for whatever reason an absolute value isn’t suitable please?
I.e something like this:
automation:
trigger:
- platform: numeric_state
entity_id: sensor.temperature
# At least one of the following required
above: "{{ states('input_number.low_threshold') }}"
below: "{{ states('input_number.high_threshold') }}"
for:
hours: 1
minutes: 10
seconds: 5
Number helpers (input_number entities), number and sensor entities that contain a numeric value, can be used in the above and below thresholds, making the trigger more dynamic
That’s… …embarrasing. Thanks @123 for pointing out what should have been obvious to me, especially since I spent quite some time reading that very documentation page.
Just trying this personally, and looks like you have to create the numeric state trigger and then edit in YAML in order to use an input_number as an above/below value?
Wanted to ensure I’m not missing anything and possibly create a WTH to allow UI selection of these going forward.
I agree with @123’s comment… doing this in a Numeric State trigger is actually more complicated than just doing it in a Template trigger, so that is what I would suggest.
If, for some reason, you just want to use a Numeric State trigger, you need to move the components of the comparison around following the normal mathematical rules, with the goal of getting one side of the comparison to be a numeric value.
Is the state of Sensor A greater than (above) Sensor B plus an offset X:
A > (B + X)
A - (B + X) > 0
The numeric value (in this case 0) is used as the value for above and the left side of the comparison is converted into the value_template: