Scripts and complicate conditions

I can get this to work:

  - condition: numeric_state
    entity_id: sensor.plant1_moisture
    below: 35

but cant get this to work:

 - condition:
       condition: or
       conditions:
         - condition: numeric_state
           entity_id: sensor.plant1_moisture
           below: 35
         - condition: numeric_state
           entity_id: sensor.plant2_moisture
           below: 35

Full script is as follows:

script:
  plantalert:
    sequence:
      - condition:
           condition: or
           conditions:
             - condition: numeric_state
               entity_id: sensor.plant1_moisture
               below: 35
             - condition: numeric_state
               entity_id: sensor.plant2_moisture
               below: 35
      - service: notify.mypushover
        data_template:
          message: "Water your plants!."
      - delay: '03:00'  
      - service: script.plantalert_repeat
  plantalert_repeat:
    sequence:
      - condition:
           condition: or
           conditions:
             - condition: numeric_state
               entity_id: sensor.plant1_moisture
               below: 35
             - condition: numeric_state
               entity_id: sensor.plant2_moisture
               below: 35
      - service: notify.mypushover
        data_template:
          message: "Water your plants!."
      - delay: '03:00'  
      - service: script.plantalert

Error that I get is:

Invalid config for [script]: [condition] is an invalid option for [script]. Check: script->script->plantalert->sequence->0->condition. (See /config/configuration.yaml, line 240). Please check the docs at Scripts - Home Assistant

The indenting is wrong at the very least. You show 4 spaces instead of 2.

      - condition:
           condition: or
           conditions:

needs to be:

      - condition: or
        conditions:

Actually it’s not required to be 2 spaces. What’s important is indentation for items at the same “level” has to be the same.

1 Like

Thank you!!