Allow for: in condition or create a sensor to allow

Trying to make a template using greater than concept to allow a condition to wait for 5 minutes to allow to trigger and tried the below with no sucess so I tried a sensor but the sensor is not changing states to on when above 70

Originally tried this-

    - condition: numeric_state
      entity_id: sensor.bathroom_multi_sensor_luminance
      value_template: '{{ states("sensor.bathroom_multi_sensor_luminance") }}'
      above: '70.0'          
      for:
         minutes: 5

but that doesn’t seem to work so I was trying to make a sensor to recognize if the sensor.bathroom_multi_sensor_luminance was over 70 to turn to on and tried to do

Here is the on/off sensor:

  • platform: template
    sensors:
    bathroom_main_light:
    friendly_name: “Bathroom Main Light”
    value_template: >-
    {% if is_state(‘sensor.bathroom_multi_sensor_luminance.state’, ‘float > 70’) %}
    on
    {% else %}
    off
    {% endif %}
  {% if (states.sensor.bathroom_multi_sensor_luminance.state|float > 70) %}
on
{% else %}
off
{% endif %}  

might do the trick, it will evaluate to on or off, you can check out this in the dev-tools-> templates, just paste it in or goto ip:8123/dev-template and paste it in

I don’t understand why your first automation would need to be a template. To be honest I don’t really understand templates yet… wouldn’t the below work?

 - condition: numeric_state
      entity_id: sensor.bathroom_multi_sensor_luminance
      above: '70.0'          
      for:
         minutes: 5

I’m not sure that will work as you are not testing a state you are testing a number, but give it a try :slight_smile:

well this is a snip from the docs… same principle

automation:
  - alias: FanOn
    trigger:
      platform: numeric_state
      entity_id: sensor.furnace
      above: 2
    action:
      service: notify.mypushbullet

for: is only allowed on triggers for now, not in conditions.
Maybe you can turn on an input_boolean with another automation and check that on your first automation condition.

oh ok. thanks for the clarification

So far this looks to work. I will let you know tomorrow as the automation is if the shower/bathroom main light is on to trigger my Heater in bedroom to turn on 5 min after so by the time I’m out it is warm…On a side note I run my fan at night and conveniently my fan power off is the same toggle command as my heater power on so the goal is by the time Im in the shower the fan is off and the heater is on!

I would love to use for in conditions!