Use horizontal control icons for devices that commonly move horizontally (#5309)

* Use horizontal control icons for devices that
commonly move horizontally including:

awning
curtain
gate

* no need to check

* remove debug

* reduce - js is so permissive

* remove curtain
This commit is contained in:
J. Nick Koston 2020-03-23 14:33:45 -05:00 committed by GitHub
parent ce92add096
commit 3763d7a1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ class HaCoverControls extends PolymerElement {
<div class="state">
<paper-icon-button
aria-label="Open cover"
icon="hass:arrow-up"
icon="[[computeOpenIcon(stateObj)]]"
on-click="onOpenTap"
invisible$="[[!entityObj.supportsOpen]]"
disabled="[[computeOpenDisabled(stateObj, entityObj)]]"
@ -32,7 +32,7 @@ class HaCoverControls extends PolymerElement {
></paper-icon-button>
<paper-icon-button
aria-label="Close cover"
icon="hass:arrow-down"
icon="[[computeCloseIcon(stateObj)]]"
on-click="onCloseTap"
invisible$="[[!entityObj.supportsClose]]"
disabled="[[computeClosedDisabled(stateObj, entityObj)]]"
@ -60,6 +60,26 @@ class HaCoverControls extends PolymerElement {
return new CoverEntity(hass, stateObj);
}
computeOpenIcon(stateObj) {
switch (stateObj.attributes.device_class) {
case "awning":
case "gate":
return "hass:arrow-expand-horizontal";
default:
return "hass:arrow-up";
}
}
computeCloseIcon(stateObj) {
switch (stateObj.attributes.device_class) {
case "awning":
case "gate":
return "hass:arrow-collapse-horizontal";
default:
return "hass:arrow-down";
}
}
computeOpenDisabled(stateObj, entityObj) {
var assumedState = stateObj.attributes.assumed_state === true;
return (entityObj.isFullyOpen || entityObj.isOpening) && !assumedState;