From 263e68c4877852d489688d4d23c1fe9e49795cd8 Mon Sep 17 00:00:00 2001 From: Nikita Uvarov Date: Sat, 26 Oct 2024 18:16:22 +0200 Subject: [PATCH] Fix Nimly smart lock mains-powered capability (#3457) --- zhaquirks/nimly/__init__.py | 3 +++ zhaquirks/nimly/lock.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 zhaquirks/nimly/__init__.py create mode 100644 zhaquirks/nimly/lock.py diff --git a/zhaquirks/nimly/__init__.py b/zhaquirks/nimly/__init__.py new file mode 100644 index 0000000000..425e60dfa8 --- /dev/null +++ b/zhaquirks/nimly/__init__.py @@ -0,0 +1,3 @@ +"""Nimly module.""" + +NIMLY = "Onesti Products AS" diff --git a/zhaquirks/nimly/lock.py b/zhaquirks/nimly/lock.py new file mode 100644 index 0000000000..2f3100f87e --- /dev/null +++ b/zhaquirks/nimly/lock.py @@ -0,0 +1,36 @@ +"""Device handler for Nimly Smart Locks.""" + +from zigpy.quirks.v2 import QuirkBuilder +from zigpy.zdo.types import NodeDescriptor + +from zhaquirks.nimly import NIMLY + +# clears the mains powered mac capability flag +NIMLY_LOCK_NODE_DESCRIPTOR = NodeDescriptor( + logical_type=2, + complex_descriptor_available=0, + user_descriptor_available=0, + reserved=0, + aps_flags=0, + frequency_band=8, + manufacturer_code=4660, + maximum_buffer_size=108, + maximum_incoming_transfer_size=127, + server_mask=11264, + maximum_outgoing_transfer_size=127, + descriptor_capability_field=0, + mac_capability_flags=NodeDescriptor.MACCapabilityFlags.AllocateAddress + | NodeDescriptor.MACCapabilityFlags.RxOnWhenIdle, +) + + +( + QuirkBuilder(NIMLY, "NimlyPRO") + .also_applies_to(NIMLY, "NimlyCode") + .also_applies_to(NIMLY, "NimlyTouch") + .also_applies_to(NIMLY, "NimlyIn") + .also_applies_to(NIMLY, "EasyFingerTouch") + .also_applies_to(NIMLY, "EasyCodeTouch") + .node_descriptor(NIMLY_LOCK_NODE_DESCRIPTOR) + .add_to_registry() +)