hass-core/tests/components/anova/test_sensor.py
Luke Lashley 22bc11f397
Convert Anova to cloud push (#109508)
* current state

* finish refactor

* Apply suggestions from code review

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* address MR comments

* Change to sensor setup to be listener based.

* remove assert for websocket handler

* added assert for log

* remove mixin

* fix linting

* fix merge change

* Add clarifying comment

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Address MR comments

* bump version and fix typing check

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-05-08 14:53:44 +02:00

46 lines
1.6 KiB
Python

"""Test the Anova sensors."""
import logging
from anova_wifi import AnovaApi
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
== "22.37"
)
assert hass.states.get("sensor.anova_precision_cooker_mode").state == "idle"
assert hass.states.get("sensor.anova_precision_cooker_state").state == "no_state"
assert (
hass.states.get("sensor.anova_precision_cooker_target_temperature").state
== "54.72"
)
assert (
hass.states.get("sensor.anova_precision_cooker_water_temperature").state
== "18.33"
)
assert (
hass.states.get("sensor.anova_precision_cooker_triac_temperature").state
== "36.04"
)
async def test_no_data_sensors(hass: HomeAssistant, anova_api_no_data: AnovaApi):
"""Test that if we have no data for the device, and we have not set it up previously, It is not immediately set up."""
await async_init_integration(hass)
assert hass.states.get("sensor.anova_precision_cooker_triac_temperature") is None