mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 12:56:37 +00:00
Added support for humidity display in the climate state (#838)
This commit is contained in:
parent
d21c1bc615
commit
c11a525a2d
@ -21,12 +21,11 @@
|
|||||||
<span class="state-label">
|
<span class="state-label">
|
||||||
[[stateObj.state]]
|
[[stateObj.state]]
|
||||||
</span>
|
</span>
|
||||||
[[computeTargetTemperature(stateObj)]]
|
[[computeTarget(stateObj)]]
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='current'>
|
<div class='current'>
|
||||||
Currently: [[stateObj.attributes.current_temperature]]
|
Currently: [[computeCurrentStatus(stateObj)]]
|
||||||
[[stateObj.attributes.unit_of_measurement]]
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
@ -41,12 +40,27 @@ class HaClimateState extends Polymer.Element {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
computeTargetTemperature(stateObj) {
|
computeCurrentStatus(stateObj) {
|
||||||
|
if (stateObj.attributes.current_temperature) {
|
||||||
|
return `${stateObj.attributes.current_temperature} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
|
} else if (stateObj.attributes.current_humidity) {
|
||||||
|
return `${stateObj.attributes.current_humidity} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
computeTarget(stateObj) {
|
||||||
if (stateObj.attributes.target_temp_low &&
|
if (stateObj.attributes.target_temp_low &&
|
||||||
stateObj.attributes.target_temp_high) {
|
stateObj.attributes.target_temp_high) {
|
||||||
return `${stateObj.attributes.target_temp_low} - ${stateObj.attributes.target_temp_high} ${stateObj.attributes.unit_of_measurement}`;
|
return `${stateObj.attributes.target_temp_low} - ${stateObj.attributes.target_temp_high} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
} else if (stateObj.attributes.temperature) {
|
} else if (stateObj.attributes.temperature) {
|
||||||
return `${stateObj.attributes.temperature} ${stateObj.attributes.unit_of_measurement}`;
|
return `${stateObj.attributes.temperature} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
|
} else if (stateObj.attributes.target_humidity_low &&
|
||||||
|
stateObj.attributes.target_humidity_high) {
|
||||||
|
return `${stateObj.attributes.target_humidity_low} - ${stateObj.attributes.target_humidity_high} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
|
} else if (stateObj.attributes.humidity) {
|
||||||
|
return `${stateObj.attributes.humidity} ${stateObj.attributes.unit_of_measurement}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user