mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 20:36:35 +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">
|
||||
[[stateObj.state]]
|
||||
</span>
|
||||
[[computeTargetTemperature(stateObj)]]
|
||||
[[computeTarget(stateObj)]]
|
||||
</div>
|
||||
|
||||
<div class='current'>
|
||||
Currently: [[stateObj.attributes.current_temperature]]
|
||||
[[stateObj.attributes.unit_of_measurement]]
|
||||
Currently: [[computeCurrentStatus(stateObj)]]
|
||||
</div>
|
||||
</template>
|
||||
</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 &&
|
||||
stateObj.attributes.target_temp_high) {
|
||||
return `${stateObj.attributes.target_temp_low} - ${stateObj.attributes.target_temp_high} ${stateObj.attributes.unit_of_measurement}`;
|
||||
} else if (stateObj.attributes.temperature) {
|
||||
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 '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user