Roller shutter automation does not work like expected

Hi all,
I have mounted some roller shutters which are integrated in HA via the elero addon (GitHub - W00D00/home-assistant-elero: Elero Centero component) which is working perfectly. Now I am trying to make a new automation where the rollershutter (cover.buerobalkontuer) should open if the door to the balcony (binary_sensor.burobalkontur) gets opened and the roller shutter was closed. This is working fine.

alias: Rollladen im Wohnzimmer öffnen wenn Balkontüre geöffnet wird
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.wohnzimmerbalkontur
    from: 'off'
    to: 'on'
condition: []
action:
  - service: cover.open_cover
    target:
      entity_id: cover.wohnzimmerbalkontuer
mode: single

In the next step I tried to automatically close the roller shutter when the door gets closed again. Here I am facing some issues… In order to ‘remember’ if the roller shutter was opened by the automation I introduced a bool (input_boolean.buerorollladen_was_closed).

alias: 'Rollladen im Büro öffnen wenn Balkontüre geöffnet wird '
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.burobalkontur
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: cover.buerobalkontuer
            state: closed
          - condition: and
            conditions:
              - condition: state
                entity_id: binary_sensor.burobalkontur
                state: 'on'
        sequence:
          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.buerorollladen_was_closed
    default: []
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.buerorollladen_was_closed
            state: 'off'
        sequence:
          - service: cover.close_cover
            target:
              entity_id: cover.buerobalkontuer
    default: []
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.buerorollladen_was_closed
            state: 'on'
        sequence:
          - service: cover.open_cover
            target:
              entity_id: cover.buerobalkontuer
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.buerorollladen_was_closed
    default: []
mode: single

At the moment the following is happening:
1.) the roller shutter is open and the door closed → input_boolean.buerorollladen_was_closed=off
2.) roller shutter and door are open → input_boolean.buerorollladen_was_closed=off + rollershutter moves to closed position
3.) roller shutter and door closed → input_boolean.buerorollladen_was_closed=off + roller shutter stays closed
4.)roller shutter is closed + door open → input_boolean.buerorollladen_was_closed=on + roller shutter stays closed
5.) roller shutter and door closed–> input_boolean.buerorollladen_was_closed=off + roller shutter moves to open position
6.) everything repeats from point 2 again.

Where is my error in the automation?

Thanks in advance!

BR

Help me understand something as I am a little confused. It happens regularly, don’t worry :stuck_out_tongue:

Based on the yaml provided, it looks like you can already get the state of the cover. So do you really need the boolean?

Does this work? (disable both automations provided). Provide a trace to help debug if no.

alias: 'Rollladen im Büro öffnen wenn Balkontüre geöffnet wird '
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.wohnzimmerbalkontur
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: binary_sensor.wohnzimmerbalkontur
    from: 'on'
    to: 'off'    
# deliberately avoided using a blank state as not to trigger on none/unknown/unavailable
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: cover.buerobalkontuer
            state: closed
          - condition: state
            entity_id: binary_sensor.burobalkontur
            state: 'on'
        sequence:
          - service: cover.open_cover
            target:
              entity_id: cover.wohnzimmerbalkontuer            
      - conditions:
          - condition: state
            entity_id: cover.buerobalkontuer
            state: open
          - condition: state
            entity_id: binary_sensor.burobalkontur
            state: 'off'
        sequence:
          - service: cover.close_cover
            target:
              entity_id: cover.wohnzimmerbalkontuer    
    default: []
mode: single

Hi,
thanbs for the very fast answer. The reason why I added the bool is that I only want to close the cover when the door gets closed and the cover was closed before I open the door.

With your automation the cover would close every time when I close the door.

e.g.: At day the cover is opened and I open the door. After that I close the door again → the cover should stay open.
e.g.: At night the cover closes automatically (this is another automation). When I want to go out to the balkony I open the door and the cover should move upwards automatically. When I go inside again and close the door it should move downwards again (because it was in closed state before)

Hope I explained it now in a way that you understand my problem. :slight_smile:

attached the debug files with my automation activated and I just opened the door several times: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

Thank you!

To help clarify - at night you “leave the door open the entire time you are outside and the cover is open” ?

Yes this is the case. And for safety I have a hidden button to open the cover again (in case somehow the door closes and I am outside :wink: )

Ok, I understand better now.

Sound like two automations are in order;

  1. Scheduler automation that;
  • opens cover in day, turn off the “open/close” automation provided earlier
  • closes the cover at night, turns on the “open/close” automation provided earlier
  1. the one provided earlier.

Hi,
exactly! The ‚scheduler‘ automation gets triggered by the sunset/sunrise and works like expected.
The error from me must be in the secound automation which I provided before… and I believe that is is a logical error from me, bit I do not find it… :wink:

nobody an idea how I can make it working? :slight_smile: