Files
homeassistant-core/tests/components/anova/test_sensor.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.6 KiB
Python
Raw Normal View History

2023-04-22 19:05:14 -04:00
"""Test the Anova sensors."""
import logging
2024-05-08 08:53:44 -04:00
from anova_wifi import AnovaApi
import pytest
2023-04-22 19:05:14 -04:00
from homeassistant.core import HomeAssistant
from . import async_init_integration
LOGGER = logging.getLogger(__name__)
async def test_sensors(hass: HomeAssistant, anova_api: AnovaApi) -> None:
"""Test setting up creates the sensors."""
await async_init_integration(hass)
assert len(hass.states.async_all("sensor")) == 8
assert (
hass.states.get("sensor.anova_precision_cooker_cook_time_remaining").state
== "0"
)
assert hass.states.get("sensor.anova_precision_cooker_cook_time").state == "0"
assert (
hass.states.get("sensor.anova_precision_cooker_heater_temperature").state
2024-05-08 08:53:44 -04:00
== "22.37"
2023-04-22 19:05:14 -04:00
)
2024-05-08 08:53:44 -04:00
assert hass.states.get("sensor.anova_precision_cooker_mode").state == "idle"
assert hass.states.get("sensor.anova_precision_cooker_state").state == "no_state"
2023-04-22 19:05:14 -04:00
assert (
hass.states.get("sensor.anova_precision_cooker_target_temperature").state
2024-05-08 08:53:44 -04:00
== "54.72"
2023-04-22 19:05:14 -04:00
)
assert (
hass.states.get("sensor.anova_precision_cooker_water_temperature").state
2024-05-08 08:53:44 -04:00
== "18.33"
2023-04-22 19:05:14 -04:00
)
assert (
hass.states.get("sensor.anova_precision_cooker_triac_temperature").state
2024-05-08 08:53:44 -04:00
== "36.04"
2023-04-22 19:05:14 -04:00
)
@pytest.mark.usefixtures("anova_api_no_data")
async def test_no_data_sensors(hass: HomeAssistant) -> None:
2024-05-08 08:53:44 -04:00
"""Test that if we have no data for the device, and we have not set it up previously, It is not immediately set up."""
2023-04-22 19:05:14 -04:00
await async_init_integration(hass)
2024-05-08 08:53:44 -04:00
assert hass.states.get("sensor.anova_precision_cooker_triac_temperature") is None