Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lelandblue authored Aug 8, 2024
2 parents 1760771 + 7eaeae2 commit 999f405
Show file tree
Hide file tree
Showing 539 changed files with 31,781 additions and 1,403 deletions.
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Check all that apply

# Type of Change

- [ ] WWST Certification Request
- If this is your first time contributing code:
- [ ] I have reviewed the README.md file
- [ ] I have reviewed the CODE_OF_CONDUCT.md file
- [ ] I have signed the CLA
- [ ] I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
- [ ] Bug fix
- [ ] New feature
- [ ] Refactor

# Checklist

- [ ] I have performed a self-review of my code
- [ ] I have commented my code in hard-to-understand areas
- [ ] I have verified my changes by testing with a device or have communicated a plan for testing
- [ ] I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

# Description of Change


# Summary of Completed Tests


4 changes: 4 additions & 0 deletions .github/scripts/check_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def compare_components(prof1, prof2):
if new_component.get("categories") != current_component.get("categories"):
return False

# compare labels
if new_component.get("label") != current_component.get("label"):
return False

# check that there are the same number of capabilities and that the top capability matches
if ((len(new_component["capabilities"]) == len(current_component["capabilities"])) and
(new_component["capabilities"][0]["id"] == current_component["capabilities"][0]["id"])):
Expand Down
22 changes: 22 additions & 0 deletions drivers/Aqara/aqara-lock/capabilities/antiLockStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
id: stse.antiLockStatus
version: 1
status: proposed
name: Anti lock status
ephemeral: false
attributes:
antiLockStatus:
schema:
type: object
properties:
value:
title: Anti-Lock status
type: string
enum:
- "enabled"
- "disabled"
- "unknown"
additionalProperties: false
required:
- value
enumCommands: []
commands: {}
27 changes: 27 additions & 0 deletions drivers/Aqara/aqara-lock/capabilities/lockAlarm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
id: lockAlarm
version: 1
status: proposed
name: Lock Alarm
ephemeral: false
attributes:
alarm:
schema:
type: object
properties:
value:
type: string
enum:
- clear
- lockFactoryReset
- damaged
- forcedOpeningAttempt
- unableToLockTheDoor
- notClosedForALongTime
- highTemperature
- attemptsExceeded
- physicalImpact
additionalProperties: false
required:
- value
enumCommands: []
commands: {}
4 changes: 3 additions & 1 deletion drivers/Aqara/aqara-lock/profiles/aqara-lock-battery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ components:
version: 1
- id: battery
version: 1
- id: tamperAlert
- id: lockAlarm
version: 1
- id: remoteControlStatus
version: 1
- id: firmwareUpdate
version: 1
- id: stse.lockCredentialInfo
version: 1
- id: stse.antiLockStatus
version: 1
categories:
- name: SmartLock
metadata:
Expand Down
53 changes: 38 additions & 15 deletions drivers/Aqara/aqara-lock/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ local utils = require "st.utils"

local remoteControlStatus = capabilities.remoteControlStatus
local lockCredentialInfo = capabilities["stse.lockCredentialInfo"]
local antiLockStatus = capabilities["stse.antiLockStatus"]
local Battery = capabilities.battery
local Lock = capabilities.lock
local TamperAlert = capabilities.tamperAlert
local LockAlarm = capabilities.lockAlarm

local PRI_CLU = 0xFCC0
local PRI_ATTR = 0xFFF3
Expand Down Expand Up @@ -53,7 +54,8 @@ end
local function device_added(self, device)
remoteControlShow(device)
device:emit_event(Battery.battery(100))
device:emit_event(TamperAlert.tamper.clear({ visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false } }))
device:emit_event(antiLockStatus.antiLockStatus("unknown", { visibility = {displayed = false}}))
device:emit_event(Lock.lock.locked())
credential_utils.save_data(self)
end
Expand All @@ -67,41 +69,60 @@ local function toHex(value, length)
end

local function event_lock_handler(driver, device, evt_name, evt_value)
if evt_value == 1 then
if evt_value == 0x1 then
device:emit_event(Lock.lock(evt_name))
device:emit_event(TamperAlert.tamper.clear())
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
remoteControlShow(device)
end
end

local function event_unlock_handler(driver, device, evt_name, evt_value)
local id, label
if evt_value == 0x80020000 then -- one-time password
id = "OTP_STANDALONE"
label = nil
else
id, label = credential_utils.find_userLabel(driver, device, evt_value)
end
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = id, codeName = label } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(TamperAlert.tamper.clear())
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end

local function event_door_handler(driver, device, evt_name, evt_value)
if evt_value == 2 then
device:emit_event(Lock.lock(evt_name))
device:emit_event(TamperAlert.tamper.clear())
elseif evt_value == 4 then
device:emit_event(TamperAlert.tamper.detected())
if evt_value == 0x2 then
device:emit_event(LockAlarm.alarm.notClosedForALongTime())
elseif evt_value == 0x4 then
device:emit_event(LockAlarm.alarm.forcedOpeningAttempt())
end
end

