-
Notifications
You must be signed in to change notification settings - Fork 464
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
[Aqara] Cube T1 Pro #930
Conversation
Duplicate profile check: Passed - no duplicate profiles detected. |
Channel deleted. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against a5c0857 |
delete_timer(device) | ||
device:set_field(CUBEACTION_TIMER, device.thread:call_with_delay(CUBEACTION_TIME, callback_timer(driver, device))) |
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.
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.
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 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 |
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.
unused: this is the luacheck error
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.
maybe you should write a configuration 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.
I removed them.
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.
local timer = device:get_field(CUBEACTION_TIMER) | ||
if timer then | ||
device.thread:cancel_timer(timer) | ||
device:set_field(CUBEACTION_TIMER, nil, { persist = true }) |
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 doesn't need to persist
it takes more than 3s to reboot the hub anyway
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.
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))) |
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.
driver
is undefined here
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.
but isn't used in callback_timer
, so it can be removed there too
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 applied the changes you requested.
Should the firmwareUpdate capability also be included? |
version: 1 | ||
- id: battery | ||
version: 1 | ||
- id: firmwareUpdate |
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.
@lelandblue it's here
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? |
@tpmanley that's correct |
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. |
I have changed the folder of the cube. |
init = device_init, | ||
added = device_added | ||
}, | ||
can_handle = is_aqara_products |
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.
as a base driver, you do not need to supply a can_handle
function
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.
It was removed can_handle.
add Aqara Cube T1 Pro