Make numeric_state behaviour consistent in trigger vs condition

Parameter numeric_state behaves differently when used in automation as a trigger vs as a condition. It seems like an inconsistency that could be fixed.

When it is used in a condition numeric_state it allows to use input_number entities as a value, wheres it does not allow such use as a trigger numeric_state

For example one cannot do the following:

  - id: 1234
  alias: trigger_test
    duration: '{{ states("input_datetime.fan_on_duration") }}'
  - platform: numeric_state
    entity_id: sensor.humidity_measurement
    above: input_number.humidity_threshold
      minutes: 2
  - service: script.turn_fan_on
      duration: '{{ duration }}'

I understand that this can be done with templates, which I currently have done at the moment though I’m not too keen on using them when it can be avoided. First I thought it was a bug (albeit a documented one :slight_smile:) but the issue was closed and I was directed here to suggest this as a feature.

This is on the to-do list as far as I am aware. Helpers in numeric triggers didn’t quite make the month of WTH. Only datetime helpers in time triggers.

1 Like

I would like to see a “for:” option added to the numeric_state condition.

I have an automation that checks every 5 minutes if all conditions are met and when so the AC is turned on. One of the conditions is that the lux level in the bedroom needs to be above 10 lx. So when we open the curtains the lx level goes above 10 and then when checked the condition is true and the AC will turn on. Now sometimes it so happens that we open the curtain and at that same moment the automation fires in which the ac is turned on immediately. I would like it to only turn on when we are allready downstairs. So a for: ‘00:05:00’ option would only make the numeric state condition go true when the lx is above 10 for 5 minutes. I know this was allready added to the trigger side of the automation. But when testing it in the condition part I get an error. So I guess it’s not yet a feature there

Closing. This was implemented in 2021.7

@sygys that’s a different request. Search the Feature request category and if you dont find it already listed (pretty sure it is) open a new request.