-
Notifications
You must be signed in to change notification settings - Fork 491
Update lifecycle handling for Eve Energy and Aqara subdrivers #2116
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?
Update lifecycle handling for Eve Energy and Aqara subdrivers #2116
Conversation
Invitation URL: |
Test Results 66 files 426 suites 0s ⏱️ Results for commit 57452e8. ♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 57452e8 |
16cc922
to
cb70ab8
Compare
-- after 3 seconds of cubeAction, to automatically change the action status of Plugin UI or Device Card to noAction | ||
local CUBEACTION_TIMER = "__cubeAction_timer" | ||
local CUBEACTION_TIME = 3 | ||
|
||
local function is_aqara_cube(opts, driver, device) | ||
local name = string.format("%s", device.manufacturer_info.product_name) |
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.
device.manufacturer_info
does not exist for child devices. Moving this statement inside the if statement prevents an error from occurring here.
ea07e1b
to
653030b
Compare
653030b
to
ea1236c
Compare
With the changes from #2041, the matter-switch subdrivers should be updated to maintain consistency. This involves: * Moving the initialization code from device_init into do_configure * Implement the driverSwitched lifecycle event * Additionally, improve the lifecycle event testing for the Aqara subdriver, removing the `TEST_CONFIGURE` field and instead leveraging a technique used in other test files to set `device.profile.id` for a mock device.
cb70ab8
to
43e5825
Compare
The device can also emit LongPress events, and the subdriver needs to be updated to account for this.
Hi @DongHoon-Ryu , I made a few changes to the Aqara subdriver in this PR, to be more consistent with the changes from #2041 and a few minor changes to increase consistency with other subdrivers. Could you please review when you have a chance? One thing I noticed during testing is that the cube was sending the |
9771c42
to
57452e8
Compare
function() | ||
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) |
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.
should we be removing this part of the test?
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.
The profile update occurs in doConfigure now which is handled in the test init function to be more consistent with other test files
@@ -236,20 +251,11 @@ test.register_coroutine_test( | |||
test.register_coroutine_test( | |||
"Handle single press sequence in case of exhausted endpoint", | |||
function() | |||
test.socket.device_lifecycle:__queue_receive({ mock_device_exhausted.id, "added" }) |
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.
should we be removing this part of the test?
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.
Similar to above this was moved to the init function
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 | ||
end | ||
test.socket.matter:__expect_send({mock_device.id, subscribe_request}) | ||
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) |
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.
why is this logic being added to the init test? Shouldn't these be implemented as separate tests if required?
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.
This way each test case will run after already having gone through added
, doConfigure
, and infoChanged
, it's done this way in other test files as well, although not all of them include every lifecycle event.
Type of Change
Checklist
Description of Change
With the changes from
#2041, the matter switch subdrivers for Eve and Aqara should be updated to maintain consistency. This involves:
device_init
intodo_configure
TEST_CONFIGURE
field can be removed from the Aqara subdriver, leveraging a technique used in other test files to setdevice.profile.id
for a mock device.Lastly, while testing the Aqara Cube T1 Pro, it was found that the
LongPress
event was being emitted in place ofInitialPress
. This PR add support for handlingLongPress
, in case different versions of the device emit different event types.Note that some of the changes are purely cosmetic meant to increase consistency across the subdrivers and main driver.
Summary of Completed Tests
Tested with Eve Energy and Aqara Cube.