Skip to content

Commit

Permalink
Merge pull request #1615 from SmartThingsCommunity/beta
Browse files Browse the repository at this point in the history
rolling up beta to production
  • Loading branch information
ctowns authored Sep 4, 2024
2 parents 72e2f56 + 77fc4a8 commit d66670d
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 13 deletions.
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-lock/profiles/base-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ components:
enabledValues:
- locked
- unlocked
- unknown
- not fully locked
- id: lockCodes
version: 1
- id: tamperAlert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ components:
enabledValues:
- locked
- unlocked
- unknown
- not fully locked
- id: lockAlarm
version: 1
- id: firmwareUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ components:
enabledValues:
- locked
- unlocked
- unknown
- not fully locked
- id: lockAlarm
version: 1
- id: battery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ components:
enabledValues:
- locked
- unlocked
- unknown
- not fully locked
- id: battery
version: 1
- id: firmwareUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ components:
enabledValues:
- locked
- unlocked
- unknown
- not fully locked
- id: battery
version: 1
- id: tamperAlert
Expand Down
5 changes: 3 additions & 2 deletions drivers/SmartThings/matter-lock/src/aqara-lock/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ local function lock_state_handler(driver, device, ib, response)
local LockState = DoorLock.attributes.LockState
local attr = capabilities.lock.lock
local LOCK_STATE = {
[LockState.NOT_FULLY_LOCKED] = attr.unknown(),
[LockState.NOT_FULLY_LOCKED] = attr.not_fully_locked(),
[LockState.LOCKED] = attr.locked(),
[LockState.UNLOCKED] = attr.unlocked(),
}
Expand Down Expand Up @@ -142,4 +142,5 @@ local aqara_lock_handler = {
can_handle = is_aqara_products
}

return aqara_lock_handler
return aqara_lock_handler

2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-lock/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ local function lock_state_handler(driver, device, ib, response)
local LockState = DoorLock.attributes.LockState
local attr = capabilities.lock.lock
local LOCK_STATE = {
[LockState.NOT_FULLY_LOCKED] = attr.unknown(),
[LockState.NOT_FULLY_LOCKED] = attr.not_fully_locked(),
[LockState.LOCKED] = attr.locked(),
[LockState.UNLOCKED] = attr.unlocked(),
[UNLATCHED_STATE] = attr.unlocked(), -- Fully unlocked with latch pulled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test.register_message_test(
)

test.register_message_test(
"Handle received Lock State from Matter device.", {
"Handle received LockState.LOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
Expand All @@ -119,6 +119,46 @@ test.register_message_test(
}
)

test.register_message_test(
"Handle received LockState.UNLOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.DoorLock.attributes.LockState:build_test_report_data(
mock_device, 1, clusters.DoorLock.attributes.LockState.UNLOCKED
),
},
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()),
},
}
)

test.register_message_test(
"Handle received LockState.NOT_FULLY_LOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.DoorLock.attributes.LockState:build_test_report_data(
mock_device, 1, clusters.DoorLock.attributes.LockState.NOT_FULLY_LOCKED
),
},
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.lock.lock.not_fully_locked()),
},
}
)

local function refresh_commands(dev)
local req = clusters.DoorLock.attributes.LockState:read(dev)
return req
Expand Down
62 changes: 61 additions & 1 deletion drivers/SmartThings/matter-lock/src/test/test_matter_lock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test.register_message_test(
)

test.register_message_test(
"Handle received Lock State from Matter device.", {
"Handle received LockState.LOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
Expand All @@ -115,6 +115,66 @@ test.register_message_test(
}
)

test.register_message_test(
"Handle received LockState.UNLOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.DoorLock.attributes.LockState:build_test_report_data(
mock_device, 10, clusters.DoorLock.attributes.LockState.UNLOCKED
),
},
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()),
},
}
)

