Powered Blinds Project

Currently, I have an office blind that I raise and lower with a geared motor, 3D printed spool and a manual fwd, rev switch. Now, I am trying to automate it into HA with ESPHome.
Components: a forward, reverse relay module (12V), (2) relays for forward and reverse an (2) micro reed switches with .4" magnets for end of travel stops.
The configuration is where I am very fussy on. In esphome, I have configured an up and down switch that triggers the relays (fwd & rev) and binary sensor for the travel limit reed switches.
So far that all works. Now I need to figure out how automate the switches in HA. When on upper limit, up is disabled and when on the lower limit, the down is disabled. I am lookin into creating multiple automations to do that, but I think there is a better way. I don’t know how to use templates or cover yet.
Here is my esphome code.


binary_sensor:
  - platform: gpio
    pin:
      number: D5
      inverted: false
      mode:
        input: true
        pullup: true
    id: "blind_on_top_stop"
    name: "Blind on top Stop"
    device_class: window

  - platform: gpio
    pin:
      number: D6
      inverted: false
      mode:
        input: true
        pullup: true
    id: blind_on_bottom_stop
    name: "Blind on bottom Stop"
    device_class: window

switch:
  - platform: gpio
    pin: D3
    inverted: true
    id: "esp_forward_relay"
    interlock: [esp_reverse_relay]
    name: "Blinds Open"
  - platform: gpio
    pin: D4
    inverted: true
    id: "esp_reverse_relay"
    interlock: [esp_forward_relay]
    name: "Blinds Close"

output:
  - platform: gpio
    pin: D5
    id: "on_blind_top_stop"

  - platform: gpio
    pin: D6    
    id: "on_blind_bottom_stop"

Have you seen the various ESPHome covers? Including the Endstop cover?

Just try configuring one and finding examples.

There’s also switch/relay interlocking.

No, I am new to ESPHome. It looks great! I will check it out.
Thanks

1 Like

I tried a number of changes, but I can not figure out how to configure the ESPHome cover.
I created (2) automations in the mean while. One for up and one for down and they work.

The below cover code is not working. The down arrow kind of works. It moves down than stops. Probably because of the automation. The up arrow just clicks and says 100% open, although it is closed. I got the code from the blind cover samples.

Blind_card

# Reed sensors to detect top and bottom limits
binary_sensor:
  - platform: gpio
    pin:
      number: D5
      inverted: false
      mode:
        input: true
        pullup: true
    id: "blind_on_top_stop"
    name: "Blind on top Stop"
    device_class: window

  - platform: gpio
    pin:
      number: D6
      inverted: false
      mode:
        input: true
        pullup: true
    id: blind_on_bottom_stop
    name: "Blind on bottom Stop"
    device_class: window

# Relays to control the motor up and down
# Outputs: Red forward, Green reverse
switch:
  - platform: gpio
    pin: D3
    inverted: false
    id: "esp_open_relay"  # Move UP
    interlock: [esp_close_relay]
    name: "Blinds Open"
  - platform: gpio
    pin: D4
    inverted: false
    id: "esp_close_relay"   # Move Down
    interlock: [esp_open_relay]
    name: "Blinds Close"

# configuration for stops
cover:
  - platform: endstop
    name: "Endstop Cover"

    open_action:
      - switch.turn_on: esp_open_relay
    open_duration: 21sec
    open_endstop: blind_on_top_stop

    close_action:
      - switch.turn_on: esp_close_relay
    close_duration: 20sec
    close_endstop: blind_on_bottom_stop

    stop_action:
      - switch.toggle: esp_open_relay
      - switch.toggle: esp_close_relay

OK, I found a cover type feedback. I coded it and it works great.

cover:
  - platform: feedback
    name: "Blinds Control"

    open_action:
      - switch.turn_on: open_cover_switch
    open_duration: 23s
    open_endstop: open_endstop_binary_sensor
    # open_sensor: open_movement_binary_sensor

    close_action:
      - switch.turn_on: close_cover_switch
    close_duration: 20s
    close_endstop: close_endstop_binary_sensor
    # close_sensor: close_movement_binary_sensor

    stop_action:
      - switch.turn_off: open_cover_switch
      - switch.turn_off: close_cover_switch

Also, I have an Insteon mini remote. I add automations to respond to [Up], [Down] and [Stop] buttons]. That is working great as well.
Project complete - Yea!