Update aioairzone to v0.6.1 (#93629)
This commit is contained in:
parent
e4c51d43f0
commit
94ad9643b5
6 changed files with 64 additions and 7 deletions
|
@ -7,6 +7,7 @@ from typing import Any
|
||||||
from aioairzone.const import (
|
from aioairzone.const import (
|
||||||
API_SYSTEM_ID,
|
API_SYSTEM_ID,
|
||||||
API_ZONE_ID,
|
API_ZONE_ID,
|
||||||
|
AZD_AVAILABLE,
|
||||||
AZD_FIRMWARE,
|
AZD_FIRMWARE,
|
||||||
AZD_FULL_NAME,
|
AZD_FULL_NAME,
|
||||||
AZD_ID,
|
AZD_ID,
|
||||||
|
@ -66,6 +67,11 @@ class AirzoneSystemEntity(AirzoneEntity):
|
||||||
)
|
)
|
||||||
self._attr_unique_id = entry.unique_id or entry.entry_id
|
self._attr_unique_id = entry.unique_id or entry.entry_id
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self) -> bool:
|
||||||
|
"""Return system availability."""
|
||||||
|
return super().available and self.get_airzone_value(AZD_AVAILABLE)
|
||||||
|
|
||||||
def get_airzone_value(self, key: str) -> Any:
|
def get_airzone_value(self, key: str) -> Any:
|
||||||
"""Return system value by key."""
|
"""Return system value by key."""
|
||||||
value = None
|
value = None
|
||||||
|
@ -130,6 +136,11 @@ class AirzoneZoneEntity(AirzoneEntity):
|
||||||
)
|
)
|
||||||
self._attr_unique_id = entry.unique_id or entry.entry_id
|
self._attr_unique_id = entry.unique_id or entry.entry_id
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self) -> bool:
|
||||||
|
"""Return zone availability."""
|
||||||
|
return super().available and self.get_airzone_value(AZD_AVAILABLE)
|
||||||
|
|
||||||
def get_airzone_value(self, key: str) -> Any:
|
def get_airzone_value(self, key: str) -> Any:
|
||||||
"""Return zone value by key."""
|
"""Return zone value by key."""
|
||||||
value = None
|
value = None
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
"documentation": "https://www.home-assistant.io/integrations/airzone",
|
"documentation": "https://www.home-assistant.io/integrations/airzone",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["aioairzone"],
|
"loggers": ["aioairzone"],
|
||||||
"requirements": ["aioairzone==0.5.6"]
|
"requirements": ["aioairzone==0.6.1"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ aioairq==0.2.4
|
||||||
aioairzone-cloud==0.1.6
|
aioairzone-cloud==0.1.6
|
||||||
|
|
||||||
# homeassistant.components.airzone
|
# homeassistant.components.airzone
|
||||||
aioairzone==0.5.6
|
aioairzone==0.6.1
|
||||||
|
|
||||||
# homeassistant.components.ambient_station
|
# homeassistant.components.ambient_station
|
||||||
aioambient==2023.04.0
|
aioambient==2023.04.0
|
||||||
|
|
|
@ -109,7 +109,7 @@ aioairq==0.2.4
|
||||||
aioairzone-cloud==0.1.6
|
aioairzone-cloud==0.1.6
|
||||||
|
|
||||||
# homeassistant.components.airzone
|
# homeassistant.components.airzone
|
||||||
aioairzone==0.5.6
|
aioairzone==0.6.1
|
||||||
|
|
||||||
# homeassistant.components.ambient_station
|
# homeassistant.components.ambient_station
|
||||||
aioambient==2023.04.0
|
aioambient==2023.04.0
|
||||||
|
|
|
@ -14,7 +14,6 @@ from aioairzone.const import (
|
||||||
AZD_SYSTEM,
|
AZD_SYSTEM,
|
||||||
AZD_SYSTEMS,
|
AZD_SYSTEMS,
|
||||||
AZD_ZONES,
|
AZD_ZONES,
|
||||||
AZD_ZONES_NUM,
|
|
||||||
RAW_HVAC,
|
RAW_HVAC,
|
||||||
RAW_VERSION,
|
RAW_VERSION,
|
||||||
RAW_WEBSERVER,
|
RAW_WEBSERVER,
|
||||||
|
@ -93,7 +92,6 @@ async def test_config_entry_diagnostics(
|
||||||
diag["coord_data"][AZD_SYSTEMS]["1"].items()
|
diag["coord_data"][AZD_SYSTEMS]["1"].items()
|
||||||
>= {
|
>= {
|
||||||
AZD_ID: 1,
|
AZD_ID: 1,
|
||||||
AZD_ZONES_NUM: 5,
|
|
||||||
}.items()
|
}.items()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
"""The sensor tests for the Airzone platform."""
|
"""The sensor tests for the Airzone platform."""
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from unittest.mock import patch
|
||||||
|
|
||||||
from .util import async_init_integration
|
from aioairzone.const import API_DATA, API_SYSTEMS
|
||||||
|
|
||||||
|
from homeassistant.components.airzone.coordinator import SCAN_INTERVAL
|
||||||
|
from homeassistant.const import STATE_UNAVAILABLE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
|
from .util import (
|
||||||
|
HVAC_MOCK,
|
||||||
|
HVAC_SYSTEMS_MOCK,
|
||||||
|
HVAC_VERSION_MOCK,
|
||||||
|
HVAC_WEBSERVER_MOCK,
|
||||||
|
async_init_integration,
|
||||||
|
)
|
||||||
|
|
||||||
|
from tests.common import async_fire_time_changed
|
||||||
|
|
||||||
|
|
||||||
async def test_airzone_create_sensors(
|
async def test_airzone_create_sensors(
|
||||||
|
@ -58,3 +73,36 @@ async def test_airzone_create_sensors(
|
||||||
|
|
||||||
state = hass.states.get("sensor.dkn_plus_humidity")
|
state = hass.states.get("sensor.dkn_plus_humidity")
|
||||||
assert state is None
|
assert state is None
|
||||||
|
|
||||||
|
|
||||||
|
async def test_airzone_sensors_availability(
|
||||||
|
hass: HomeAssistant, entity_registry_enabled_by_default: None
|
||||||
|
) -> None:
|
||||||
|
"""Test sensors availability."""
|
||||||
|
|
||||||
|
await async_init_integration(hass)
|
||||||
|
|
||||||
|
HVAC_MOCK_UNAVAILABLE_ZONE = {**HVAC_MOCK}
|
||||||
|
del HVAC_MOCK_UNAVAILABLE_ZONE[API_SYSTEMS][0][API_DATA][1]
|
||||||
|
|
||||||
|
with patch(
|
||||||
|
"homeassistant.components.airzone.AirzoneLocalApi.get_hvac",
|
||||||
|
return_value=HVAC_MOCK_UNAVAILABLE_ZONE,
|
||||||
|
), patch(
|
||||||
|
"homeassistant.components.airzone.AirzoneLocalApi.get_hvac_systems",
|
||||||
|
return_value=HVAC_SYSTEMS_MOCK,
|
||||||
|
), patch(
|
||||||
|
"homeassistant.components.airzone.AirzoneLocalApi.get_version",
|
||||||
|
return_value=HVAC_VERSION_MOCK,
|
||||||
|
), patch(
|
||||||
|
"homeassistant.components.airzone.AirzoneLocalApi.get_webserver",
|
||||||
|
return_value=HVAC_WEBSERVER_MOCK,
|
||||||
|
):
|
||||||
|
async_fire_time_changed(hass, utcnow() + SCAN_INTERVAL)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
state = hass.states.get("sensor.dorm_ppal_temperature")
|
||||||
|
assert state.state == STATE_UNAVAILABLE
|
||||||
|
|
||||||
|
state = hass.states.get("sensor.dorm_ppal_humidity")
|
||||||
|
assert state.state == STATE_UNAVAILABLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue