Optimization of roller shutter control (automation)

Hello,

I have a problem and I cannot think of a sensible solution.
I have an automation on a roller shutter, this moves the roller blind from its current position (18%) to halfway at a set time (SA, SUN 9:30 am) and fully opens after a certain time (SA, SUN 9:30 am) on.

So far it works wonderfully, there are a few additional conditions - but it works.

Now to the problem, if you manually open the roller shutter prematurely because you wake up earlier, the roller blind then closes halfway at 9:00 a.m. and then opens again at 9:30 a.m.

How can this be prevented?
Examination of the current position?

The roller shutter is controlled with a Shelly 2.5.

Would be grateful if there was something about how to make the automation a little better.

Many greetings
Gerald

alias: Rolladen Schlafzimmer morgens (SA & SO)
description: ''
trigger:
  - at: '09:20'
    platform: time
condition:
  - condition: state
    entity_id: binary_sensor.montag_freitag
    state: 'off'
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.nachtdienst
        state: 'off'
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.nachtdienst
        state: 'off'
  - condition: not
    conditions:
      - condition: state
        entity_id: input_select.rolladen
        state: manuell
action:
  - device_id: 872294370a4d172718ed0558b8d8c8f5
    domain: cover
    entity_id: cover.rolladen_schlafzimmer
    type: set_position
    position: 50
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - device_id: 872294370a4d172718ed0558b8d8c8f5
    domain: cover
    entity_id: cover.rolladen_schlafzimmer
    type: set_position
    position: 100
mode: single

Could you create a sensor to return the current position? Then add a rule if the position isn’t within a %

1 Like

I think you can put a template condition to check if the current position of the cover is 0 before proceeding with the automation. The template should look like this.

{{ state_attr('cover.rolladen_schlafzimmer', 'current_cover_position')|int == 0}}

Or just with a numeric state check

alias: Rolladen Schlafzimmer morgens (SA & SO)
description: ''
trigger:
  - at: '09:20'
    platform: time
condition:
  - condition: state
    entity_id: binary_sensor.montag_freitag
    state: 'off'
  - condition: state
    entity_id: input_boolean.nachtdienst
        state: 'off'
  - condition: state
    entity_id: input_boolean.nachtdienst
        state: 'off'
  - condition: not
    conditions:
      - condition: state
        entity_id: input_select.rolladen
        state: manuell
  - platform: numeric_state
    entity_id: rolladen_schlafzimmer
    attribute: current_cover_position
    below: '50'
action:
  - device_id: 872294370a4d172718ed0558b8d8c8f5
    domain: cover
    entity_id: cover.rolladen_schlafzimmer
    type: set_position
    position: 50
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - device_id: 872294370a4d172718ed0558b8d8c8f5
    domain: cover
    entity_id: cover.rolladen_schlafzimmer
    type: set_position
    position: 100
mode: single

Here I have to go by the attribute of sheminasalam because I don’t have covers and the documentation seems to lack info.

I also removed all the and's because a) conditions are implicitly and, b) you used it wrong (all conditions you want to and should fall under the and, not have an and per entity because that would only and it with itself :wink:

You stand in the forest and you can no longer see the trees …

I just used the numerical state and it works - thanks!