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.
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.
# 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
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!