Newbie needs assistance with (combining) shutters automations

Hi All,

This is a big project and I am not expecting someone to solve all my problems and/or do this for me but it appears that the Automation GUI (while slowly improving) is quite basic and so I need help/pointers to accomplish something similar to the below scenarios. (My issue is that while I know the logic I just don´t know how to write it for it to work.)

Right now I have the below automations for opening the shutters:
1- Automation 1 set the bedroom shutters positions to 15% at 6:45a on a workday
2- Automation 2 opens all shutters on the ground floor to different positions depending on sun exposure (manually selected) for every workday
3- Automation 3 Opens the downstairs shutters at 8:00
4- Automation 4 opens the shutters at 8a on the weekend

Right now I have the below automations for closing the shutters:
5- Automation 5 close the bedroom/bathroom/downstairs shutters at sunset
6- Automation 6 Close the remainder of the shutters 20 min after sunset

My main goal is to:

  • know if I can combined some of those automations to help in better manage them
  • How can I only run those automation is I am home (no presence detection so for now I will use a button or helper?)
  • I want to open/close (set position) to certain shutters based on Sun. How do I trigger thoses?
  • I would like to not close a specific shutter at Sunset +20 min if a door is opened but I want the other shutters to still close. Also once that door is closed and it is past Sunset +20 min, I want that specific shutter to shut down.

Instead of using automation, should I look into scripts? I have no scripts and no helper yet. Just basic ZHA integration for the sensor and my shutters uses shelly 2.5. No MQTT or nothing, I am keeping this as simple as possible as I do not have hours every day to work on this.

Any help or pointers is appreciated,
Cheers!

A real easy way to automate this without a lot of hassle is to use the scheduler integration https://github.com/nielsfaber/scheduler-component This is a custom component that makes it very easy from the UI to add and maintain multiple schedules for your shutters. Install it using HACS (both the integration and the scheduler card for the front end and off you go!.

Alternative I use one automation for my blinds that has multiple triggers and a choose statement for the different operations. See my automation below for inspiration :wink:


alias: Luxaflex zonwering automaat
trigger:
  - platform: sun
    event: sunrise
    offset: 0
  - platform: time
    at: '08:00'
  - platform: sun
    event: sunset
    offset: '01:00'
  - platform: state
    entity_id: sensor.pir_motion_sensor_illuminance_3
    for:
      minutes: 10
  - platform: state
    entity_id: sensor.pir_motion_sensor_illuminance_4
    for:
      minutes: 10
condition: []
action:
  - choose:
      - conditions:
          - condition: time
            after: '07:30'
            before: '20:00'
          - condition: state
            entity_id: sun.sun
            state: above_horizon
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: >
                      {{ (states("sensor.pir_motion_sensor_illuminance_3") |
                      int) > (states("input_number.drempel_zonnig") | int ) }}
                sequence:
                  - condition: template
                    value_template: >-
                      {{ not
                      is_state("input_select.luxaflex_dining","Zonwering") }}
                  - service: input_select.select_option
                    target:
                      entity_id: input_select.luxaflex_dining
                    data:
                      option: Zonwering
            default:
              - condition: template
                value_template: >
                  {{ (states("sensor.pir_motion_sensor_illuminance_3") | int) <
                  (states("input_number.drempel_zonnig") | int ) - hysteris }}
              - service: input_select.select_option
                target:
                  entity_id: input_select.luxaflex_dining
                data:
                  option: Dagstand
          - delay:
              seconds: 2
          - choose:
              - conditions:
                  - condition: template
                    value_template: >
                      {{ (states("sensor.pir_motion_sensor_illuminance_4") |
                      int) > (states("input_number.drempel_zonnig") | int - 5)
                      }}
                sequence:
                  - condition: template
                    value_template: >-
                      {{ not
                      is_state("input_select.luxaflex_living","Zonwering") }}
                  - service: input_select.select_option
                    target:
                      entity_id: input_select.luxaflex_living
                    data:
                      option: Zonwering
            default:
              - condition: template
                value_template: >
                  {{ (states("sensor.pir_motion_sensor_illuminance_4") | int) <
                  (states("input_number.drempel_zonnig") | int - hysteris - 5)
                  }}
              - service: input_select.select_option
                target:
                  entity_id: input_select.luxaflex_living
                data:
                  option: Dagstand
    default:
      - service: input_select.select_option
        target:
          entity_id: input_select.luxaflex_living
        data:
          option: Dicht
      - delay:
          seconds: 2
      - service: input_select.select_option
        target:
          entity_id: input_select.luxaflex_dining
        data:
          option: Dicht
variables:
  hysteris: 50
  threshold: '{{ states("input_number.drempel_zonnig") | int(0) }}'
mode: restart

Thank you for the reply. I’ll definitely take a look at the integration and what you sent. Hope you don’t mind me reaching out again if I have more questions.