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
4 changes: 2 additions & 2 deletions homeassistant/components/zha/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
)
from .core.group import GroupMember
from .core.helpers import (
async_input_cluster_exists,
async_cluster_exists,
async_is_bindable_target,
convert_install_code,
get_matched_clusters,
Expand Down Expand Up @@ -897,7 +897,7 @@ def custom_serializer(schema: Any) -> Any:

data = {"schemas": {}, "data": {}}
for section, schema in ZHA_CONFIG_SCHEMAS.items():
if section == ZHA_ALARM_OPTIONS and not async_input_cluster_exists(
if section == ZHA_ALARM_OPTIONS and not async_cluster_exists(
hass, IasAce.cluster_id
):
continue
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/zha/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,17 @@ def async_get_zha_config_value(config_entry, section, config_key, default):
)


def async_input_cluster_exists(hass, cluster_id):
def async_cluster_exists(hass, cluster_id):
"""Determine if a device containing the specified in cluster is paired."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
zha_devices = zha_gateway.devices.values()
for zha_device in zha_devices:
clusters_by_endpoint = zha_device.async_get_clusters()
for clusters in clusters_by_endpoint.values():
if cluster_id in clusters[CLUSTER_TYPE_IN]:
if (
cluster_id in clusters[CLUSTER_TYPE_IN]
or cluster_id in clusters[CLUSTER_TYPE_OUT]
):
return True
return False

Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/zha/core/registries.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
}

SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = {
zcl.clusters.general.OnOff.cluster_id: BINARY_SENSOR
zcl.clusters.general.OnOff.cluster_id: BINARY_SENSOR,
zcl.clusters.security.IasAce.cluster_id: ALARM,
}

BINDABLE_CLUSTERS = SetRegistry()
Expand Down