i have an automation when i’m home it will trigger few action, like:
disable alarm
send notification
turn on light
turn on fan
but the last two need to be triggered only if a specific condition is matched, for the light only if sun is down or light sensor lower than 30
and for the fan i need to turn it on only if the temperature is higher than 25,
but how can i write this? because from what i understand if one condition is not met the execution is stopped, but as i have 2 separate condition how can one not stop the other ??
mmm i don’t understand i have 2 separate condition but they are independent and enable or not an action
if i have something like:
condition or:
sun down
illumantion < 30
service:
turn on light
condition:
temperature > 25
service:
turn on fan
but if none of the first condition is met (illumination is 60 and sun is up) also the second condition (temperature) would not be executed as it’s after the first condition … no ?
i didn’t know about if then in yaml … maybe it’s new ? i think this is what i was looking for
two separate if … that will trigger or not a service. thanks
Personally, and for simplicity, instead of trying to pack a bunch of different conditions into a single automation, typically I’ll write an automation that fires individual scripts - each of these scripts is what contains the conditions for the actions each script executes.
There seem to be two trains of thoughts in the HA community, with the preference to try to reduce the # of automations/scripts and combine using if/else/conditions/choose/other means vs. having a greater # of automations / scripts - each with a ‘simpler’ purpose.
Will leave it to you whether you define ‘simple’ as one automation with a bunch of (IMO) complicated conditions or multiple automations/scripts.
Here’s an example of an automation that I trigger at 8pm, which turns OFF our family room air freshener, and then fires scripts to turn on our master bedroom and children’s room’s humidifiers - each of these is based on A) whether the person(s) are home and B) weather / HVAC (kids use upstairs, parents use downstairs) conditions inside the scripts.