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

View File

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

View File

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

View File

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

View File

@ -80,7 +80,7 @@ def mock_smile_adam():
return_value=True return_value=True
) )
smile_mock.return_value.single_master_thermostat.side_effect = Mock( 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( smile_mock.return_value.set_schedule_state.side_effect = AsyncMock(
return_value=True 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") state = hass.states.get("climate.zone_lisa_wk")
attrs = state.attributes attrs = state.attributes
assert attrs["hvac_modes"] is None assert attrs["hvac_modes"] == ["heat", "auto"]
assert "preset_modes" in attrs assert "preset_modes" in attrs
assert "no_frost" in attrs["preset_modes"] 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") state = hass.states.get("climate.zone_thermostat_jessie")
attrs = state.attributes attrs = state.attributes
assert attrs["hvac_modes"] is None assert attrs["hvac_modes"] == ["heat", "auto"]
assert "preset_modes" in attrs assert "preset_modes" in attrs
assert "no_frost" in attrs["preset_modes"] assert "no_frost" in attrs["preset_modes"]