Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95394

Condition: 'or' and 'and'?

$
0
0

@prankousky wrote:

Hi everybody,

I am currently trying to create an automation to water our plants twice a day; it is meant for summer, but I’d like to try it already, so I’ll work with summer and spring (explained below).

In order for the automation to work properly, I need it to check

  • whether it is currently spring or summer => this is determined by my sensor.season, which will report the current season
  • whether or not it is supposed to rain that day => determined by openweathermap sensor
  • (whether or not temperature will be above a certain value that day; not sure if/how I will implement this)

So I need the automation to first check, whether or not it is either spring or summer (or condition), and, if either is true, check whether it will not rain that day and if so (and condition).

My current workaround would be to create an extra automation that will set something like binary_sensor.irrigation to true/false depending on the season, then use another automation to check rain probability and/or temperature (binary_sensor.irrigation_two or something like that), then use a third automation to trigger at sundown -01:30:00 and sunset +1:30:00, use and condition on those two binary_sensors, then finally trigger the irrigation.

I’d actually know how to do this, but I’d prefer to use one single automation for this, if possible. So far, all I got is that part below. Can somebody please help me out?

automation:
  - alias: "[Timer] Bewässerung Morgens"
    trigger:
      platform: sun
      event: sunrise
      offset: "-01:30:00"
    condition:
      condition: or
      conditions:
        - condition: state
# (...) not sure how to continue here
    action:
      - service: switch.turn_on
        entity_id: switch.kaercher_pumpe
      - delay: "00:03:30"
      - service: switch.turn_off
        entity_id: switch.kaercher_pumpe

Thank you for your ideas :slight_smile:

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95394

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>