Add Sensors for Airzone WebServer (#69748)

This commit is contained in:
Álvaro Fernández Rojas 2022-05-14 02:23:18 +02:00 committed by GitHub
parent 4ea6e5dfc0
commit e8a8d35289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 26 deletions

View file

@ -1,15 +1,24 @@
"""The sensor tests for the Airzone platform."""
from unittest.mock import AsyncMock
from homeassistant.core import HomeAssistant
from .util import async_init_integration
async def test_airzone_create_sensors(hass: HomeAssistant) -> None:
async def test_airzone_create_sensors(
hass: HomeAssistant, entity_registry_enabled_by_default: AsyncMock
) -> None:
"""Test creation of sensors."""
await async_init_integration(hass)
# WebServer
state = hass.states.get("sensor.webserver_rssi")
assert state.state == "-42"
# Zones
state = hass.states.get("sensor.despacho_temperature")
assert state.state == "21.2"

View file

@ -34,7 +34,6 @@ from aioairzone.const import (
API_WIFI_RSSI,
API_ZONE_ID,
)
from aioairzone.exceptions import InvalidMethod
from homeassistant.components.airzone import DOMAIN
from homeassistant.const import CONF_HOST, CONF_ID, CONF_PORT
@ -219,7 +218,7 @@ async def async_init_integration(
return_value=HVAC_SYSTEMS_MOCK,
), patch(
"homeassistant.components.airzone.AirzoneLocalApi.get_webserver",
side_effect=InvalidMethod,
return_value=HVAC_WEBSERVER_MOCK,
):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()