Skip to content

Commit

Permalink
Add Zigbee Gas status from Heartbeats
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 5, 2024
1 parent 0966557 commit d489b64
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions custom_components/xiaomi_gateway3/core/converters/zigbee.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,26 @@ def decode(self, device: "XDevice", payload: dict, data: dict):
payload[self.attr] = bool(value[100])


# Gateway doesn't unpack gas status, don't know why.
class ZLumiGasHeartbeat(ZConverter):
"""Decode gas status from Lumi Basic cluster."""

cluster_id = Basic.cluster_id

def decode(self, device: "XDevice", payload: dict, data: dict):
if value := data.get(0xFF01):
if value[150] == 0:
payload[self.attr] = False
elif value[150] == 0x42000000:
payload[self.attr] = True
elif value[150] == 0x43000000:
payload[self.attr] = True
payload["action"] = BUTTON_SINGLE
elif value[150] == 0x08000000:
payload[self.attr] = False
payload["action"] = BUTTON_SINGLE


class ZLumiSensConv(ZConverter):
cluster_id = IasZone.cluster_id
attr_id = 0xFFF0 # read attr
Expand Down
1 change: 1 addition & 0 deletions custom_components/xiaomi_gateway3/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
BaseConv("gas_density", "sensor", mi="0.1.85"),
BoolConv("gas", "binary_sensor", mi="13.1.85"),
ZLumiSensConv("sensitivity", "select"), # config
ZLumiGasHeartbeat("gas"),
],
}, {
"lumi.curtain": ["Aqara", "Curtain", "ZNCLDJ11LM"],
Expand Down

0 comments on commit d489b64

Please sign in to comment.