Check all endpoints for zwave_js.climate fan mode and operating state (#48800)

* Check all endpoints for zwave_js.climate fan mode and operating state

* fix test
This commit is contained in:
Raman Gupta 2021-04-08 10:53:20 -04:00 committed by GitHub
parent f1c4072d3c
commit 2768f202b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1096 additions and 730 deletions

View File

@ -169,11 +169,13 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
THERMOSTAT_MODE_PROPERTY, THERMOSTAT_MODE_PROPERTY,
CommandClass.THERMOSTAT_FAN_MODE, CommandClass.THERMOSTAT_FAN_MODE,
add_to_watched_value_ids=True, add_to_watched_value_ids=True,
check_all_endpoints=True,
) )
self._fan_state = self.get_zwave_value( self._fan_state = self.get_zwave_value(
THERMOSTAT_OPERATING_STATE_PROPERTY, THERMOSTAT_OPERATING_STATE_PROPERTY,
CommandClass.THERMOSTAT_FAN_STATE, CommandClass.THERMOSTAT_FAN_STATE,
add_to_watched_value_ids=True, add_to_watched_value_ids=True,
check_all_endpoints=True,
) )
self._set_modes_and_presets() self._set_modes_and_presets()
self._supported_features = 0 self._supported_features = 0

View File

@ -348,7 +348,9 @@ async def test_thermostat_different_endpoints(
"""Test an entity with values on a different endpoint from the primary value.""" """Test an entity with values on a different endpoint from the primary value."""
state = hass.states.get(CLIMATE_RADIO_THERMOSTAT_ENTITY) state = hass.states.get(CLIMATE_RADIO_THERMOSTAT_ENTITY)
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 22.5 assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 22.8
assert state.attributes[ATTR_FAN_MODE] == "Auto low"
assert state.attributes[ATTR_FAN_STATE] == "Idle / off"
async def test_setpoint_thermostat(hass, client, climate_danfoss_lc_13, integration): async def test_setpoint_thermostat(hass, client, climate_danfoss_lc_13, integration):

View File

@ -495,7 +495,7 @@ async def test_poll_value(
assert args["valueId"] == { assert args["valueId"] == {
"commandClassName": "Thermostat Mode", "commandClassName": "Thermostat Mode",
"commandClass": 64, "commandClass": 64,
"endpoint": 0, "endpoint": 1,
"property": "mode", "property": "mode",
"propertyName": "mode", "propertyName": "mode",
"metadata": { "metadata": {
@ -503,19 +503,16 @@ async def test_poll_value(
"readable": True, "readable": True,
"writeable": True, "writeable": True,
"min": 0, "min": 0,
"max": 31, "max": 255,
"label": "Thermostat mode", "label": "Thermostat mode",
"states": { "states": {
"0": "Off", "0": "Off",
"1": "Heat", "1": "Heat",
"2": "Cool", "2": "Cool",
"3": "Auto",
"11": "Energy heat",
"12": "Energy cool",
}, },
}, },
"value": 1, "value": 2,
"ccVersion": 2, "ccVersion": 0,
} }
client.async_send_command.reset_mock() client.async_send_command.reset_mock()
@ -531,7 +528,7 @@ async def test_poll_value(
}, },
blocking=True, blocking=True,
) )
assert len(client.async_send_command.call_args_list) == 8 assert len(client.async_send_command.call_args_list) == 7
# Test polling against an invalid entity raises ValueError # Test polling against an invalid entity raises ValueError
with pytest.raises(ValueError): with pytest.raises(ValueError):