mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Add Airzone Cloud Zone running binary sensor (#95606)
This commit is contained in:
parent
ea160c2bad
commit
60e2ee86b2
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Final
|
from typing import Any, Final
|
||||||
|
|
||||||
from aioairzone_cloud.const import AZD_PROBLEMS, AZD_WARNINGS, AZD_ZONES
|
from aioairzone_cloud.const import AZD_ACTIVE, AZD_PROBLEMS, AZD_WARNINGS, AZD_ZONES
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDeviceClass,
|
BinarySensorDeviceClass,
|
||||||
@ -29,6 +29,10 @@ class AirzoneBinarySensorEntityDescription(BinarySensorEntityDescription):
|
|||||||
|
|
||||||
|
|
||||||
ZONE_BINARY_SENSOR_TYPES: Final[tuple[AirzoneBinarySensorEntityDescription, ...]] = (
|
ZONE_BINARY_SENSOR_TYPES: Final[tuple[AirzoneBinarySensorEntityDescription, ...]] = (
|
||||||
|
AirzoneBinarySensorEntityDescription(
|
||||||
|
device_class=BinarySensorDeviceClass.RUNNING,
|
||||||
|
key=AZD_ACTIVE,
|
||||||
|
),
|
||||||
AirzoneBinarySensorEntityDescription(
|
AirzoneBinarySensorEntityDescription(
|
||||||
attributes={
|
attributes={
|
||||||
"warnings": AZD_WARNINGS,
|
"warnings": AZD_WARNINGS,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""The binary sensor tests for the Airzone Cloud platform."""
|
"""The binary sensor tests for the Airzone Cloud platform."""
|
||||||
|
|
||||||
from homeassistant.const import STATE_OFF
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .util import async_init_integration
|
from .util import async_init_integration
|
||||||
@ -16,6 +16,12 @@ async def test_airzone_create_binary_sensors(hass: HomeAssistant) -> None:
|
|||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert state.attributes.get("warnings") is None
|
assert state.attributes.get("warnings") is None
|
||||||
|
|
||||||
|
state = hass.states.get("binary_sensor.dormitorio_running")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
state = hass.states.get("binary_sensor.salon_problem")
|
state = hass.states.get("binary_sensor.salon_problem")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert state.attributes.get("warnings") is None
|
assert state.attributes.get("warnings") is None
|
||||||
|
|
||||||
|
state = hass.states.get("binary_sensor.salon_running")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
@ -4,6 +4,7 @@ from typing import Any
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aioairzone_cloud.const import (
|
from aioairzone_cloud.const import (
|
||||||
|
API_ACTIVE,
|
||||||
API_AZ_AIDOO,
|
API_AZ_AIDOO,
|
||||||
API_AZ_SYSTEM,
|
API_AZ_SYSTEM,
|
||||||
API_AZ_ZONE,
|
API_AZ_ZONE,
|
||||||
@ -177,6 +178,7 @@ def mock_get_device_status(device: Device) -> dict[str, Any]:
|
|||||||
}
|
}
|
||||||
if device.get_id() == "zone2":
|
if device.get_id() == "zone2":
|
||||||
return {
|
return {
|
||||||
|
API_ACTIVE: False,
|
||||||
API_HUMIDITY: 24,
|
API_HUMIDITY: 24,
|
||||||
API_IS_CONNECTED: True,
|
API_IS_CONNECTED: True,
|
||||||
API_WS_CONNECTED: True,
|
API_WS_CONNECTED: True,
|
||||||
@ -187,6 +189,7 @@ def mock_get_device_status(device: Device) -> dict[str, Any]:
|
|||||||
API_WARNINGS: [],
|
API_WARNINGS: [],
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
API_ACTIVE: True,
|
||||||
API_HUMIDITY: 30,
|
API_HUMIDITY: 30,
|
||||||
API_IS_CONNECTED: True,
|
API_IS_CONNECTED: True,
|
||||||
API_WS_CONNECTED: True,
|
API_WS_CONNECTED: True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user