"AND" Trigger?

Hello there

Is there a simple way to AND 2 conditions for only one trigger without templating in an automation ?

If you define 2 triggers, the automation will run if one OR the other fires. But I need both together.

My use case is :
If sun elevation is below 10, AND the temperature outside is below 15°C, I just want to close the rolling cover to keep inside temperature comfortable.
If both conditions are not yet met, no action needs to be taken yet.

  • If I have just 1 trigger for elevation, and add the temperature as a condition, that mostly works in winter and cold days, but if the temperature is not below 15 when sun elevation goes below 10, no action is never taken because the trigger will not fire until tomorrow.

  • If I have just 1 trigger for temperature, and add the elevation as a condition, then if the sun is still high when the temperature goes below 15, then no action is never taken, because temperature will probably not go above then below before tomorrow.

Another use cas is :
turn off the light when outside illuminance is above xxx AND the rolling shutter is open. (I don’t want the light to turn off, if the shutter is still closed, and I don’t want the light to turn off, if the shutter opens, but it is a rainy day)

This template trigger will probably works for me for the second use case :

{{ ( states( 'sensor.outside_illuminance_lux' ) | float 
      > states( 'input_number.illuminance_threshold' ) | float )
       and states( 'cover.rolling_shutter_livingroom' ) == 'open' }}

But, my question is : is there currently any “UI” way to have this kind of “AND trigger” without templating?
Can’t find one here

You’re misunderstanding triggers. A trigger is a point-in-time event when something happens. You wouldn’t want to be triggering off the rare conjunction of events when the sun drops below 10° at the exact same time as the temperature drops below 15°C.

Trigger off both elevation and temperature, and include both in the conditions.

trigger:
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: 10
  - platform: numeric_state
    entity_id: sensor.outside_temperature
    below: 15
condition:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: 10
  - condition: numeric_state
    entity_id: sensor.outside_temperature
    below: 15
action: ...

That will trigger whenever the elevation drops below 10 or whenever the temperature drops below 15, but will only continue to the action when both are true, because conditions are logical AND.

1 Like