support more alarm panels (#50235)

pull/50639/head
David F. Mulcahey 2021-05-07 08:31:16 -04:00 committed by GitHub
parent 17fc962a87
commit 55050bdd2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -61,7 +61,7 @@ from .core.const import (
) )
from .core.group import GroupMember from .core.group import GroupMember
from .core.helpers import ( from .core.helpers import (
async_input_cluster_exists, async_cluster_exists,
async_is_bindable_target, async_is_bindable_target,
convert_install_code, convert_install_code,
get_matched_clusters, get_matched_clusters,
@ -897,7 +897,7 @@ async def websocket_get_configuration(hass, connection, msg):
data = {"schemas": {}, "data": {}} data = {"schemas": {}, "data": {}}
for section, schema in ZHA_CONFIG_SCHEMAS.items(): 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 hass, IasAce.cluster_id
): ):
continue continue

View File

@ -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.""" """Determine if a device containing the specified in cluster is paired."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY] zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
zha_devices = zha_gateway.devices.values() zha_devices = zha_gateway.devices.values()
for zha_device in zha_devices: for zha_device in zha_devices:
clusters_by_endpoint = zha_device.async_get_clusters() clusters_by_endpoint = zha_device.async_get_clusters()
for clusters in clusters_by_endpoint.values(): 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 True
return False return False

View File

@ -83,7 +83,8 @@ SINGLE_INPUT_CLUSTER_DEVICE_CLASS = {
} }
SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = { 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() BINDABLE_CLUSTERS = SetRegistry()