local function event_battery_handler(driver, device, evt_name, evt_value)
device:emit_event(Battery.battery(evt_value))
end

local function event_tamper_alert_handler(driver, device, evt_name, evt_value)
device:emit_event(TamperAlert.tamper.detected())
local function event_abnormal_status_handler(driver, device, evt_name, evt_value)
if evt_value == 0xC0DE1006 then
device:emit_event(LockAlarm.alarm.highTemperature())
elseif evt_value == 0xC0DE000A then
device:emit_event(LockAlarm.alarm.attemptsExceeded({state_change = true}))
end
end

local function event_anti_lock_handler(driver, device, evt_name, evt_value)
local evt = "disabled"
if evt_value == 0x1 then evt = "enabled" end
device:emit_event(antiLockStatus.antiLockStatus(evt))
end
local function event_lock_status_handler(driver, device, evt_name, evt_value)
if evt_value == 0x1 then
device:emit_event(LockAlarm.alarm.unableToLockTheDoor())
elseif evt_value == 0xA then
device:emit_event(LockAlarm.alarm.damaged())
end
end
local METHOD = {
LOCKED = "locked",
NOT_FULLY_LOCKED = "not fully locked",
MANUAL = "manual",
FINGERPRINT = "fingerprint",
KEYPAD = "keypad",
Expand All @@ -113,7 +134,7 @@ local METHOD = {

local resource_id = {
["13.31.85"] = { event_name = METHOD.LOCKED, event_handler = event_lock_handler },
["13.17.85"] = { event_name = METHOD.NOT_FULLY_LOCKED, event_handler = event_door_handler },
["13.17.85"] = { event_name = METHOD.NO_USE, event_handler = event_door_handler },
["13.48.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_handler },
["13.51.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_handler },
["13.42.85"] = { event_name = METHOD.FINGERPRINT, event_handler = event_unlock_handler },
Expand All @@ -123,7 +144,9 @@ local resource_id = {
["13.90.85"] = { event_name = METHOD.COMMAND, event_handler = event_unlock_handler },
["13.46.85"] = { event_name = METHOD.KEYPAD, event_handler = event_unlock_handler },
["13.56.85"] = { event_name = METHOD.NO_USE, event_handler = event_battery_handler },
["13.32.85"] = { event_name = METHOD.NO_USE, event_handler = event_tamper_alert_handler }
["13.32.85"] = { event_name = METHOD.NO_USE, event_handler = event_abnormal_status_handler },
["13.33.85"] = { event_name = METHOD.NO_USE, event_handler = event_anti_lock_handler },
["13.88.85"] = { event_name = METHOD.NO_USE, event_handler = event_lock_status_handler }
}

local function request_generate_shared_key(device)
Expand Down
13 changes: 10 additions & 3 deletions drivers/Aqara/aqara-lock/src/test/test_aqara_lock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ local data_types = require "st.zigbee.data_types"
local zigbee_test_utils = require "integration_test.zigbee_test_utils"

local remoteControlStatus = capabilities.remoteControlStatus
local antiLockStatus = capabilities["stse.antiLockStatus"]
test.add_package_capability("antiLockStatus.yaml")
local lockCredentialInfo = capabilities["stse.lockCredentialInfo"]
test.add_package_capability("lockCredentialInfo.yaml")
local lockAlarm = capabilities["lockAlarm"]
test.add_package_capability("lockAlarm.yaml")
local Battery = capabilities.battery
local Lock = capabilities.lock
local TamperAlert = capabilities.tamperAlert

local PRI_CLU = 0xFCC0
local PRI_ATTR = 0xFFF3
Expand Down Expand Up @@ -49,7 +52,9 @@ test.register_coroutine_test(
remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Battery.battery(100)))
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
TamperAlert.tamper("clear", { visibility = { displayed = false } })))
lockAlarm.alarm.clear({ visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
antiLockStatus.antiLockStatus('unknown', { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Lock.lock("locked")))
end
)
Expand All @@ -64,7 +69,9 @@ test.register_coroutine_test(
remoteControlStatus.remoteControlEnabled('true', { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Battery.battery(100)))
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
TamperAlert.tamper("clear", { visibility = { displayed = false } })))
lockAlarm.alarm.clear({ visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
antiLockStatus.antiLockStatus('unknown', { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Lock.lock("locked")))
end
)
Expand Down
2 changes: 0 additions & 2 deletions drivers/SmartThings/harman-luxury/profiles/harman-luxury.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ components:
version: 1
- id: audioNotification
version: 1
- id: keypadInput
version: 1
- id: refresh
version: 1
categories:
Expand Down
2 changes: 0 additions & 2 deletions drivers/SmartThings/harman-luxury/profiles/maX10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ components:
version: 1
- id: audioTrackData
version: 1
- id: mediaPresets
version: 1
- id: mediaPlayback
version: 1
- id: mediaTrackControl
Expand Down
Loading

0 comments on commit 999f405

Please sign in to comment.