Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion homeassistant/components/airzone_cloud/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
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 (
BinarySensorDeviceClass,
Expand All @@ -29,6 +29,10 @@ class AirzoneBinarySensorEntityDescription(BinarySensorEntityDescription):


ZONE_BINARY_SENSOR_TYPES: Final[tuple[AirzoneBinarySensorEntityDescription, ...]] = (
AirzoneBinarySensorEntityDescription(
device_class=BinarySensorDeviceClass.RUNNING,
key=AZD_ACTIVE,
),
AirzoneBinarySensorEntityDescription(
attributes={
"warnings": AZD_WARNINGS,
Expand Down
8 changes: 7 additions & 1 deletion tests/components/airzone_cloud/test_binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""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 .util import async_init_integration
Expand All @@ -16,6 +16,12 @@ async def test_airzone_create_binary_sensors(hass: HomeAssistant) -> None:
assert state.state == STATE_OFF
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")
assert state.state == STATE_OFF
assert state.attributes.get("warnings") is None

state = hass.states.get("binary_sensor.salon_running")
assert state.state == STATE_ON
3 changes: 3 additions & 0 deletions tests/components/airzone_cloud/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from unittest.mock import patch

from aioairzone_cloud.const import (
API_ACTIVE,
API_AZ_AIDOO,
API_AZ_SYSTEM,
API_AZ_ZONE,
Expand Down Expand Up @@ -177,6 +178,7 @@ def mock_get_device_status(device: Device) -> dict[str, Any]:
}
if device.get_id() == "zone2":
return {
API_ACTIVE: False,
API_HUMIDITY: 24,
API_IS_CONNECTED: True,
API_WS_CONNECTED: True,
Expand All @@ -187,6 +189,7 @@ def mock_get_device_status(device: Device) -> dict[str, Any]:
API_WARNINGS: [],
}
return {
API_ACTIVE: True,
API_HUMIDITY: 30,
API_IS_CONNECTED: True,
API_WS_CONNECTED: True,
Expand Down