Temperature Trigger Need Help

HI I am trying to turn off my a outlet based heater when the temperature in the room hits 75 Degrees Fahrenheit my tempature sensors a ecobee remote sensor

My automation is as follows but my fan is not turning off:

- id: '1607530898332'
  alias: Office Heater
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.hampton_basement_temperature
    above: '75'
  condition: []
  action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.hampton4
  mode: single

Any help would be apricated.

in order for that automation to fire, sensor.hampton_basement_temperature needs to move from below 75 to above 75. If the sensor is already above 75, the automation will not trigger until the sensor moves below 75 then above 75.

what would happen if the room was at 72 when I turn on the heater would it fire and turn off when it hits 75, is there a better way to do this…

it would fire when the temperature is above 75. If you want to get greater than or equal to 75 you need to use a template trigger

  - platform: template
    value_template: "{{ states('sensor.hampton_basement_temperature') | float >= 75 }}"

Can you refresh my memory about Template Triggers? If your example triggers at 75 and then the temperature continues to rise to 76 will that serve to trigger it again or will it be locked out (like Numeric State Trigger) because it was already ‘set’ by the first trigger event (and now needs to be ‘reset’ before it can be triggered again).

My first impression is that it will trigger again on 76 but I seem to recall an explanation (possibly either by you or pnbruckner) that it needs to ‘reset’ before it can be triggered again. I may be misremembering it …

Yeah, it needs to reset as the template needs to go from false to true to trigger the automation. If it goes from 75 to 76 the template is still resolved as true, so there is no change.

1 Like

Template triggers only trigger when the trigger template resolves from False to True. So it will only trigger when it crosses 75 from 74 essentially.

1 Like

Thanks, clear now.

in that case, if a Template Trigger behaves like a Numeric State Trigger, in terms of ‘latching’ after it meets its criteria, why is it offered as a replacement for the OP’s existing Numeric State Trigger?


After giving it some thought, perhaps because there’s a subtle difference between the two regarding what triggers them. Please correct me if I’m wrong but in order to trigger:

  • Numeric State Trigger requires the ‘from_state’ to be less than the threshold and the to_state to be greater than. It relies on the concept of crossing the threshold.
  • Template Trigger doesn’t care about from_state just to_state. As long as to_state is greater than the threshold it evaluates to true and triggers. However, after the Template Trigger changes from false to true, it effectively latches and remains true until a value comes along to make it false. That’s what unlatches it (resets it) and allows it to be triggered again.

Or something along those lines … :slight_smile:

1 Like

Because above: 75 does not provide greater than or equal to 75.

Above 74 does :wink:

not if his sensor resolution is 0.1 :wink:

Above 74.9 does :stuck_out_tongue_winking_eye: