Clean up blebox climate (#36143)
This commit is contained in:
parent
26fdb8eb1e
commit
dc2fe66f29
2 changed files with 8 additions and 4 deletions
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -81,9 +81,10 @@ class BleBoxClimateEntity(BleBoxEntity, ClimateDevice):
|
|||
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."""
|
||||
|
|
|
@ -135,6 +135,7 @@ async def test_on_when_below_desired(saunabox, hass, config):
|
|||
{"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
|
||||
|
@ -169,6 +170,7 @@ async def test_on_when_above_desired(saunabox, hass, config):
|
|||
{"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
|
||||
|
@ -203,6 +205,7 @@ async def test_off(saunabox, hass, config):
|
|||
{"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
|
||||
|
|
Loading…
Add table
Reference in a new issue