ESPHome Time-Based cover - perform stop action before direction change

Hi, I’ve build a time-based cover with two relays per cover, one for power and one for the direction.
My problem is, that I want to have a short delay, before I directly change from up-movement to down-movement and vice versa, because my motor doesn’t like that. For now I’ve added a delay at the up- and down actions but that messes with time part of the component. Is there a way to perform the stop-action between a direction change or to add a delay before the up-down-actions get performed? Or do I have to write a custom cover in C++?
This is my current configuration:

esphome:
  name: rolladen
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "wifiSSID"
  password: "wifiPassword"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "apSSID"
    password: "apPassword"

captive_portal:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:


ota:


switch:
  - platform: gpio
    id: cover1_direction
    pin: 26
  - platform: gpio
    id: cover1_power
    pin: 25
########################
  - platform: gpio
    id: cover2_direction
    pin: 33
  - platform: gpio
    id: cover2_power
    pin: 32


cover:
  - platform: time_based
    name: "Cover_Garden"
    id: garten
    assumed_state: false
    
    open_action:
      - switch.turn_off: cover1_power
      - delay: 1s
      - switch.turn_on: cover1_direction
      - delay: 200ms
      - switch.turn_on: cover1_power
    open_duration: 20s

    close_action:
      - switch.turn_off: cover1_power
      - delay: 1s
      - switch.turn_off: cover1_direction
      - delay: 200ms
      - switch.turn_on: cover1_power
    close_duration: 9s

    stop_action:
      - switch.turn_off: cover1_power
      - delay: 200ms
      - switch.turn_off: cover1_direction
      
#########################################
  - platform: time_based
    name: "Cover_Road"
    id: strasse
    assumed_state: false

    open_action:
      - switch.turn_off: cover2_power
      - delay: 1s
      - switch.turn_on: cover2_direction
      - delay: 200ms
      - switch.turn_on: cover2_power
    open_duration: 13s

    close_action:
      - switch.turn_off: cover2_power
      - delay: 1s
      - switch.turn_off: cover2_direction
      - delay: 200ms
      - switch.turn_on: cover2_power
    close_duration: 13s

    stop_action:
      - switch.turn_off: cover2_power
      - delay: 200ms
      - switch.turn_off: cover2_direction

Thanks!

I’m in the same situation. Did you got a solution? Can you share?

you could use interlock wait time for this

esp8266:
    board: esp01_1m

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    id: button_1
    on_press:
      then:
        - cover.open: my_cover
  - platform: gpio
    pin:
      number: GPIO9
      mode:
        input: true
        pullup: true
      inverted: true
    id: button_2
    on_press:
      then:
        - cover.stop: my_cover
        - switch.turn_on: cover_stop
        - delay: 1s
        - switch.turn_off: cover_stop
  - platform: gpio
    pin:
      number: GPIO10
      mode:
        input: true
        pullup: true
      inverted: true
    id: button_3
    on_press:
      then:
        - cover.close: my_cover

switch:
  - platform: gpio
    pin: GPIO12
    interlock: &interlock [open_cover, close_cover]
    interlock_wait_time: 200ms
    id: open_cover
  - platform: gpio
    pin: GPIO4
    interlock: *interlock
    interlock_wait_time: 200ms
    id: close_cover
  - platform: gpio
    pin: GPIO5
    id: cover_stop

cover:
  - platform: time_based
    name: ${cover_name}
    id: my_cover
    open_action:
      - switch.turn_on: open_cover
    open_duration: 46s
    close_action:
      - switch.turn_on: close_cover
    close_duration: 45s
    stop_action:
      - switch.turn_off: open_cover
      - switch.turn_off: close_cover

my example above.

1 remark, I tested this without attaching the actual covers,
I still need some time to rewire some stuff to actually use those switches.

1 Like

Thanks, didn’t knew that existed, will try that when I have time.

@aerodolphin I have to admit, as I almost never changed directions while moving I forgot about it.