Update fan direction (#3547)

* Handle current_direction in more-info-fan

* remove current_direction changes

* add forward/reverse to translations
This commit is contained in:
Ian Richardson 2019-08-30 19:29:17 -05:00 committed by Paulus Schoutsen
parent 15a88385c2
commit a7fdbc069b
2 changed files with 13 additions and 11 deletions

View File

@ -81,15 +81,15 @@ class MoreInfoFan extends LocalizeMixin(EventsMixin(PolymerElement)) {
<div>[[localize('ui.card.fan.direction')]]</div> <div>[[localize('ui.card.fan.direction')]]</div>
<paper-icon-button <paper-icon-button
icon="hass:rotate-left" icon="hass:rotate-left"
on-click="onDirectionLeft" on-click="onDirectionReverse"
title="Left" title="[[localize('ui.card.fan.reverse')]]"
disabled="[[computeIsRotatingLeft(stateObj)]]" disabled="[[computeIsRotatingReverse(stateObj)]]"
></paper-icon-button> ></paper-icon-button>
<paper-icon-button <paper-icon-button
icon="hass:rotate-right" icon="hass:rotate-right"
on-click="onDirectionRight" on-click="onDirectionForward"
title="Right" title="[[localize('ui.card.fan.forward')]]"
disabled="[[computeIsRotatingRight(stateObj)]]" disabled="[[computeIsRotatingForward(stateObj)]]"
></paper-icon-button> ></paper-icon-button>
</div> </div>
</div> </div>
@ -164,25 +164,25 @@ class MoreInfoFan extends LocalizeMixin(EventsMixin(PolymerElement)) {
}); });
} }
onDirectionLeft() { onDirectionReverse() {
this.hass.callService("fan", "set_direction", { this.hass.callService("fan", "set_direction", {
entity_id: this.stateObj.entity_id, entity_id: this.stateObj.entity_id,
direction: "reverse", direction: "reverse",
}); });
} }
onDirectionRight() { onDirectionForward() {
this.hass.callService("fan", "set_direction", { this.hass.callService("fan", "set_direction", {
entity_id: this.stateObj.entity_id, entity_id: this.stateObj.entity_id,
direction: "forward", direction: "forward",
}); });
} }
computeIsRotatingLeft(stateObj) { computeIsRotatingReverse(stateObj) {
return stateObj.attributes.direction === "reverse"; return stateObj.attributes.direction === "reverse";
} }
computeIsRotatingRight(stateObj) { computeIsRotatingForward(stateObj) {
return stateObj.attributes.direction === "forward"; return stateObj.attributes.direction === "forward";
} }
} }

View File

@ -416,7 +416,9 @@
"fan": { "fan": {
"speed": "Speed", "speed": "Speed",
"oscillate": "Oscillate", "oscillate": "Oscillate",
"direction": "Direction" "direction": "Direction",
"forward": "Forward",
"reverse": "Reverse"
}, },
"light": { "light": {
"brightness": "Brightness", "brightness": "Brightness",