Skip to content

Commit 9fd228d

Browse files
authored
Merge pull request #2553 from seojune79/Aqara-WirelessRemote-HeldEvt
[Aqara] Fixed an issue where an unintended event was triggered (or generated) when the button was long-pressed
2 parents 16cef63 + 9916167 commit 9fd228d

File tree

1 file changed

+13
-11
lines changed
  • drivers/SmartThings/zigbee-button/src/aqara

1 file changed

+13
-11
lines changed

drivers/SmartThings/zigbee-button/src/aqara/init.lua

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,19 @@ local configuration = {
5757
}
5858

5959
local function present_value_attr_handler(driver, device, value, zb_rx)
60-
local end_point = zb_rx.address_header.src_endpoint.value
61-
local btn_evt_cnt = FINGERPRINTS[device:get_model()].btn_cnt or 1
62-
local evt = capabilities.button.button.held({ state_change = true })
63-
if value.value == 1 then
64-
evt = capabilities.button.button.pushed({ state_change = true })
65-
elseif value.value == 2 then
66-
evt = capabilities.button.button.double({ state_change = true })
67-
end
68-
device:emit_event(evt)
69-
if btn_evt_cnt > 1 then
70-
device:emit_component_event(device.profile.components[COMP_LIST[end_point]], evt)
60+
if value.value < 0xFF then
61+
local end_point = zb_rx.address_header.src_endpoint.value
62+
local btn_evt_cnt = FINGERPRINTS[device:get_model()].btn_cnt or 1
63+
local evt = capabilities.button.button.held({ state_change = true })
64+
if value.value == 1 then
65+
evt = capabilities.button.button.pushed({ state_change = true })
66+
elseif value.value == 2 then
67+
evt = capabilities.button.button.double({ state_change = true })
68+
end
69+
device:emit_event(evt)
70+
if btn_evt_cnt > 1 then
71+
device:emit_component_event(device.profile.components[COMP_LIST[end_point]], evt)
72+
end
7173
end
7274
end
7375

0 commit comments

Comments
 (0)