-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #993 from SmartThingsCommunity/main
Rolling up main to beta
- Loading branch information
Showing
25 changed files
with
1,808 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
drivers/SmartThings/matter-sensor/profiles/matter-motion-battery.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: matter-motion-battery | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: motionSensor | ||
version: 1 | ||
- id: battery | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: MotionSensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: matter-motion-battery | ||
name: motion-battery | ||
components: | ||
- id: main | ||
capabilities: | ||
|
14 changes: 14 additions & 0 deletions
14
drivers/SmartThings/matter-sensor/profiles/motion-contact.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: motion-contact | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: motionSensor | ||
version: 1 | ||
- id: contactSensor | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: MotionSensor |
16 changes: 16 additions & 0 deletions
16
drivers/SmartThings/matter-sensor/profiles/motion-illuminance-battery.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: motion-illuminance-battery | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: motionSensor | ||
version: 1 | ||
- id: battery | ||
version: 1 | ||
- id: illuminanceMeasurement | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: MotionSensor |
14 changes: 14 additions & 0 deletions
14
drivers/SmartThings/matter-sensor/profiles/motion-illuminance.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: motion-illuminance | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: motionSensor | ||
version: 1 | ||
- id: illuminanceMeasurement | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: MotionSensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
180 changes: 180 additions & 0 deletions
180
drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_featuremap.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
-- Copyright 2023 SmartThings | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
local test = require "integration_test" | ||
local t_utils = require "integration_test.utils" | ||
local clusters = require "st.matter.clusters" | ||
|
||
local mock_device_humidity_battery = test.mock_device.build_test_matter_device({ | ||
profile = t_utils.get_profile_definition("humidity-battery.yml"), | ||
manufacturer_info = { | ||
vendor_id = 0x0000, | ||
product_id = 0x0000, | ||
}, | ||
endpoints = { | ||
{ | ||
endpoint_id = 0, | ||
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
}, | ||
device_types = { | ||
device_type_id = 0x0016, device_type_revision = 1, -- RootNode | ||
} | ||
}, | ||
{ | ||
endpoint_id = 1, | ||
clusters = { | ||
{cluster_id = clusters.RelativeHumidityMeasurement.ID, cluster_type = "SERVER"}, | ||
} | ||
}, | ||
{ | ||
endpoint_id = 2, | ||
clusters = { | ||
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = 2}, | ||
} | ||
} | ||
} | ||
}) | ||
|
||
local mock_device_humidity_no_battery = test.mock_device.build_test_matter_device({ | ||
profile = t_utils.get_profile_definition("humidity-battery.yml"), | ||
manufacturer_info = { | ||
vendor_id = 0x0000, | ||
product_id = 0x0000, | ||
}, | ||
endpoints = { | ||
{ | ||
endpoint_id = 0, | ||
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
}, | ||
device_types = { | ||
device_type_id = 0x0016, device_type_revision = 1, -- RootNode | ||
} | ||
}, | ||
{ | ||
endpoint_id = 1, | ||
clusters = { | ||
{cluster_id = clusters.RelativeHumidityMeasurement.ID, cluster_type = "SERVER"}, | ||
} | ||
} | ||
} | ||
}) | ||
|
||
local mock_device_temp_humidity = test.mock_device.build_test_matter_device({ | ||
profile = t_utils.get_profile_definition("temperature-humidity.yml"), | ||
manufacturer_info = { | ||
vendor_id = 0x0000, | ||
product_id = 0x0000, | ||
}, | ||
endpoints = { | ||
{ | ||
endpoint_id = 0, | ||
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
}, | ||
device_types = { | ||
device_type_id = 0x0016, device_type_revision = 1, -- RootNode | ||
} | ||
}, | ||
{ | ||
endpoint_id = 1, | ||
clusters = { | ||
{cluster_id = clusters.RelativeHumidityMeasurement.ID, cluster_type = "SERVER"}, | ||
} | ||
}, | ||
{ | ||
endpoint_id = 2, | ||
clusters = { | ||
{cluster_id = clusters.TemperatureMeasurement.ID, cluster_type = "BOTH"}, | ||
} | ||
} | ||
} | ||
}) | ||
|
||
local cluster_subscribe_list_humidity_battery = { | ||
clusters.RelativeHumidityMeasurement.attributes.MeasuredValue, | ||
clusters.PowerSource.attributes.BatPercentRemaining | ||
} | ||
|
||
local cluster_subscribe_list_humidity_no_battery = { | ||
clusters.RelativeHumidityMeasurement.attributes.MeasuredValue | ||
} | ||
|
||
local cluster_subscribe_list_temp_humidity = { | ||
clusters.RelativeHumidityMeasurement.attributes.MeasuredValue, | ||
clusters.TemperatureMeasurement.attributes.MeasuredValue | ||
} | ||
|
||
local function test_init_humidity_battery() | ||
local subscribe_request_humidity_battery = cluster_subscribe_list_humidity_battery[1]:subscribe(mock_device_humidity_battery) | ||
for i, cluster in ipairs(cluster_subscribe_list_humidity_battery) do | ||
if i > 1 then | ||
subscribe_request_humidity_battery:merge(cluster:subscribe(mock_device_humidity_battery)) | ||
end | ||
end | ||
|
||
test.socket.matter:__expect_send({mock_device_humidity_battery.id, subscribe_request_humidity_battery}) | ||
test.mock_device.add_test_device(mock_device_humidity_battery) | ||
mock_device_humidity_battery:expect_metadata_update({ profile = "humidity-battery" }) | ||
end | ||
|
||
local function test_init_humidity_no_battery() | ||
local subscribe_request_humidity_no_battery = cluster_subscribe_list_humidity_no_battery[1]:subscribe(mock_device_humidity_no_battery) | ||
for i, cluster in ipairs(cluster_subscribe_list_humidity_no_battery) do | ||
if i > 1 then | ||
subscribe_request_humidity_no_battery:merge(cluster:subscribe(mock_device_humidity_no_battery)) | ||
end | ||
end | ||
|
||
test.socket.matter:__expect_send({mock_device_humidity_no_battery.id, subscribe_request_humidity_no_battery}) | ||
test.mock_device.add_test_device(mock_device_humidity_no_battery) | ||
mock_device_humidity_no_battery:expect_metadata_update({ profile = "humidity" }) | ||
end | ||
|
||
local function test_init_temp_humidity() | ||
local subscribe_request_temp_humidity = cluster_subscribe_list_temp_humidity[1]:subscribe(mock_device_temp_humidity) | ||
for i, cluster in ipairs(cluster_subscribe_list_temp_humidity) do | ||
if i > 1 then | ||
subscribe_request_temp_humidity:merge(cluster:subscribe(mock_device_temp_humidity)) | ||
end | ||
end | ||
|
||
test.socket.matter:__expect_send({mock_device_temp_humidity.id, subscribe_request_temp_humidity}) | ||
test.mock_device.add_test_device(mock_device_temp_humidity) | ||
mock_device_temp_humidity:expect_metadata_update({ profile = "temperature-humidity" }) | ||
end | ||
|
||
test.register_coroutine_test( | ||
"Test profile change on init for humidity sensor with battery", | ||
function() | ||
end, | ||
{ test_init = test_init_humidity_battery } | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test profile change on init for humidity sensor without battery", | ||
function() | ||
end, | ||
{ test_init = test_init_humidity_no_battery } | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test profile change on init for temperature-humidity sensor", | ||
function() | ||
end, | ||
{ test_init = test_init_temp_humidity } | ||
) | ||
|
||
test.run_registered_tests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.