Add current humidity to zwave_js climate platform (#45857)
This commit is contained in:
parent
3ef7bd6b73
commit
8d9b66e23d
2 changed files with 13 additions and 0 deletions
|
@ -142,6 +142,12 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
|
||||||
add_to_watched_value_ids=True,
|
add_to_watched_value_ids=True,
|
||||||
check_all_endpoints=True,
|
check_all_endpoints=True,
|
||||||
)
|
)
|
||||||
|
self._current_humidity = self.get_zwave_value(
|
||||||
|
"Humidity",
|
||||||
|
command_class=CommandClass.SENSOR_MULTILEVEL,
|
||||||
|
add_to_watched_value_ids=True,
|
||||||
|
check_all_endpoints=True,
|
||||||
|
)
|
||||||
self._set_modes_and_presets()
|
self._set_modes_and_presets()
|
||||||
|
|
||||||
def _setpoint_value(self, setpoint_type: ThermostatSetpointType) -> ZwaveValue:
|
def _setpoint_value(self, setpoint_type: ThermostatSetpointType) -> ZwaveValue:
|
||||||
|
@ -207,6 +213,11 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
|
||||||
return None
|
return None
|
||||||
return HVAC_CURRENT_MAP.get(int(self._operating_state.value))
|
return HVAC_CURRENT_MAP.get(int(self._operating_state.value))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_humidity(self) -> Optional[int]:
|
||||||
|
"""Return the current humidity level."""
|
||||||
|
return self._current_humidity.value if self._current_humidity else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> Optional[float]:
|
def current_temperature(self) -> Optional[float]:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
||||||
from zwave_js_server.event import Event
|
from zwave_js_server.event import Event
|
||||||
|
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
|
ATTR_CURRENT_HUMIDITY,
|
||||||
ATTR_CURRENT_TEMPERATURE,
|
ATTR_CURRENT_TEMPERATURE,
|
||||||
ATTR_HVAC_ACTION,
|
ATTR_HVAC_ACTION,
|
||||||
ATTR_HVAC_MODE,
|
ATTR_HVAC_MODE,
|
||||||
|
@ -42,6 +43,7 @@ async def test_thermostat_v2(
|
||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
HVAC_MODE_HEAT_COOL,
|
HVAC_MODE_HEAT_COOL,
|
||||||
]
|
]
|
||||||
|
assert state.attributes[ATTR_CURRENT_HUMIDITY] == 30
|
||||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 22.2
|
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 22.2
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 22.2
|
assert state.attributes[ATTR_TEMPERATURE] == 22.2
|
||||||
assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue