Update matter window covering edge driver#3052
Conversation
571f3d8 to
efdf5b3
Compare
|
Edge driver development for R2 new feature (https://smartthings.atlassian.net/browse/CHAD-18661) |
c659987 to
f5b95e2
Compare
hcarter-775
left a comment
There was a problem hiding this comment.
Seems like the new fields may be unnecessary, and may be adding some unnecessary complexity
| -- Step control logic | ||
| local target_level_field = device:get_field(LATEST_TARGET_LEVEL) | ||
| if target_level_field and attribute == capabilities.windowShadeLevel.shadeLevel then | ||
| -- Allow ±1 degree tolerance for reaching target | ||
| if math.abs(position - target_level_field) <= TARGET_REACH_TOLERANCE then | ||
| -- Device reached target position, clear target marker and timeout timer | ||
| device:set_field(LATEST_TARGET_LEVEL, nil) | ||
| local timer = device:get_field(TARGET_LEVEL_TIME_OUT) | ||
| if timer ~= nil then | ||
| device.thread:cancel_timer(timer) | ||
| device:set_field(TARGET_LEVEL_TIME_OUT, nil) | ||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
I don't think I understand why this is useful. The command will send the device here anyway? This just removes the field without changing anything as far as I can see
There was a problem hiding this comment.
If the clearing operation is not performed, if the user manually pulls the curtain or sends the setShadeLevel command to change the curtain position within 30 seconds before the timer triggers, the baseline value (in line 194) will be an expired target value when the step command is sent subsequently, instead of the actual position of the curtain, causing the curtain to move to the wrong position.
There was a problem hiding this comment.
I think the issue here is rather that the timeout is too long. We should probably just make the timeout shorter, since all that the timer is doing is affecting the step-level functionality.
I propose we make the timer ~5 seconds or so, and then remove this logic altogether
There was a problem hiding this comment.
We believe it's better to retain this part, as it makes the logic more rigorous and avoids some extreme cases.
There was a problem hiding this comment.
I propose we make the timeout shorter, to more like 10 or 15 seconds.
There was a problem hiding this comment.
Okay, we'll change it to 15 seconds.
|
Duplicate profile check: Warning - duplicate profiles detected. |
|
Invitation URL: |
Test Results 73 files ± 0 521 suites ±0 0s ⏱️ ±0s For more details on these errors, see this check. Results for commit ccbd180. ± Comparison against base commit f8e07b8. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against ccbd180 |
|
Hi, I just had the workflows run and there are some warnings showing up. Can you fix these warnings as well? Thanks! |
f5b95e2 to
ccbd180
Compare
accidental approval, unit tests and comments must still be addressed
ccbd180 to
734a936
Compare
|
The statelessWindowShadeLevelStep capability is newly introduced in version 62 (dev), so the driver tests on versions 59 to 61 have failed. |
734a936 to
d62b349
Compare
| local lift_percentage_value | ||
| if device:get_field(REVERSE_POLARITY) then | ||
| lift_percentage_value = target_level | ||
| else | ||
| lift_percentage_value = 100 - target_level | ||
| end | ||
| local hundredths_lift_percentage = lift_percentage_value * 100 | ||
|
|
||
| local endpoint_id = device:component_to_endpoint(cmd.component) | ||
| local req = clusters.WindowCovering.server.commands.GoToLiftPercentage( | ||
| device, endpoint_id, hundredths_lift_percentage | ||
| ) | ||
| device:send(req) |
There was a problem hiding this comment.
| local lift_percentage_value | |
| if device:get_field(REVERSE_POLARITY) then | |
| lift_percentage_value = target_level | |
| else | |
| lift_percentage_value = 100 - target_level | |
| end | |
| local hundredths_lift_percentage = lift_percentage_value * 100 | |
| local endpoint_id = device:component_to_endpoint(cmd.component) | |
| local req = clusters.WindowCovering.server.commands.GoToLiftPercentage( | |
| device, endpoint_id, hundredths_lift_percentage | |
| ) | |
| device:send(req) | |
| driver:inject_capability_command(device, { | |
| capability = capabilities.windowShadeLevel.ID, | |
| component = command.component, | |
| command = capabilities.windowShadeLevel.commands.setShadeLevel.NAME, | |
| named_args = { shadeLevel = target_level } | |
| }) |
This will allow the handler to support the closure device type as well. This also makes me realize that the current setShadeLevel handlers (here and in the closure subdriver) do not support "reverse". We must add this with this implementation. Thanks
There was a problem hiding this comment.
We've added reverse polarity support to handle_shade_level.
Signed-off-by: Hong Ye/MDE Lab /SRC-Nanjing/Staff Engineer/Samsung Electronics <hong.ye@samsung.com>
d62b349 to
f1bfc46
Compare
| {test_init = test_init_door} | ||
| ) | ||
|
|
||
| -- Test: handle_level command for door type |
There was a problem hiding this comment.
Hi, I think a lot of unrelated unit tests have been added to this file, related to various utilities of the closures subdriver. I think these are outside the scope of this PR and should be removed for now.
I also do not see any unit tests directly related to the stateless step handling, which would be the tests within scope that we'd need.
There was a problem hiding this comment.
Okay, tests irrelevant to this PR change have been removed.
There was a problem hiding this comment.
Hi @partner-hub-chenxuelong , perhaps I'm not seeing something, but that does not appear to be true? Would you mind checking this again?
|
TC has been updated. Please recalculate the coverage |
| } | ||
| ) | ||
|
|
||
| -- Test power_source_attribute_list_handler - BatChargeLevel present |
There was a problem hiding this comment.
we have way too many tests added in this file as well. Please prune these to only the relevant files to this PR
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests
Co-Authored-By: Cline SR (50%)
CGAI & AI Review