Skip to content

Covers - Removed disable buttons #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 29, 2017
Merged

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Jul 25, 2017

Allow commands being send even if cover is open or closed. Important for cover template when using multiple covers or in end positions when cover registered as open/closed but isn't due to tolerance.

Example for multiple covers: home-assistant/home-assistant.io#3013

Allow commands being send even if cover is open or closed. Important for cover template when using multiple covers or in end positions when cover registered as open/closed but isn't due to tolerance.
@homeassistant
Copy link
Contributor

Hi @cdce8p,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@cdce8p cdce8p changed the title Removed disable buttons Covers - Removed disable buttons Jul 25, 2017
@andrey-git
Copy link
Contributor

I think the disabled buttons are nice.

I don't think the 1st reason is valid. A proper implementation would be using position_template to be an average or median of all the covers - then "all covers" would be half-open unless all covers are open/closed.

The 2nd reason is valid though, but maybe it should be configurable ;)

@cdce8p
Copy link
Member Author

cdce8p commented Jul 25, 2017

@andrey-git In my option the cover template is more a not ideal workaround for controlling more than one cover and the fix above would have been the easiest solution. I haven't jet tried the position_template, but my understanding thus far is that it would be vastly more complex.

I personally wouldn't mind having the buttons always enabled, that's why I proposed the change. I would certainly be ok with this being an option in the config. Another idea could be to also display the position next to the controls (also as an configurable).

I will see if I get this to work in the next few days and later maybe and own compontent to control multiple covers.

@balloob
Copy link
Member

balloob commented Jul 26, 2017

We should not remove the disabled state, it's a nice indicator on the state of the cover. We also should not decrease functionality for other platforms to add support for "a not ideal workaround for controlling more than one cover".

However, what would be fine is that when assumed_state is set to True, we don't disable any button.

<paper-icon-button icon="mdi:arrow-up" on-tap='onOpenTap'
invisible$='[[!entityObj.supportsOpen]]'></paper-icon-button>
</template>
<template is='dom-if' if='[[!entityObj.assumeState]]'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating the dom element - make a function that will decide whether the button should be disabled.

return this.stateObj.attributes.assumed_state === true;
});

addGetter('disableButtonFullyOpen', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not add these to the cover model as they are very specific to the component where they are used. They should be computed inside the component instead.

<paper-icon-button icon="mdi:stop" on-tap='onStopTap'
invisible$='[[!entityObj.supportsStop]]'></paper-icon-button>
<paper-icon-button icon="mdi:arrow-down" on-tap='onCloseTap'
invisible$='[[!entityObj.supportsClose]]'
disabled='[[entityObj.isFullyClosed]]'></paper-icon-button>
disabled='[[entityObj.disableButtonFullyClosed]]'></paper-icon-button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't add this to entityObj. Compute it in component instead: `disabled='[[computeCloseDisabled(stateObj, entityObj]]'

@balloob balloob merged commit 8787304 into home-assistant:master Jul 29, 2017
@balloob
Copy link
Member

balloob commented Jul 29, 2017

🎉 thanks

@cdce8p cdce8p deleted the patch-1 branch July 29, 2017 17:36
Landrash pushed a commit to home-assistant/home-assistant.io that referenced this pull request Jul 30, 2017
* Cover - Added doc customize 

Added `assume_state` to customize section. home-assistant/frontend#356

* Update cover.markdown
tkdrob pushed a commit to tkdrob/frontend that referenced this pull request Apr 20, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants