mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix Smartthings acceleration sensor in ZHA (#91056)
This commit is contained in:
parent
2f4325246b
commit
90f857e926
@ -187,11 +187,16 @@ class SmartThingsAcceleration(ZigbeeChannel):
|
|||||||
@callback
|
@callback
|
||||||
def attribute_updated(self, attrid, value):
|
def attribute_updated(self, attrid, value):
|
||||||
"""Handle attribute updates on this cluster."""
|
"""Handle attribute updates on this cluster."""
|
||||||
|
try:
|
||||||
|
attr_name = self._cluster.attributes[attrid].name
|
||||||
|
except KeyError:
|
||||||
|
attr_name = UNKNOWN
|
||||||
|
|
||||||
if attrid == self.value_attribute:
|
if attrid == self.value_attribute:
|
||||||
self.async_send_signal(
|
self.async_send_signal(
|
||||||
f"{self.unique_id}_{SIGNAL_ATTR_UPDATED}",
|
f"{self.unique_id}_{SIGNAL_ATTR_UPDATED}",
|
||||||
attrid,
|
attrid,
|
||||||
self._cluster.attributes.get(attrid, [UNKNOWN])[0],
|
attr_name,
|
||||||
value,
|
value,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -200,7 +205,7 @@ class SmartThingsAcceleration(ZigbeeChannel):
|
|||||||
SIGNAL_ATTR_UPDATED,
|
SIGNAL_ATTR_UPDATED,
|
||||||
{
|
{
|
||||||
ATTR_ATTRIBUTE_ID: attrid,
|
ATTR_ATTRIBUTE_ID: attrid,
|
||||||
ATTR_ATTRIBUTE_NAME: self._cluster.attributes.get(attrid, [UNKNOWN])[0],
|
ATTR_ATTRIBUTE_NAME: attr_name,
|
||||||
ATTR_VALUE: value,
|
ATTR_VALUE: value,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user