Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ function AttributeHandlers.current_saturation_handler(driver, device, ib, respon
end

function AttributeHandlers.color_temperature_mireds_handler(driver, device, ib, response)
if type(device.register_native_capability_attr_handler) == "function" then
device:register_native_capability_attr_handler("colorTemperature", "colorTemperature")
end
local temp_in_mired = ib.data.value
if temp_in_mired == nil then
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,44 +294,8 @@ test.register_message_test(
)

test.register_message_test(
"Extended Color Child: X and Y color values should report hue and saturation once both have been received",
{
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.ColorControl.attributes.CurrentX:build_test_report_data(mock_device, extended_color_ep_id, 15091)
}
},
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.ColorControl.attributes.CurrentY:build_test_report_data(mock_device, extended_color_ep_id, 21547)
}
},
{
channel = "capability",
direction = "send",
message = mock_children[extended_color_ep_id]:generate_test_message("main", capabilities.colorControl.hue(50))
},
{
channel = "capability",
direction = "send",
message = mock_children[extended_color_ep_id]:generate_test_message("main", capabilities.colorControl.saturation(72))
}
},
{
min_api_version = 17
}
)

test.register_message_test(
"Extended Color Child: colorTemperatureRange, setColorTemperature, stepColorTemperatureByPercent handled appropriately",
"Extended Color Child: SetColor command should be handled correctly",
{
-- setColorTemperature before a color temperature range is set
{
channel = "capability",
direction = "receive",
Expand All @@ -356,6 +320,12 @@ test.register_message_test(
clusters.ColorControl.server.commands.MoveToColor:build_test_command_response(mock_device, extended_color_ep_id)
}
},
}
)

test.register_message_test(
"Extended Color Child: X and Y color values should report hue and saturation once both have been received",
{
{
channel = "matter",
direction = "receive",
Expand All @@ -381,8 +351,16 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_children[extended_color_ep_id]:generate_test_message("main", capabilities.colorControl.saturation(72))
},
}
},
{
min_api_version = 17
}
)

test.register_message_test(
"Extended Color Child: colorTemperatureRange, setColorTemperature, colorTemperature, stepColorTemperatureByPercent handled appropriately",
{
-- colorTemperatureRange testing
{
channel = "matter",
Expand Down Expand Up @@ -432,6 +410,29 @@ test.register_message_test(
}
}, -- 555 is expected since it is re-bounded by the given range

-- colorTemperature testing
{
channel = "matter",
direction = "receive",
message = {
mock_device.id,
clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, extended_color_ep_id, 555)
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_attr_handler",
{ device_uuid = mock_device.id, capability_id = "colorTemperature", capability_attr_id = "colorTemperature" }
}
},
{
channel = "capability",
direction = "send",
message = mock_children[extended_color_ep_id]:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800))
},

-- stepColorTemperatureByPercent testing
{
channel = "capability",
Expand Down Expand Up @@ -459,7 +460,7 @@ test.register_message_test(
},
},
{
min_api_version = 17
min_api_version = 17
}
)

Expand Down
32 changes: 32 additions & 0 deletions drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ test.register_message_test(
clusters.ColorControl.server.commands.MoveToColorTemperature:build_test_command_response(mock_device, 1)
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_attr_handler",
{ device_uuid = mock_device.id, capability_id = "colorTemperature", capability_attr_id = "colorTemperature" }
}
},
{
channel = "matter",
direction = "receive",
Expand Down Expand Up @@ -297,6 +305,14 @@ test.register_message_test(
mock_device.id,
clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, 1, 0)
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_attr_handler",
{ device_uuid = mock_device.id, capability_id = "colorTemperature", capability_attr_id = "colorTemperature" }
}
}
},
{
Expand Down Expand Up @@ -396,6 +412,14 @@ test.register_message_test(
clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, 1, 160)
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_attr_handler",
{ device_uuid = mock_device.id, capability_id = "colorTemperature", capability_attr_id = "colorTemperature" }
}
},
{
channel = "capability",
direction = "send",
Expand All @@ -409,6 +433,14 @@ test.register_message_test(
clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, 1, 370)
}
},
{
channel = "devices",
direction = "send",
message = {
"register_native_capability_attr_handler",
{ device_uuid = mock_device.id, capability_id = "colorTemperature", capability_attr_id = "colorTemperature" }
}
},
{
channel = "capability",
direction = "send",
Expand Down
Loading