mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
clean up channel configuration (#22534)
This commit is contained in:
parent
53595e76d8
commit
b7bc520a0e
@ -15,7 +15,7 @@ from homeassistant.core import callback
|
|||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from ..helpers import (
|
from ..helpers import (
|
||||||
bind_configure_reporting, construct_unique_id,
|
bind_configure_reporting, construct_unique_id,
|
||||||
safe_read, get_attr_id_by_name)
|
safe_read, get_attr_id_by_name, bind_cluster)
|
||||||
from ..const import (
|
from ..const import (
|
||||||
REPORT_CONFIG_DEFAULT, SIGNAL_ATTR_UPDATED, ATTRIBUTE_CHANNEL,
|
REPORT_CONFIG_DEFAULT, SIGNAL_ATTR_UPDATED, ATTRIBUTE_CHANNEL,
|
||||||
EVENT_RELAY_CHANNEL, ZDO_CHANNEL
|
EVENT_RELAY_CHANNEL, ZDO_CHANNEL
|
||||||
@ -141,7 +141,9 @@ class ZigbeeChannel:
|
|||||||
manufacturer_code = self._zha_device.manufacturer_code
|
manufacturer_code = self._zha_device.manufacturer_code
|
||||||
if self.cluster.cluster_id >= 0xfc00 and manufacturer_code:
|
if self.cluster.cluster_id >= 0xfc00 and manufacturer_code:
|
||||||
manufacturer = manufacturer_code
|
manufacturer = manufacturer_code
|
||||||
|
if self.cluster.bind_only:
|
||||||
|
await bind_cluster(self._unique_id, self.cluster)
|
||||||
|
else:
|
||||||
skip_bind = False # bind cluster only for the 1st configured attr
|
skip_bind = False # bind cluster only for the 1st configured attr
|
||||||
for report_config in self._report_config:
|
for report_config in self._report_config:
|
||||||
attr = report_config.get('attr')
|
attr = report_config.get('attr')
|
||||||
|
@ -49,7 +49,7 @@ class ZHADevice:
|
|||||||
self._zha_gateway = zha_gateway
|
self._zha_gateway = zha_gateway
|
||||||
self.cluster_channels = {}
|
self.cluster_channels = {}
|
||||||
self._relay_channels = {}
|
self._relay_channels = {}
|
||||||
self._all_channels = {}
|
self._all_channels = []
|
||||||
self._name = "{} {}".format(
|
self._name = "{} {}".format(
|
||||||
self.manufacturer,
|
self.manufacturer,
|
||||||
self.model
|
self.model
|
||||||
@ -135,7 +135,7 @@ class ZHADevice:
|
|||||||
@property
|
@property
|
||||||
def all_channels(self):
|
def all_channels(self):
|
||||||
"""Return cluster channels and relay channels for device."""
|
"""Return cluster channels and relay channels for device."""
|
||||||
return self._all_channels.values()
|
return self._all_channels
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available_signal(self):
|
def available_signal(self):
|
||||||
@ -195,10 +195,10 @@ class ZHADevice:
|
|||||||
|
|
||||||
if isinstance(cluster_channel, EventRelayChannel):
|
if isinstance(cluster_channel, EventRelayChannel):
|
||||||
self._relay_channels[cluster_channel.unique_id] = cluster_channel
|
self._relay_channels[cluster_channel.unique_id] = cluster_channel
|
||||||
self._all_channels[cluster_channel.unique_id] = cluster_channel
|
self._all_channels.append(cluster_channel)
|
||||||
else:
|
else:
|
||||||
self.cluster_channels[cluster_channel.name] = cluster_channel
|
self.cluster_channels[cluster_channel.name] = cluster_channel
|
||||||
self._all_channels[cluster_channel.name] = cluster_channel
|
self._all_channels.append(cluster_channel)
|
||||||
|
|
||||||
async def async_configure(self):
|
async def async_configure(self):
|
||||||
"""Configure the device."""
|
"""Configure the device."""
|
||||||
|
@ -266,6 +266,11 @@ class ZHAGateway:
|
|||||||
self._hass, self._config, endpoint_id, endpoint,
|
self._hass, self._config, endpoint_id, endpoint,
|
||||||
discovery_infos, device, zha_device, is_new_join
|
discovery_infos, device, zha_device, is_new_join
|
||||||
)
|
)
|
||||||
|
if endpoint_id != 0:
|
||||||
|
for cluster in endpoint.in_clusters.values():
|
||||||
|
cluster.bind_only = False
|
||||||
|
for cluster in endpoint.out_clusters.values():
|
||||||
|
cluster.bind_only = True
|
||||||
|
|
||||||
if is_new_join:
|
if is_new_join:
|
||||||
# configure the device
|
# configure the device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user