mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Clean up blebox climate (#36143)
This commit is contained in:
parent
26fdb8eb1e
commit
dc2fe66f29
@ -1,6 +1,6 @@
|
|||||||
"""BleBox climate entity."""
|
"""BleBox climate entity."""
|
||||||
|
|
||||||
from homeassistant.components.climate import ClimateDevice
|
from homeassistant.components.climate import ClimateEntity
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
CURRENT_HVAC_IDLE,
|
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)."""
|
"""Representation of a BleBox climate feature (saunaBox)."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -81,9 +81,10 @@ class BleBoxClimateEntity(BleBoxEntity, ClimateDevice):
|
|||||||
async def async_set_hvac_mode(self, hvac_mode):
|
async def async_set_hvac_mode(self, hvac_mode):
|
||||||
"""Set the climate entity mode."""
|
"""Set the climate entity mode."""
|
||||||
if hvac_mode == HVAC_MODE_HEAT:
|
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):
|
async def async_set_temperature(self, **kwargs):
|
||||||
"""Set the thermostat temperature."""
|
"""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},
|
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_HEAT},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
feature_mock.async_off.assert_not_called()
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
|
|
||||||
assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_HEAT
|
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},
|
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_HEAT},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
feature_mock.async_off.assert_not_called()
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
|
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 23.4
|
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},
|
{"entity_id": entity_id, ATTR_HVAC_MODE: HVAC_MODE_OFF},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
feature_mock.async_on.assert_not_called()
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
|
|
||||||
assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
assert state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user