Skip to content
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

[Aqara] Cube T1 Pro #930

Merged
merged 10 commits into from
Dec 1, 2023

Conversation

seojune79
Copy link
Contributor

add Aqara Cube T1 Pro

@github-actions
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

github-actions bot commented Aug 23, 2023

Channel deleted.

@github-actions
Copy link

github-actions bot commented Aug 23, 2023

Test Results

     55 files     347 suites   0s ⏱️
1 628 tests 1 628 ✔️ 0 💤 0
2 856 runs  2 856 ✔️ 0 💤 0

Results for commit a5c0857.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Aug 23, 2023

File Coverage
All files 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/Aqara/aqara-cube/src/init.lua 97%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against a5c0857

Comment on lines 51 to 52
delete_timer(device)
device:set_field(CUBEACTION_TIMER, device.thread:call_with_delay(CUBEACTION_TIME, callback_timer(driver, device)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines always appear together. I would suggest you pull all of this logic out into one function rather than defining two functions that are always called together in the same order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it.

local capabilities = require "st.capabilities"
local data_types = require "st.zigbee.data_types"
local clusters = require "st.zigbee.zcl.clusters"
local PowerConfiguration = clusters.PowerConfiguration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused: this is the luacheck error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you should write a configuration test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed them.

Copy link
Contributor

@greens greens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is another case where it doesn't really seem right to have this device under one of our generic drivers. It has no shared functionality with zigbee-button at all. @tpmanley and @ctowns what do you think?

local timer = device:get_field(CUBEACTION_TIMER)
if timer then
device.thread:cancel_timer(timer)
device:set_field(CUBEACTION_TIMER, nil, { persist = true })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't need to persist

it takes more than 3s to reboot the hub anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see it.

device.thread:cancel_timer(timer)
device:set_field(CUBEACTION_TIMER, nil, { persist = true })
end
device:set_field(CUBEACTION_TIMER, device.thread:call_with_delay(CUBEACTION_TIME, callback_timer(driver, device)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

driver is undefined here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but isn't used in callback_timer, so it can be removed there too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied the changes you requested.

@lelandblue
Copy link
Contributor

Should the firmwareUpdate capability also be included?

version: 1
- id: battery
version: 1
- id: firmwareUpdate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lelandblue it's here

@tpmanley
Copy link
Contributor

So this is another case where it doesn't really seem right to have this device under one of our generic drivers. It has no shared functionality with zigbee-button at all. @tpmanley and @ctowns what do you think?

Apologies for the delay. In addition to no shared functionality with zigbee-button, it also doesn't use the button capability (although it does use the RemoteController category). I wouldn't be opposed to putting this in its own driver, similar to the Pet Feeder. Is that what you were thinking too?

@greens
Copy link
Contributor

greens commented Sep 25, 2023

@tpmanley that's correct

@lelandblue
Copy link
Contributor

Hey @seojune79 We would like to see this device use its own driver due to the uniqueness of the device. Can you please refactor this PR to be an independent driver in the Aqara folder please?

Also just so your aware I attempted this driver with a T1 Pro device on my hub and it was not responsive to the rotation of the cube.

@seojune79
Copy link
Contributor Author

Also just so your aware I attempted this driver with a T1 Pro device on my hub and it was not responsive to the rotation of the cube

I have changed the folder of the cube.
Please refer to the video for the cube rotation.
https://drive.google.com/file/d/1NEebgX0n_pPR8gFul2hyD9drBITsuoM2/view

init = device_init,
added = device_added
},
can_handle = is_aqara_products
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a base driver, you do not need to supply a can_handle function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was removed can_handle.

@lelandblue lelandblue requested a review from wkhenon November 14, 2023 01:06
@lelandblue lelandblue merged commit 31329ec into SmartThingsCommunity:main Dec 1, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants