Fixed issue #767 Operation mode influence between different thermostats (#771)

* Fixed issue #767 Operation mode influence between different thermostats

* Capitalised Operation to be consistent with the rest of controls
This commit is contained in:
Marius 2017-12-31 13:50:01 +02:00 committed by Andrey
parent bdea42f0b7
commit 5728d8ad1b

View File

@ -147,10 +147,11 @@
<div class='container-operation_list'>
<div class='controls'>
<paper-dropdown-menu label-float dynamic-align label='Operation'>
<paper-dropdown-menu class='capitalize' label-float dynamic-align label='Operation'>
<paper-listbox slot="dropdown-content" selected="{{operationIndex}}">
<template is='dom-repeat'
items='[[stateObj.attributes.operation_list]]'>
items='[[stateObj.attributes.operation_list]]'
on-dom-change='handleOperationListUpdate'>
<paper-item class="capitalize">[[item]]</paper-item>
</template>
</paper-listbox>
@ -256,13 +257,6 @@ class MoreInfoClimate extends window.hassMixins.EventsMixin(Polymer.Element) {
this.fanIndex = -1;
}
if (newVal.attributes.operation_list) {
this.operationIndex =
newVal.attributes.operation_list.indexOf(newVal.attributes.operation_mode);
} else {
this.operationIndex = -1;
}
if (newVal.attributes.swing_list) {
this.swingIndex = newVal.attributes.swing_list.indexOf(newVal.attributes.swing_mode);
} else {
@ -276,6 +270,17 @@ class MoreInfoClimate extends window.hassMixins.EventsMixin(Polymer.Element) {
}
}
handleOperationListUpdate() {
// force polymer to recognize selected item change (to update actual label)
this.operationIndex = -1;
if (this.stateObj.attributes.operation_list) {
this.operationIndex =
this.stateObj.attributes.operation_list.indexOf(this.stateObj.attributes.operation_mode);
} else {
this.operationIndex = -1;
}
}
computeTemperatureStepSize(stateObj) {
if (stateObj.attributes.target_temp_step) {
return stateObj.attributes.target_temp_step;