Allow climate platforms to specify temperature step (#270)

* Allow climate platforms to specify temperature step

* Update more-info-climate.html
This commit is contained in:
Andrey 2017-04-30 21:46:35 +03:00 committed by Paulus Schoutsen
parent fe0aa77749
commit 928be4eed5

View File

@ -102,7 +102,7 @@
<ha-climate-control <ha-climate-control
value='[[stateObj.attributes.temperature]]' value='[[stateObj.attributes.temperature]]'
units='[[stateObj.attributes.unit_of_measurement]]' units='[[stateObj.attributes.unit_of_measurement]]'
step='[[computeTemperatureStepSize(stateObj.attributes.unit_of_measurement)]]' step='[[computeTemperatureStepSize(stateObj)]]'
min='[[stateObj.attributes.min_temp]]' min='[[stateObj.attributes.min_temp]]'
max='[[stateObj.attributes.max_temp]]' max='[[stateObj.attributes.max_temp]]'
on-change='targetTemperatureChanged' on-change='targetTemperatureChanged'
@ -257,8 +257,10 @@ Polymer({
} }
}, },
computeTemperatureStepSize: function (units) { computeTemperatureStepSize: function (stateObj) {
if (units.indexOf('F') !== -1) { if (stateObj.attributes.target_temp_step) {
return stateObj.attributes.target_temp_step;
} else if (stateObj.attributes.unit_of_measurement.indexOf('F') !== -1) {
return 1; return 1;
} }
return 0.5; return 0.5;