Automation based on condition

Hi Guys,
I’m just a beginner with HA but I must say I love the project. Almost everything is working out of the box, I like :slight_smile:
Still I have a question that I can’t figure out.
I have covers and a magnet sensor.
There I have 2 challenges. I only want the covers to go up a have way (half open) if the sun is shining. When it’s rainy the covers can go up entirely (Full open).
Second when the sun is shining I only want the cover at the door to go (full open) if the magnet sensor is “open”.
Could you give me any tips how to realize this with automation.
Kind Regards,

Sounds like there are several triggers, so use several automations. There’s no benefit to doing everything in one, and it’s harder to identify problems.

Just out of interest, how does does your HA detect rain and sunshine?

Hi Stiltjack,

Thanks for your reply. Sorry for the confusion, I’m still investigating that part to get it to work. I now have bought a light sensor. So maybe I can fix it with that. When there is a lot of light, leave the cover half way open. If the weather is cloudly less light. Open the cover.

But how can I put the steps in several automations?
Like I said I’m kind of new to HA :slight_smile:

The way I should build it would be:
Automation 1
Name: Open Cover - Sunny
Trigger: Light Full
Condition: Magnet Sensor Open
Action: Open Cover

Automation 2
Name: Cover Half - Cloudy
Trigger: Light less then (value in lx)
Condition: Magnet Sensor Closed
Action: Cover Half way open

Should that do the trick?

Kind Regards,

If you want to combine it in one automation-

alias: New Automation
description: ''
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.lux_living_room
    above: '200'
    for: '00:05:00'
    id: Intense Light
  - platform: numeric_state
    entity_id: sensor.lux_living_room
    below: '150'
    for: '00:05:00'
    id: Low Light
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Intense Light
          - condition: state
            entity_id: binary_sensor.window
            state: 'on'
        sequence:
          - service: cover.set_cover_position
            target:
              entity_id: cover.xyz
            data:
              position: 50
      - conditions:
          - condition: trigger
            id: Low Light
          - condition: state
            entity_id: binary_sensor.window
            state: 'off'
        sequence:
          - service: cover.set_cover_position
            target:
              entity_id: cover.windows
            data:
              position: 14
    default: []

Take a look at this features that you can use to construct your automation- (Choose & Trigger ID (as a condition))

Hi Ardy,

Thanks for your help and peace of code.
I definitely can work with that. But first I have to understand the code, so will let you know if I managed to get it to work :slight_smile:

Thanks again.

Kind Regards,

I was thinking it’s also possible to do this with Scenes. (Not I hadn’t done this.) Scenes capture the state your devices (or entities) are in at the time you create the scene and add the device/entity. You could then trigger the scene depending on the parameters you mentioned. You can do 1 automation per weather condition for example.