Skip to content

Commit a0b601f

Browse files
committed
Only add temperatureMeasurement capability if not already added
1 parent 4e50d52 commit a0b601f

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

drivers/SmartThings/matter-thermostat/src/init.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -883,32 +883,32 @@ local function match_modular_profile_air_purifer(driver, device)
883883
local CAPABILITIES_LIST_IDX = 2
884884

885885
local humidity_eps = device:get_endpoints(clusters.RelativeHumidityMeasurement.ID)
886-
local temp_eps = embedded_cluster_utils.get_endpoints(device, clusters.temperatureMeasurement.ID)
886+
local temp_eps = embedded_cluster_utils.get_endpoints(device, clusters.TemperatureMeasurement.ID)
887887
if #humidity_eps > 0 then
888888
table.insert(main_component_capabilities, capabilities.relativeHumidityMeasurement.ID)
889889
end
890890
if #temp_eps > 0 then
891-
table.insert(main_component_capabilities, capabilities.relativeHumidityMeasurement.ID)
891+
table.insert(main_component_capabilities, capabilities.temperatureMeasurement.ID)
892892
end
893893

894894
local hepa_filter_eps = embedded_cluster_utils.get_endpoints(device, clusters.HepaFilterMonitoring.ID)
895895
local ac_filter_eps = embedded_cluster_utils.get_endpoints(device, clusters.ActivatedCarbonFilterMonitoring.ID)
896896

897897
if #hepa_filter_eps > 0 then
898-
table.insert(hepa_filter_component_capabilities, capabilities.filterStatus.ID)
899-
900898
local filter_state_eps = embedded_cluster_utils.get_endpoints(device, clusters.HepaFilterMonitoring.ID, {feature_bitmap = clusters.HepaFilterMonitoring.types.Feature.CONDITION})
901899
if #filter_state_eps > 0 then
902900
table.insert(hepa_filter_component_capabilities, capabilities.filterState.ID)
903901
end
902+
903+
table.insert(hepa_filter_component_capabilities, capabilities.filterStatus.ID)
904904
end
905905
if #ac_filter_eps > 0 then
906-
table.insert(ac_filter_component_capabilties, capabilities.filterStatus.ID)
907-
908906
local filter_state_eps = embedded_cluster_utils.get_endpoints(device, clusters.ActivatedCarbonFilterMonitoring.ID, {feature_bitmap = clusters.ActivatedCarbonFilterMonitoring.types.Feature.CONDITION})
909907
if #filter_state_eps > 0 then
910908
table.insert(ac_filter_component_capabilties, capabilities.filterState.ID)
911909
end
910+
911+
table.insert(ac_filter_component_capabilties, capabilities.filterStatus.ID)
912912
end
913913

914914
-- determine fan capabilities, note that airPurifierFanMode is already mandatory
@@ -927,7 +927,11 @@ local function match_modular_profile_air_purifer(driver, device)
927927
if #thermostat_eps > 0 then
928928
-- thermostatMode and temperatureMeasurement should be expected if thermostat is present
929929
table.insert(main_component_capabilities, capabilities.thermostatMode.ID)
930-
table.insert(main_component_capabilities, capabilities.temperatureMeasurement.ID)
930+
931+
-- only add temperatureMeasurement if it is not already added via TemperatureMeasurement cluster support
932+
if #temp_eps == 0 then
933+
table.insert(main_component_capabilities, capabilities.temperatureMeasurement.ID)
934+
end
931935
local thermostat_capabilities = get_thermostat_optional_capabilities(device)
932936
for _, capability_id in pairs(thermostat_capabilities) do
933937
table.insert(main_component_capabilities, capability_id)

drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_modular.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ local expected_update_metadata= {
302302
"main",
303303
{
304304
"relativeHumidityMeasurement",
305+
"temperatureMeasurement",
305306
"fanOscillationMode",
306307
"windMode",
307308
"thermostatMode",
308-
"temperatureMeasurement",
309309
"thermostatHeatingSetpoint",
310310
"airQualityHealthConcern",
311311
"dustSensor",

0 commit comments

Comments
 (0)