test.register_message_test(
"Handle received LockState.NOT_FULLY_LOCKED from Matter device.", {
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.DoorLock.attributes.LockState:build_test_report_data(
mock_device, 10, clusters.DoorLock.attributes.LockState.NOT_FULLY_LOCKED
),
},
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.lock.lock.not_fully_locked()),
},
}
)

test.register_message_test(
"Handle received LockState.UNLATCHED from Matter device.", {
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.DoorLock.attributes.LockState:build_test_report_data(
mock_device, 10, clusters.DoorLock.attributes.LockState.UNLATCHED
),
},
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()),
},
}
)

test.register_message_test(
"Handle received BatPercentRemaining from device.", {
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-sensor/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ matterManufacturer:
deviceLabel: Heiman Motion Sensor
vendorId: 0x120B
productId: 0x1001
deviceProfileName: matter-motion-battery-illuminance
deviceProfileName: motion-illuminance-battery
- id: "4619/4145"
deviceLabel: Heiman Door and Window D1-M
vendorId: 0x120B
Expand Down
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-sensor/profiles/motion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: matter-motion
name: motion
components:
- id: main
capabilities:
Expand Down
5 changes: 4 additions & 1 deletion drivers/SmartThings/matter-thermostat/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ local RAC_DEVICE_TYPE_ID = 0x0072
local AP_DEVICE_TYPE_ID = 0x002D
local FAN_DEVICE_TYPE_ID = 0x002B

local MIN_ALLOWED_PERCENT_VALUE = 0
local MAX_ALLOWED_PERCENT_VALUE = 100

local MGM3_PPM_CONVERSION_FACTOR = 24.45

local setpoint_limit_device_field = {
Expand Down Expand Up @@ -868,7 +871,7 @@ end
local function fan_speed_percent_attr_handler(driver, device, ib, response)
local speed = 0
if ib.data.value ~= nil then
speed = ib.data.value
speed = utils.clamp_value(ib.data.value, MIN_ALLOWED_PERCENT_VALUE, MAX_ALLOWED_PERCENT_VALUE)
end
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.fanSpeedPercent.percent(speed))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,23 @@ test.register_message_test(
}
)

test.register_message_test(
"Set percent command should clamp invalid percentage values",
{
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.FanControl.attributes.PercentCurrent:build_test_report_data(mock_device, 1, 255)
}
},
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.fanSpeedPercent.percent(100))
},
}
)

test.run_registered_tests()
15 changes: 15 additions & 0 deletions drivers/SmartThings/zigbee-switch/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,21 @@ zigbeeManufacturer:
manufacturer: ShinaSystem
model: SBM300Z6
deviceProfileName: basic-switch
- id: ShinaSystem/SQM300Z1
deviceLabel: SiHAS Switch
manufacturer: ShinaSystem
model: SQM300Z1
deviceProfileName: basic-switch
- id: ShinaSystem/SQM300Z2
deviceLabel: SiHAS Switch 1
manufacturer: ShinaSystem
model: SQM300Z2
deviceProfileName: basic-switch
- id: ShinaSystem/SQM300Z3
deviceLabel: SiHAS Switch 1
manufacturer: ShinaSystem
model: SQM300Z3
deviceProfileName: basic-switch
- id: Samsung/SAMSUNG-ITM-Z-002
deviceLabel: Samsung Light
manufacturer: Samsung Electronics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ local MULTI_SWITCH_NO_MASTER_FINGERPRINTS = {
{ mfr = "ShinaSystem", model = "SBM300Z4", children = 3 },
{ mfr = "ShinaSystem", model = "SBM300Z5", children = 4 },
{ mfr = "ShinaSystem", model = "SBM300Z6", children = 5 },
{ mfr = "ShinaSystem", model = "SQM300Z2", children = 1 },
{ mfr = "ShinaSystem", model = "SQM300Z3", children = 2 },
{ model = "E220-KR2N0Z0-HA", children = 1 },
{ model = "E220-KR3N0Z0-HA", children = 2 },
{ model = "E220-KR4N0Z0-HA", children = 3 },
Expand Down

0 comments on commit d66670d

Please sign in to comment.