-
Notifications
You must be signed in to change notification settings - Fork 502
Matter Window Covering: Update preset handling #2295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
f4aff88
81a52e4
5e76c3a
c40d936
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,21 @@ local CLUSTER_SUBSCRIBE_LIST_NO_BATTERY = { | |
WindowCovering.server.attributes.OperationalStatus, | ||
} | ||
|
||
local function set_preset(device) | ||
test.socket.capability:__expect_send( | ||
device:generate_test_message( | ||
"main", capabilities.windowShadePreset.supportedCommands({"presetPosition", "setPresetPosition"}, {visibility = {displayed = false}}) | ||
) | ||
) | ||
test.socket.capability:__expect_send( | ||
device:generate_test_message( | ||
"main", capabilities.windowShadePreset.position(30, {visibility = {displayed = false}}) | ||
) | ||
) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd maybe extend this test just to verify that the updated value is used for the next There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, I updated the test case called 'Handle preset commands' to verify this behavior in the latest commit |
||
|
||
local function test_init() | ||
set_preset(mock_device) | ||
local subscribe_request = CLUSTER_SUBSCRIBE_LIST[1]:subscribe(mock_device) | ||
for i, clus in ipairs(CLUSTER_SUBSCRIBE_LIST) do | ||
if i > 1 then subscribe_request:merge(clus:subscribe(mock_device)) end | ||
|
@@ -139,6 +153,7 @@ local function test_init() | |
end | ||
|
||
local function test_init_switch_to_battery() | ||
set_preset(mock_device_switch_to_battery) | ||
local subscribe_request = CLUSTER_SUBSCRIBE_LIST_NO_BATTERY[1]:subscribe(mock_device_switch_to_battery) | ||
for i, clus in ipairs(CLUSTER_SUBSCRIBE_LIST_NO_BATTERY) do | ||
if i > 1 then subscribe_request:merge(clus:subscribe(mock_device_switch_to_battery)) end | ||
|
@@ -152,6 +167,7 @@ local function test_init_switch_to_battery() | |
end | ||
|
||
local function test_init_mains_powered() | ||
set_preset(mock_device_mains_powered) | ||
local subscribe_request = CLUSTER_SUBSCRIBE_LIST_NO_BATTERY[1]:subscribe(mock_device_mains_powered) | ||
for i, clus in ipairs(CLUSTER_SUBSCRIBE_LIST_NO_BATTERY) do | ||
if i > 1 then subscribe_request:merge(clus:subscribe(mock_device_mains_powered)) end | ||
|
@@ -684,6 +700,11 @@ test.register_coroutine_test( | |
}, | ||
} | ||
) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message( | ||
"main", capabilities.windowShadePreset.supportedCommands({"presetPosition", "setPresetPosition"}, {visibility = {displayed = false}}) | ||
) | ||
) | ||
test.wait_for_events() | ||
|
||
test.socket.capability:__queue_receive( | ||
|
@@ -774,7 +795,7 @@ test.register_coroutine_test("OperationalStatus report contains current position | |
) | ||
end) | ||
|
||
test.register_coroutine_test("Handle windowcoveringPreset", function() | ||
test.register_coroutine_test("Handle presetPosition command", function() | ||
test.socket.capability:__queue_receive( | ||
{ | ||
mock_device.id, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ultimately decided to omit the additions in the
added
handler for now, since these events will be sent byinit
. After migration is complete we can remove theinit
code and add theadded
events.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, updated in the latest commit!