Conditions or trigger on automation

Hi,

I saw on the Hass page this example:

automation:
  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    # Optional
    value_template: "{{ state.attributes.battery }}"
    # At least one of the following required
    above: 17
    below: 25

Does it mean when it is between 17 and 25 it will trigger the event and when it is for example 16 the trigger is off but does it mean that the attached action will stay in the current state or will it turn off as well ?

I have for my setup a xiaomi temp humidity sensor and this will trigger my heater to be on or off but I don’t understand how I can link the action to switch on or off the needed switch.

I’m trying to use the automation directly on the page itself.

it is saying that it will do the action when the automation is triggered but does that also mean it will be deactivated when it is not triggered anymore ?

Kind regards,

G

The trigger will fire when you reach the threshold, e.g when below 17 or above 25. In between the trigger does nothing.

Yeah, what Francis said, but additionally, if it’s already in your ‘zone’ (say 20 degrees) nothing will happen till it drops to 16.9 and then rises back above 17 (same for the other limit).
This is implicit in what Francis said but some fail to catch the nuance.
What do you want to trigger on ?

I want to trigger on a temp change in this case when it drops below 21 degC it will switch on the valve towards the heating element and when it reaches 23 degC it will switch off.

In the future I want the setpoints also be user input instead of “hard” coded.

Kind regards

Looks like the generic thermostat component might be a good choice for this use case.

But to do this in an automation you’d need two automations: one to turn it on below 21 and another to turn it off above 23. Or I suppose a single automation with below: 21 and above: 23 with a service template in the action that determines if it turns the switch on or off based on the trigger.

Tediore,
I agree the thermostat is a better solution but he’s going to need additional automations to handle his timing issues.
I usually jut set really low values when I don’t want it to run and change the values according to occupancy, day, evening and night. Oh and if the windows / doors are open. (I know you know this but Glenn may not) :crazy_face:

Thanks I’ll add as soon as I’m home again. Thanks for the fast replies :slight_smile: