mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Add Vallox cell state sensor tests (#67069)
This commit is contained in:
parent
f4c443ac86
commit
ced68c1b80
@ -1322,10 +1322,8 @@ omit =
|
|||||||
homeassistant/components/upc_connect/*
|
homeassistant/components/upc_connect/*
|
||||||
homeassistant/components/uscis/sensor.py
|
homeassistant/components/uscis/sensor.py
|
||||||
homeassistant/components/vallox/__init__.py
|
homeassistant/components/vallox/__init__.py
|
||||||
homeassistant/components/vallox/const.py
|
|
||||||
homeassistant/components/vallox/fan.py
|
homeassistant/components/vallox/fan.py
|
||||||
homeassistant/components/vallox/sensor.py
|
homeassistant/components/vallox/sensor.py
|
||||||
homeassistant/components/vallox/binary_sensor.py
|
|
||||||
homeassistant/components/vasttrafik/sensor.py
|
homeassistant/components/vasttrafik/sensor.py
|
||||||
homeassistant/components/velbus/__init__.py
|
homeassistant/components/velbus/__init__.py
|
||||||
homeassistant/components/velbus/binary_sensor.py
|
homeassistant/components/velbus/binary_sensor.py
|
||||||
|
@ -158,3 +158,88 @@ async def test_remaining_time_for_filter_in_the_past(
|
|||||||
mocked_filter_end_date,
|
mocked_filter_end_date,
|
||||||
_now_at_13(),
|
_now_at_13(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cell_state_sensor_heat_recovery(
|
||||||
|
mock_entry: MockConfigEntry, hass: HomeAssistant
|
||||||
|
):
|
||||||
|
"""Test cell state sensor in heat recovery state."""
|
||||||
|
# Arrange
|
||||||
|
metrics = {"A_CYC_CELL_STATE": 0}
|
||||||
|
|
||||||
|
# Act
|
||||||
|
with patch_metrics(metrics=metrics):
|
||||||
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
sensor = hass.states.get("sensor.vallox_cell_state")
|
||||||
|
assert sensor.state == "Heat Recovery"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cell_state_sensor_cool_recovery(
|
||||||
|
mock_entry: MockConfigEntry, hass: HomeAssistant
|
||||||
|
):
|
||||||
|
"""Test cell state sensor in cool recovery state."""
|
||||||
|
# Arrange
|
||||||
|
metrics = {"A_CYC_CELL_STATE": 1}
|
||||||
|
|
||||||
|
# Act
|
||||||
|
with patch_metrics(metrics=metrics):
|
||||||
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
sensor = hass.states.get("sensor.vallox_cell_state")
|
||||||
|
assert sensor.state == "Cool Recovery"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cell_state_sensor_bypass(
|
||||||
|
mock_entry: MockConfigEntry, hass: HomeAssistant
|
||||||
|
):
|
||||||
|
"""Test cell state sensor in bypass state."""
|
||||||
|
# Arrange
|
||||||
|
metrics = {"A_CYC_CELL_STATE": 2}
|
||||||
|
|
||||||
|
# Act
|
||||||
|
with patch_metrics(metrics=metrics):
|
||||||
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
sensor = hass.states.get("sensor.vallox_cell_state")
|
||||||
|
assert sensor.state == "Bypass"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cell_state_sensor_defrosting(
|
||||||
|
mock_entry: MockConfigEntry, hass: HomeAssistant
|
||||||
|
):
|
||||||
|
"""Test cell state sensor in defrosting state."""
|
||||||
|
# Arrange
|
||||||
|
metrics = {"A_CYC_CELL_STATE": 3}
|
||||||
|
|
||||||
|
# Act
|
||||||
|
with patch_metrics(metrics=metrics):
|
||||||
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
sensor = hass.states.get("sensor.vallox_cell_state")
|
||||||
|
assert sensor.state == "Defrosting"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cell_state_sensor_unknown_state(
|
||||||
|
mock_entry: MockConfigEntry, hass: HomeAssistant
|
||||||
|
):
|
||||||
|
"""Test cell state sensor in unknown state."""
|
||||||
|
# Arrange
|
||||||
|
metrics = {"A_CYC_CELL_STATE": 4}
|
||||||
|
|
||||||
|
# Act
|
||||||
|
with patch_metrics(metrics=metrics):
|
||||||
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
sensor = hass.states.get("sensor.vallox_cell_state")
|
||||||
|
assert sensor.state == "unknown"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user