Temperature-based automation

I am trying to activate a switch from the temperature of a sensor, I need the sensor to activate whenever a certain temperature reaches the target + 1 (I’m using input text to test).

# temperatura 1
- id: temp_1
  alias: temp_1
  trigger:
    - platform: numeric_state
      entity_id: input_text.teste
      above: '{{ input_text.temp_1 + 1 }}'
  action:
    - service: notify.mobile_app_iphone
      data:
        message: temp

I may be off base, but shouldn’t it be looking for states('input_text.temp_1') rather than input_text.temp_1? And, mathematically, isn’t above actually evaluating the state +1 + ? Wouldn’t it be just above the state rather than the state + 1 since above implies it’s greater than the current state?

You can only use a number in the value for the above: key in a numeric state trigger. If you want to do math with entities use a template trigger:

  trigger:
    - platform: template
      value_template: "{{ states('input_text.teste')|float > states('input_text.temp_1')|float + 1 }}"

Triggers have not yet been updated the way conditions have to use input ‘helpers’. e.g. this is valid:

condition:
  condition: numeric_state
  entity_id: climate.living_room_thermostat
  above: input_number.temperature_threshold_low

This is not (yet):

trigger:
  platform: numeric_state
  entity_id: climate.living_room_thermostat
  above: input_number.temperature_threshold_low

However, as you wanted to add an offset you would still have to use a template even if that had been implemented.

thank you very much, it worked perfectly !!!

1 Like

No problem please mark the post that helped as the solution.

How is YOUR post the post that helped you ?

sorry man,