Question: will this automation work?

Hi all

I have the following automation. I need 2 or conditions.
1 for the state of cover.tent and one more for the sensor.wind_speed_ss_90_m4
Is it ok?

- id: Tent half open in Summer Morning
  alias: Tent half open in Summer Morning
  trigger:
    platform: time
    at: '06:50:00'
  condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: cover.tent
        state: "unknown"
      - condition: state
        entity_id: cover.tent
        state: "closing"
      - condition: state
        entity_id: cover.tent
        state: "close"
      - condition: or
        conditions:
          - condition: state
            entity_id: sensor.wind_speed_ss_90_m4
            state: "unknown"
          - condition: numeric_state
            entity_id: sensor.wind_speed_ss_90_m4
            below: 8

Numbering the conditions from 1, you have:

C1 or C2 or C3 or (C4 or C5)

Which is the same as:

C1 or C2 or C3 or C4 or C5

I suspect what you want is this:

(C1 or C2 or C3) and (C4 or C5).

In which case, no your indentation is wrong. It should be:

  condition:
    - condition: or
      conditions:
        - condition: state
          entity_id: cover.tent
          state: "unknown"
        - condition: state
          entity_id: cover.tent
          state: "closing"
        - condition: state
          entity_id: cover.tent
          state: "close"
    - condition: or
      conditions:
        - condition: state
          entity_id: sensor.wind_speed_ss_90_m4
          state: "unknown"
        - condition: numeric_state
          entity_id: sensor.wind_speed_ss_90_m4
          below: 8

Also this:

state: "close"

Should be:

state: "closed"
1 Like

yes, this is what I want. Thanks tom!

tom one more quick question
the below triggers are doing the same job?

  trigger:
    entity_id: sun.sun
    platform: state
    state: "above_horizon"
    
  trigger:
    - platform: sun
      event: "above_horizon"

Yes, they will both trigger the same.

1 Like

Strange thing. None of the above triggers is working. I got the following message

Logger: homeassistant.config
Source: config.py:454
First occurred: 12:46:01 (9 occurrences)
Last logged: 13:01:05

Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->state. (See ?, line ?).
Invalid config for [automation]: not a valid value for dictionary value @ data['event']. Got None. (See ?, line ?).
Invalid config for [automation]: required key not provided @ data['trigger']. Got None. (See ?, line ?).

i think this is a problem with above_horizon.

I tried the following which is working…

  trigger:
    - platform: sun
      event: sunrise
      offset: "00:20:00"

This:

  trigger:
    entity_id: sun.sun
    platform: state
    state: "above_horizon"

Should be:

  trigger:
    entity_id: sun.sun
    platform: state
    to: "above_horizon"
1 Like

you are right of course. Thanks again