Fix Samjin Multi acceleration in ZHA (#69636)

pull/69628/head^2
David F. Mulcahey 2022-04-07 20:53:12 -04:00 committed by GitHub
parent 2ae3372128
commit 261e12e881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -8,7 +8,12 @@ import logging
from typing import Any
import zigpy.exceptions
from zigpy.zcl.foundation import CommandSchema, ConfigureReportingResponseRecord, Status
from zigpy.zcl.foundation import (
CommandSchema,
ConfigureReportingResponseRecord,
Status,
ZCLAttributeDef,
)
from homeassistant.const import ATTR_COMMAND
from homeassistant.core import callback
@ -112,7 +117,11 @@ class ZigbeeChannel(LogMixin):
if not hasattr(self, "_value_attribute") and self.REPORT_CONFIG:
attr = self.REPORT_CONFIG[0].get("attr")
if isinstance(attr, str):
self.value_attribute = self.cluster.attributes_by_name.get(attr)
attribute: ZCLAttributeDef = self.cluster.attributes_by_name.get(attr)
if attribute is not None:
self.value_attribute = attribute.id
else:
self.value_attribute = None
else:
self.value_attribute = attr
self._status = ChannelStatus.CREATED