ESPHome new "Feedback Cover" platform

Hi,
I am trying the new platform component for ESPHome released august 17th,
It feels promising, though I can get it to perfectly match my setup.

My garage door works by itself via toggle button, like every single door I know, you press it it opens, you press it it stops, you press it, it closes, it stops automatically when closed or opened.

So far everything clear here, I need a relay to toggle this door, I have it,
I need a new push button that goes to the ESP Chip so the ESP can trace and understand all the movements, okey, I have it

I added two extra reed sensors to detect the endstops on the ESP chip to have extra feedback, everything great in terms of hardware I think, there wouldn’t be any extra thing that I could need to manage this door and know exactly where it is (In the future I would like to open this gate to a certain percentage for pedestrian access, that’s why I installed both sensors)

I decided to gave it a try to this feedback cover, that looks exactly to give me what I would need to develop this. I had it working within minutes but here are some flaws:
I need to give a action to open, to close, and to stop. The actions, in this door, would always be the same, therefore, can do some errors.

I assigned to the three actions the relay one to toggle it on and off, great, it works.
Also when the door is open, the open button is greyed out, GREAT, but for example,
The stop button when the door is stopped is not greyed out, and if you press stop when the door is stopped, the door will start moving.
Also when the door is stopped, both open and close buttons are available, by toggling the door when it is stopped halfway, it would only go in the reverse direction than it was previously going.
Also if the door is opening, the closing button is available, and it wouldn’t close the door, it would just stop it.

To summarise it, most of the situations could be dealt with the option to grey out the xxxx button if door state is xxx.
Or to tell the Home assistant system that this is a toggle door and therefore the open close stop buttons are redundant and would not work at all and to go better with toggle button?.

Also please note that most of the things out there are for cover template platform, and would only work with template covers




###################

button:

  - platform: restart
    name: "$device_name Restart"
switch:

  - platform: gpio
    pin: GPIO05
    name: "toggle_relay_gate_TEST"
    restore_mode: always_off
    id: r1
    on_turn_on:
    - delay: 300ms
    - switch.turn_off: r1




binary_sensor:
  - platform: gpio
    name: gate_push_physical_TEST
    filters:
      - delayed_on: 100ms

    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: True
    id: Remote
    on_press:

      - cover.toggle: gate_1



    
    


  - platform: gpio
    pin:
      number: GPIO4
      mode: INPUT_PULLUP
      inverted: true
    id: endstop_opened
    name: gate_opened_TEST
    filters:
      - delayed_on: 100ms
    




    
  - platform: gpio
    pin:
      number: GPIO14
      mode: INPUT_PULLUP
      inverted: true
    id: endstop_closed
    name: gate_closed_TEST
    filters:
      - delayed_on: 100ms



  - platform: status
    name: "Status $device_name"







cover:
  - platform: feedback
    name: "Gate"
    device_class: gate  
    id: gate_1
    open_action:
      - switch.turn_on: r1
    close_action:
      - switch.turn_on: r1
    stop_action:

#      - if:
#          condition:
#            - state.cover #Cover is at opening or closing state
           then:
             - switch.turn_on: r1

    open_endstop: endstop_opened
    close_endstop: endstop_closed
    open_duration: 10s
    close_duration: 10s
    has_built_in_endstop: true

@jesserockz @ianchi

I don’t know if this is the place to discuss abut this.

I’m searching for a solution to the same problem, and have the same single button toggle cycle

Me too! Have just set up a feedback cover but my single button garage door opener also cycles through open, stop, close, stop, etc… regardless of which of the three buttons I press in the cover… ie the open, close and stop actions all use the same relay.

Seems to me that the cover.toggle action might do it. It’s described here Cover Component — ESPHome but I’m struggling to implement it. Can’t work out where to put it and what to use as the on trigger. Seems it must go with a binary sensor but the only ones in my cover are for the reed switches.

My backup plan is to experiment with a direction of movement sensor, described at Feedback Cover — ESPHome. But I’m not sure how that works… can’t find any practical examples of types of sensors and how it’s written in the yaml.

esphome:
  name: "gdo-s1"
  platform: ESP8266
  board: esp01_1m

logger:
api:
ota:
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "gdo-s1"
    password: "???????????"

captive_portal:

output:
  - platform: gpio
    id: "relay_output"
    pin: GPIO4

switch:
  - platform: output
    id: "relay"
    name: "Relay"
    output: "relay_output"

binary_sensor:
  - platform: gpio
    name: "Reed Switch 1"
    id: reedswitch_1
    pin: GPIO5
    filters:
      - delayed_on_off: 500ms

  - platform: gpio
    name: "Reed Switch 2"
    id: reedswitch_2
    pin:
      number: GPIO3
      inverted: yes
      mode:
        input: true
        pullup: true
    filters:
      - delayed_on_off: 500ms

# this is a feedback cover for two reed switches.
cover:
  - platform: feedback
    name: "Garage Roller Door"
    has_built_in_endstop: true
    max_duration: 40s
    device_class: garage
    open_action:
      - switch.turn_on: relay
      - delay: 0.5s
      - switch.turn_off: relay
    open_endstop: reedswitch_2
    # open_sensor: open_movement_binary_sensor
    open_duration: 27s
    close_action:
      - switch.turn_on: relay
      - delay: 0.5s
      - switch.turn_off: relay
    close_endstop: reedswitch_1
    # close_sensor: close_movement_binary_sensor
    close_duration: 22s
    stop_action:
      - switch.turn_on: relay
      - delay: 0.5s
      - switch.turn_off: relay

