-
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?
Matter Window Covering: Update preset handling #2295
Conversation
This change utilizes the setPresetPosition command that was recently added to the windowCoveringPreset capability to set the preset rather than using an embedded preference.
Duplicate profile check: Warning - duplicate profiles detected. |
Invitation URL: |
Test Results 68 files 447 suites 0s ⏱️ Results for commit c40d936. ♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against c40d936 |
device:emit_event(capabilities.windowShadePreset.supportedCommands({"presetPosition", "setPresetPosition"}, {visibility = {displayed = false}})) | ||
if device:supports_capability_by_id(capabilities.windowShadePreset.ID) and | ||
device:get_latest_state("main", capabilities.windowShadePreset.ID, capabilities.windowShadePreset.position.NAME) == nil then | ||
device:emit_event(capabilities.windowShadePreset.position(PRESET_LEVEL, {visibility = {displayed = false}})) | ||
end |
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 by init
. After migration is complete we can remove the init
code and add the added
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!
These events are already present in the init handler and can be moved to added after the migration is complete.
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 comment
The 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 presetPosition
command
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.
Good call, I updated the test case called 'Handle preset commands' to verify this behavior in the latest commit
Remove preset preference from test cases in favor of using setPresetPosition command to set preset lift value, and update test case to verify the behavior.
Type of Change
Checklist
Description of Change
This change utilizes the setPresetPosition command that was recently added to the windowShadePreset capability to set the preset rather than using an embedded preference.
Summary of Completed Tests
Tested new attributes via SmartThings cli and updated UTs.