Fix Plugwise hvac action and mode (#41550)

This commit is contained in:
Tom 2020-10-15 16:59:02 +02:00 committed by GitHub
parent 2074da4f9f
commit 368bc0c34b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 18 deletions

View file

@ -114,10 +114,9 @@ class PwThermostat(SmileGateway, ClimateEntity):
if self._cooling_state:
return CURRENT_HVAC_COOL
return CURRENT_HVAC_IDLE
if self._heating_state is not None:
if self._setpoint > self._temperature:
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE
if self._setpoint > self._temperature:
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE
@property
def supported_features(self):
@ -142,10 +141,9 @@ class PwThermostat(SmileGateway, ClimateEntity):
@property
def hvac_modes(self):
"""Return the available hvac modes list."""
if self._heating_state is not None:
if self._compressor_state is not None:
return HVAC_MODES_HEAT_COOL
return HVAC_MODES_HEAT_ONLY
if self._compressor_state is not None:
return HVAC_MODES_HEAT_COOL
return HVAC_MODES_HEAT_ONLY
@property
def hvac_mode(self):
@ -263,11 +261,11 @@ class PwThermostat(SmileGateway, ClimateEntity):
if heater_central_data.get("compressor_state") is not None:
self._compressor_state = heater_central_data["compressor_state"]
self._hvac_mode = HVAC_MODE_HEAT
if self._compressor_state is not None:
self._hvac_mode = HVAC_MODE_HEAT_COOL
if self._schema_status:
self._hvac_mode = HVAC_MODE_AUTO
elif self._heating_state is not None:
self._hvac_mode = HVAC_MODE_HEAT
if self._compressor_state is not None:
self._hvac_mode = HVAC_MODE_HEAT_COOL
self.async_write_ha_state()

View file

@ -2,7 +2,7 @@
"domain": "plugwise",
"name": "Plugwise",
"documentation": "https://www.home-assistant.io/integrations/plugwise",
"requirements": ["Plugwise_Smile==1.5.1"],
"requirements": ["Plugwise_Smile==1.6.0"],
"codeowners": ["@CoMPaTech", "@bouwew"],
"zeroconf": ["_plugwise._tcp.local."],
"config_flow": true

View file

@ -26,7 +26,7 @@ Mastodon.py==1.5.1
OPi.GPIO==0.4.0
# homeassistant.components.plugwise
Plugwise_Smile==1.5.1
Plugwise_Smile==1.6.0
# homeassistant.components.essent
PyEssent==0.13

View file

@ -7,7 +7,7 @@
HAP-python==3.0.0
# homeassistant.components.plugwise
Plugwise_Smile==1.5.1
Plugwise_Smile==1.6.0
# homeassistant.components.flick_electric
PyFlick==0.0.2

View file

@ -80,7 +80,7 @@ def mock_smile_adam():
return_value=True
)
smile_mock.return_value.single_master_thermostat.side_effect = Mock(
return_value=True
return_value=False
)
smile_mock.return_value.set_schedule_state.side_effect = AsyncMock(
return_value=True

View file

@ -13,7 +13,7 @@ async def test_adam_climate_entity_attributes(hass, mock_smile_adam):
state = hass.states.get("climate.zone_lisa_wk")
attrs = state.attributes
assert attrs["hvac_modes"] is None
assert attrs["hvac_modes"] == ["heat", "auto"]
assert "preset_modes" in attrs
assert "no_frost" in attrs["preset_modes"]
@ -29,7 +29,7 @@ async def test_adam_climate_entity_attributes(hass, mock_smile_adam):
state = hass.states.get("climate.zone_thermostat_jessie")
attrs = state.attributes
assert attrs["hvac_modes"] is None
assert attrs["hvac_modes"] == ["heat", "auto"]
assert "preset_modes" in attrs
assert "no_frost" in attrs["preset_modes"]