Problem with and , or conditions

I dared to create automations in automation editor but there are some conditions that need and , or so I made the conditions in the editor and added and, or later in automations.yaml but it doesnt work and seems to give errors can anyone take a look to the and , or conditions please and help me?

- id: '1561721642302'
  alias: Irrigation turn on, then off 10 minutes later
  trigger:
  - event: sunset
    platform: sun
  condition:
    condition: and
  conditions:
  - condition: state
    entity_id: calendar.summer_automations
    state: 'on'
  - condition: state
    entity_id: weather.dark_sky
    state: clear
  condition:
    condition: or
  conditions:
  - condition: state
    entity_id: weather.dark_sky
    state: cloudy
  - condition: state
    entity_id: weather.dark_sky
    state: partlycloudy
  action:
  - data:
      entity_id: switch.sonoff_10004115ce
    service: switch.turn_on
  - delay: 'minutes: 10'
  - data:
      entity_id: switch.sonoff_10004115ce
    service: switch.turn_off

It’s not entirely clear what logic you are going after as your indentation is way off and you have some extraneous “condition” statements. The config below will only be true if:

(calendar.summer_automations is on AND weather.dark_sky is clear ) AND ( weather.dark_sky is cloudy OR weather.dark_sky is partlycloudy )

However, as weather.dark_sky can’t be both clear AND (cloudy OR partlycloudy) this will never be true. But the formatting should help you get the logic right.

  condition: # top level is AND by default
    - condition: and
      conditions:
        - condition: state
          entity_id: calendar.summer_automations
          state: 'on'
        - condition: state
          entity_id: weather.dark_sky
          state: 'clear'
    - condition: or
      conditions:
        - condition: state
          entity_id: weather.dark_sky
          state: 'cloudy'
        - condition: state
          entity_id: weather.dark_sky
          state: 'partlycloudy'

well I want that config to be like or cloudy or partly cloudy what should I fix in there?

Sorry. I don’t understand ‘like’ what?

Write out the full logic you want.

condtions and should be the calendar and the clear weather, conditions or should be cloudy weather , partly cloudy weather

You’re missing a logic function where your first comma is.

This is the default

calendar AND clear weather

AND

cloudy weather OR partly cloudy weather

Assume the calendar is true. It can’t be clear AND (cloudy OR partly cloudy), thus it evaluates as false. If the calendar is false the statement is also false. Thus It will never be true.

Do you want this instead:

calendar AND clear weather

OR

cloudy weather OR partly cloudy weather

well let me put it in an another way I want my sprinkler to use the calendar (cause it defines what days to water from may to september) by any means but I want it to water either in clear , cloudy or partly cloudy weather cause forecasts sometimes aint accurate

Ok, so you want

calendar

AND

(clear OR cloudy OR partly cloudy)

Which you should do like this:

  condition: # top level is AND by default
    - condition: state
      entity_id: calendar.summer_automations
      state: 'on'
    - condition: or
      conditions:
        - condition: state
          entity_id: weather.dark_sky
          state: clear
        - condition: state
          entity_id: weather.dark_sky
          state: cloudy
        - condition: state
          entity_id: weather.dark_sky
          state: partlycloudy

this is the one thank you my friend