Search the past forum posts. I know I’ve seen this discussed multiple times and there are solutions to atleast some of these issues. I remember seeing several configurations that would be helpful.

Thanks Justin. I’ve searched the forum extensively… also the esphome discord and much wider too. The answer is probably there but it’s beyond my skills to find it.

I’ve done some trial and error and included the cover.toggle action in a couple of places in my yaml. It compiled OK but either made no obvious difference (when included under the switch) or stopped the cover working completely when included within the cover section itself.

Might ask on Discord down the track but I’ll move on to other projects for the time being - the cover works well enough as it is.

There is no info out there for out of template cover for covers that do have reed sensors on both ends and you want to have percentages on it with just a toggle button

The closest I got, and just by reading not trying, was with conditions on the open action stop action and close action
Stop action: if cover is opening then toggle button, if cover is closed then nothing
But I haven’t even tried this way,

I ended up having a card in ja, that shows the state, and only publishes the service toggle cover to interact with it, because if not, you will get errors because of assumed states.

That’s another thing asumes states even while having reed end stop sensors….

Thanks. That makes good sense… I’ll give it a go when I have some time, then report back.

I didn’t catch that older cover platforms dont work with the feedback one. I’m in the same boat your in, I think the only real option to get the most accurate feedback is to hook up a rotary encoder. Based on which direction its spinning and how many rotations you can accurately track where the door is at.

I don’t need accurate reporting of what position the roller door is in… just whether open, closed or somewhere between the two… and the feedback cover works well for that from my perspective. I’m mostly after something that means the open, close and stop buttons on the cover do just that. At present they all work in the same way… toggling through open, stop, close, stop. I’m currently working out how to use global variables and conditions in the various actions to achieve that. It’s slow progress but I’ll get there eventually. Will post back here with the solution though it will be a bit hacked together.

1 Like

why do you have a switch component tied to an output component? You only need one or the other and its not a rule by any means but, although an output component can do ON/OFF they’re generally used for pwm in controlling an led or something that needs more that full On or full Off.

I don’t know… I copied from an example template and adapted for my needs. And it seemed to work. Will do a bit of reading and see if I can tidy it up… I assume I can use the GPIO platform within my switch block.

its not hurting anything the way you have it, its just redundant and possibly a bad habit. The way you have it is both are identical switches but a switch component is visable in HA and the output isn’t exposed to HA.

Thanks Justin… it’s good for me to get in to good habits. Past experience has been that when I hack things together, without fully understanding them, they’re hard to work on in the future. Will try to put the GPIO info in the switch and get rid of the output. Much appreciated.

No problem. Hopefully that didn’t come out wrong. Just a friendly suggestion, I think we can all agree that bad habits are hard to break so best not to start them.

Not at all… I’m all for tidying up my messy code. My software engineer daughter (who I don’t like to bother) would be on my back about it for sure!

Have been distracted from my labourously slow work on putting conditions in the cover - trying to tidy up my code. Learning a lot as I go. I managed to get rid of the redundant output on my working garage opener which is a Shelly 1. But I can’t get it to compile on my Shelly Plus 1 which I’m using as a test platform. Perhaps I should post somewhere else but will include my code below.

The working code on the Shelly 1 is

switch:
  - platform: gpio
    pin: GPIO4
    id: relay
    name: "Relay"

on the Shelly Plus 1 it looks much the same to me but I get an error compiling… I assume it’s something to do with the newer device rather than my code.

# output:
#   - platform: gpio
#     pin: GPIO26
#     id: relay_output

switch:
  - platform: gpio
    pin: GPIO26
    name: "${device_name} Relay"
    id: relay
    # output: relay_output

the error is

Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
No dependencies
*** [/data/sp1-spare/.pioenvs/sp1-spare/src/esphome/components/gpio/output/gpio_binary_output.o] Source `src/esphome/components/gpio/output/gpio_binary_output.cpp' not found, needed by target `/data/sp1-spare/.pioenvs/sp1-spare/src/esphome/components/gpio/output/gpio_binary_output.o'.
========================== [FAILED] Took 3.14 seconds ==========================

lol atleast you have someone to seek advice from. Hey how do you have your reed sensors set up? I was only using 1 at the closed position to see if it was closed or open. I’ve added a second one at the fully open position but i’m getting all kinds of whonky things happening. The states are getting mixexd up, it closes 90% then stops, waits for the max_duration timout and then opens back up. I’m thinking its because of the way my sensors are reading open/close but i’m not quite sure. Are yours wired the same but set up differently in your config?

My reed switches work well… accurately reflect the real world state and same is reflected in the cover. It’s just the open, close, stop buttons that cause chaos… tbh, it’s functional anyway.

Hoping the following helps a bit… from the YAML for my working garage door opener

binary_sensor:
  # reedswitch_1 to the SW (GPIO5) terminal and grounded to L
  # reedswitch_2 is to GPIO3 and ensure it is grounded using the small GND pin nearby (NOT to L)
  - platform: gpio
    name: "Reed Switch 1"
    id: reedswitch_1
    pin: GPIO5
    filters:
      - delayed_on_off: 500ms

  - platform: gpio
    name: "Reed Switch 2"
    id: reedswitch_2
    pin:
      number: GPIO3
      inverted: yes
      mode:
        input: true
        pullup: true
    filters:
      - delayed_on_off: 500ms

Further to above… so the wiring is a little different for the two reed switches… and I assume that’s why I had to invert and pullup the pin on reed switch 2… tbh, I didn’t really know what I was doing but it works.