From 632e96c71954390c7ea169355c7cabf12a79a03b Mon Sep 17 00:00:00 2001 From: Abdul Samad Date: Wed, 31 Jan 2024 15:57:47 -0800 Subject: [PATCH 1/2] Fix the battery check in matter-thermostat, look for feature map --- drivers/SmartThings/matter-thermostat/src/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/SmartThings/matter-thermostat/src/init.lua b/drivers/SmartThings/matter-thermostat/src/init.lua index d221caeae8..eeba65e635 100644 --- a/drivers/SmartThings/matter-thermostat/src/init.lua +++ b/drivers/SmartThings/matter-thermostat/src/init.lua @@ -118,7 +118,7 @@ local function do_configure(driver, device) local thermo_eps = device:get_endpoints(clusters.Thermostat.ID) local fan_eps = device:get_endpoints(clusters.FanControl.ID) local humidity_eps = device:get_endpoints(clusters.RelativeHumidityMeasurement.ID) - local battery_eps = device:get_endpoints(clusters.PowerSource.ID) + local battery_eps = device:get_endpoints(clusters.PowerSource.ID, {feature_bitmap = clusters.PowerSource.types.PowerSourceFeature.BATTERY}) local profile_name = "thermostat" --Note: we have not encountered thermostats with multiple endpoints that support the Thermostat cluster if #thermo_eps == 1 then From 38a14ebe6ffaf6bd9c734212ad318e8c7e3391bb Mon Sep 17 00:00:00 2001 From: Cooper Towns Date: Thu, 1 Feb 2024 16:43:30 -0600 Subject: [PATCH 2/2] Fix unit tests for matter-thermostat battery check --- .../src/test/test_matter_thermo_featuremap.lua | 4 ++-- .../src/test/test_matter_thermo_setpoint_limits.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua index 3e408a16f4..a004c70c04 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua @@ -37,7 +37,7 @@ local mock_device = test.mock_device.build_test_matter_device({ endpoint_id = 1, clusters = { {cluster_id = clusters.FanControl.ID, cluster_type = "SERVER"}, - {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}, + {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}, { cluster_id = clusters.Thermostat.ID, cluster_revision=5, @@ -70,7 +70,7 @@ local mock_device_simple = test.mock_device.build_test_matter_device({ { endpoint_id = 1, clusters = { - {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}, + {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}, { cluster_id = clusters.Thermostat.ID, cluster_revision=5, diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua index f5f04b574a..a28296f1ec 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua @@ -42,7 +42,7 @@ local mock_device = test.mock_device.build_test_matter_device({ cluster_type="SERVER", feature_map=35, -- Heat, Cool, and Auto features. }, - {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}, + {cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}, } } }