esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Disable cover stop button #3059

Open archerne opened 2 years ago

archerne commented 2 years ago

The problem

If no "stop_action" is set in a cover template ESPHome should pass a "supported_features: 3" instead of "supported_features: 11" so that there is no stop button in Home Assistant.

Which version of ESPHome has the issue?

2022.2.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.2.8

What platform are you using?

ESP8266

Board

D1 Mini

Component causing the issue

cover

Example YAML snippet

cover:
  - platform: template
    device_class: garage
    id: "garage_door_cover"
    name: "Garage Door"
    has_position: false
    open_action:
      - switch.turn_on: side_garage_relay
      - delay: 0.1s
      - switch.turn_off: side_garage_relay
      - cover.template.publish:
          id: garage_door_cover
          state: !lambda 'return COVER_OPERATION_OPENING;'
    close_action:
      - switch.turn_on: side_garage_relay
      - delay: 0.1s
      - switch.turn_off: side_garage_relay
      - cover.template.publish:
          id: garage_door_cover
          state: !lambda 'return COVER_OPERATION_CLOSING;'
    assumed_state: false

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-esphome[bot] commented 2 years ago

Hey there @esphome/core, mind taking a look at this issue as it has been labeled with an integration (cover) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

archerne commented 2 years ago

This might be just setting the supported actions instead of setting supported features directly. Here is how MyQ does it and their integration has no stop button, just up and down. https://github.com/home-assistant/core/blob/dev/homeassistant/components/myq/cover.py

lululombard commented 2 years ago

I have the exact same issue

poxin13 commented 2 years ago

Just ran into this today too

amomchilov commented 1 year ago

Hey there!

Total newb here. I took a stab at implementing this. Does anybody want to help me bring it to the fruition?

Here are the PRs:

poberth commented 1 year ago

Hi, I am using the cover platform to control a valve but the valve doesn't support a stop function. This issue would make my device work. Are the PRs completed? Thanks.

amomchilov commented 1 year ago

I think the third PR depends on the changes from the second one, and I'll probably need a bit of help polishing off the last bit of it.

amomchilov commented 1 year ago

Woohoo, great success!

A screenshot of my garage entity (a template cover), showing only the up and down arrows, with no more square 'stop' button.

Many thanks to @jesserockz for helping, reviewing and getting this merged!

I think this issue can be closed as complete now :)

aeozyalcin commented 1 year ago

Thanks for taking this on @amomchilov. I just looked into how I can take advantage of set_supports_stop, but looks like the only current way is to create a custom cover sensor, and use this new function in the C++ header file.

I am using a template cover entity in my setup, and I was hoping this would be a simple parameter like supports_stop: false in the YAML file. Any thoughts on this? Or can you think of how I can make use of this without having to create a whole new custom cover entity?

amomchilov commented 1 year ago

It's been a while since I first wrote this code, but from I can tell, there's nothing specific to template covers here.

The Python script reading your YAML will configure the supports_stop trait automatically based on whether your cover has a stop action.

https://github.com/esphome/esphome/pull/3897/files#diff-f62e02ea76e8404abb6bd2ba45e1d46e91c05cf31ef31d8f477479fa8853d80fR76

If you have no stop action, and you still see the stop button, double check that you're running the latest versions of Home Assistant, ESPHome and the firmware on your device (this feature required updates to all 3 of these).

archerne commented 1 year ago

image works great for me

cover:
  - platform: template
    device_class: garage
    id: "side_garage_door_cover"
    name: "Side Garage Door"
    has_position: false
    open_action:
      - switch.turn_on: side_garage_relay
      - delay: 0.1s
      - switch.turn_off: side_garage_relay
      - cover.template.publish:
          id: side_garage_door_cover
          current_operation: OPENING
      - delay: 45s
      - cover.template.publish:
          id: side_garage_door_cover
          state: OPEN
          current_operation: IDLE
    close_action:
      - switch.turn_on: side_garage_relay
      - delay: 0.1s
      - switch.turn_off: side_garage_relay
      - cover.template.publish:
          id: side_garage_door_cover
          current_operation: CLOSING
      - delay: 45s
      - cover.template.publish:
          id: side_garage_door_cover
          state: CLOSED
          current_operation: IDLE
    assumed_state: false
wernerhp commented 1 year ago

Another issue that's related to this.
Cover button states are not dependent on CoverOperation

Problem 1

■ button is always enabled (when stop_action is set) regardless of the cover state and operation (even when COVER_OPERATION_IDLE) image image

■ button is expected to be

Problem 2

↑ button is enabled during COVER_OPERATION_CLOSING image

↓ button is enabled during COVER_OPERATION_OPENING image

↑ and ↓ buttons are expected to be

amomchilov commented 1 year ago

Hey @wernerhp, good point, the stop button being enabled while idle is odd indeed.

Those are related but quite distinct issues, could you please open up a new issue for them? (This thread is full of people looking to get rid of the stop button, so its state wouldn't be relevant to them.)

wernerhp commented 1 year ago

https://github.com/esphome/issues/issues/4788