Skip to content

Commit

Permalink
Clean up blebox climate (#36143)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetmobile committed May 26, 2020
1 parent 26fdb8e commit dc2fe66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions homeassistant/components/blebox/climate.py
@@ -1,6 +1,6 @@
"""BleBox climate entity."""

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
Expand All @@ -22,7 +22,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)


class BleBoxClimateEntity(BleBoxEntity, ClimateDevice):
class BleBoxClimateEntity(BleBoxEntity, ClimateEntity):
"""Representation of a BleBox climate feature (saunaBox)."""

@property
Expand Down Expand Up @@ -81,9 +81,10 @@ def target_temperature(self):
async def async_set_hvac_mode(self, hvac_mode):
"""Set the climate entity mode."""
if hvac_mode == HVAC_MODE_HEAT:
return await self._feature.async_on()
await self._feature.async_on()
return

return await self._feature.async_off()
await self._feature.async_off()

async def async_set_temperature(self, **kwargs):
"""Set the thermostat temperature."""
Expand Down
3 changes: 3 additions & 0 deletions tests/components/blebox/test_climate.py
Expand Up @@ -135,6 +135,7 @@ def turn_on():
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_HEAT},
blocking=True,
)
feature_mock.async_off.assert_not_called()
state = hass.states.get(entity_id)

assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_HEAT
Expand Down Expand Up @@ -169,6 +170,7 @@ def turn_on():
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_HEAT},
blocking=True,
)
feature_mock.async_off.assert_not_called()
state = hass.states.get(entity_id)

assert state.attributes[ATTR_TEMPERATURE] == 23.4
Expand Down Expand Up @@ -203,6 +205,7 @@ def turn_off():
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_OFF},
blocking=True,
)
feature_mock.async_on.assert_not_called()
state = hass.states.get(entity_id)

assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
Expand Down

0 comments on commit dc2fe66

Please sign in to comment.