Skip to content

Commit 489bf0e

Browse files
Sync driver source with working channel-published version
- Revert init.lua to drop GeneralDiagnostics.ActiveHardwareFaults subscription that crashed the driver on load - Use the generic profile filename matter-lock-contact-tamper.yml (previous gatelock-matter.yml predated the rename) - Update fingerprints.yml to reference the renamed profile - Restore README tamper-alert section to the DoorLockAlarm event path
1 parent 08567e1 commit 489bf0e

4 files changed

Lines changed: 6 additions & 47 deletions

File tree

drivers/EconetControlsInc/bulldog-gatelock/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ The reed switch on GPIO0.28 triggers `sendDoorStateChangeAlarmEvent()` in firmwa
2323

2424
## Tamper alert
2525

26-
When the keypad's 4-strikes-in-20-seconds brute-force protection trips, the firmware:
27-
28-
1. Adds `kTamperDetected (10)` to `GeneralDiagnostics.ActiveHardwareFaults` on endpoint 0 (also emits the `HardwareFaultChange` event).
29-
2. Fires a legacy `DoorLockAlarm` event with `alarmCode = kWrongCodeEntryLimit (4)` for backwards compatibility.
30-
31-
The driver subscribes to the `ActiveHardwareFaults` attribute and maps list membership directly to the **tamperAlert** capability — `tampered` while the list contains `10`, `clear` when the firmware removes it (which happens automatically when the lockout window expires). The legacy `DoorLockAlarm` event handler is retained so older firmware builds that only fire the event still surface a `tampered` state.
26+
When the keypad's 4-strikes-in-20-seconds brute-force protection trips, the firmware fires a `DoorLockAlarm` event with `alarmCode = kWrongCodeEntryLimit (4)`. The driver maps this to the standard **tamperAlert** capability ("tampered" badge in the app). The state stays `tampered` until the driver re-initializes; on init the driver emits `clear`.
3227

3328
## Prerequisites
3429

drivers/EconetControlsInc/bulldog-gatelock/fingerprints.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
matterManufacturer:
22
- id: "econet-gatelock"
3-
deviceProfileName: gatelock-matter
3+
deviceProfileName: matter-lock-contact-tamper
44
vendorId: 0x1568 # Econet Controls Inc (5480)
55
productId: 0x000A # 10 (Bulldog GateLock)
66
deviceTypes:

drivers/EconetControlsInc/bulldog-gatelock/profiles/gatelock-matter.yml renamed to drivers/EconetControlsInc/bulldog-gatelock/profiles/matter-lock-contact-tamper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: gatelock-matter
1+
name: matter-lock-contact-tamper
22
components:
33
- id: main
44
capabilities:

drivers/EconetControlsInc/bulldog-gatelock/src/init.lua

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ local MatterDriver = require "st.matter.driver"
99
local clusters = require "st.matter.clusters"
1010
local capabilities = require "st.capabilities"
1111

12-
local DoorLock = clusters.DoorLock
13-
local PowerSource = clusters.PowerSource
14-
local GeneralDiagnostics = clusters.GeneralDiagnostics
12+
local DoorLock = clusters.DoorLock
13+
local PowerSource = clusters.PowerSource
1514

16-
local UNLATCHED_STATE = 0x3
17-
local HARDWARE_FAULT_TAMPER_DETECTED = 10
15+
local UNLATCHED_STATE = 0x3
1816

1917
----------------------------------------------------------------------
2018
-- ATTRIBUTE HANDLERS
@@ -52,38 +50,10 @@ local function battery_percent_handler(driver, device, ib, response)
5250
end
5351
end
5452

55-
-- GeneralDiagnostics.ActiveHardwareFaults is a list of HardwareFaultEnum values.
56-
-- Firmware adds kTamperDetected (10) when the keypad 4-strike brute-force
57-
-- limit trips and removes it when the lockout expires. Map list membership
58-
-- directly to the tamperAlert capability so the SmartThings UI tracks the
59-
-- attribute's full lifecycle (detected -> clear) instead of just the alarm
60-
-- event edge.
61-
local function hardware_faults_handler(driver, device, ib, response)
62-
local list = ib.data and ib.data.elements
63-
local tampered = false
64-
if list ~= nil then
65-
for _, entry in ipairs(list) do
66-
if entry.value == HARDWARE_FAULT_TAMPER_DETECTED then
67-
tampered = true
68-
break
69-
end
70-
end
71-
end
72-
if tampered then
73-
device:emit_event(capabilities.tamperAlert.tamper.detected())
74-
else
75-
device:emit_event(capabilities.tamperAlert.tamper.clear())
76-
end
77-
end
78-
7953
----------------------------------------------------------------------
8054
-- EVENT HANDLERS
8155
----------------------------------------------------------------------
8256

83-
-- Retained for compatibility with firmware that only fires the
84-
-- DoorLockAlarm event (older builds without GeneralDiagnostics tamper
85-
-- reporting). On builds that report both, the attribute handler above
86-
-- supersedes this by also clearing the state.
8757
local function door_lock_alarm_handler(driver, device, ib, response)
8858
device:emit_event(capabilities.tamperAlert.tamper.detected())
8959
end
@@ -137,9 +107,6 @@ local matter_lock_driver = {
137107
[PowerSource.ID] = {
138108
[PowerSource.attributes.BatPercentRemaining.ID] = battery_percent_handler,
139109
},
140-
[GeneralDiagnostics.ID] = {
141-
[GeneralDiagnostics.attributes.ActiveHardwareFaults.ID] = hardware_faults_handler,
142-
},
143110
},
144111
event = {
145112
[DoorLock.ID] = {
@@ -158,9 +125,6 @@ local matter_lock_driver = {
158125
[capabilities.battery.ID] = {
159126
PowerSource.attributes.BatPercentRemaining,
160127
},
161-
[capabilities.tamperAlert.ID] = {
162-
GeneralDiagnostics.attributes.ActiveHardwareFaults,
163-
},
164128
},
165129

166130
subscribed_events = {

0 commit comments

Comments
 (0)