-
Notifications
You must be signed in to change notification settings - Fork 476
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
Add Aqara Climate Sensor W100 #1843
Add Aqara Climate Sensor W100 #1843
Conversation
Duplicate profile check: Passed - no duplicate profiles detected. |
Channel deleted. |
Test Results 64 files 406 suites 0s ⏱️ Results for commit 8f513e2. ♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8f513e2 |
5020f3f
to
56b3fae
Compare
Since the matter-switch driver is the most complete and vast of our drivers, I believe it would be more prudent to include new humidity and temperature support in matter-switch rather than including the whole array of switch logic in matter-sensor. |
Thanks, I modified to support w100 in matter-switch, not matter-sensor. |
@@ -0,0 +1,99 @@ | |||
name: temperature-humidity-3-button-battery |
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.
can we change this name to 3-button-battery-temperature-humidity
? This follows the unofficial naming conventions more closely.
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 changed temperature-humidity-3-button-battery
to 3-button-battery-temperature-humidity
.
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.
@@ -0,0 +1,99 @@
+name: temperature-humidity-3-button-battery
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 main_endpoint = find_default_endpoint(device) | ||
local main_endpoint | ||
if device:supports_capability(capabilities.temperatureMeasurement) then | ||
-- In case of Aqara Climate Sensor W100, in order to sequentially set the button name to button1, 2, 3 |
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.
@nickolas-deboom out of curiosity, is this sequential ordering not the default handling? If not, seems like we should change that?
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 believe that what is happening is that since this device doesn't contain a 'switch' endpoint (aka an endpoint containing the OnOff cluster), find_default_endpoint
is returning the first button endpoint as the main endpoint. That would cause the first button component name to be 'main' and the other two would be 'button2' and 'button3'. I think that find_default_endpoint
should be updated rather than using the workaround here. Either it could be updated to check for an endpoint containing the TemperatureMeasurement
(or RelativeHumidityMeasurement
) cluster and return that as the default endpoint if one exists, or it could be updated to just return the first non-button endpoint if one exists (rather than checking for OnOff
/TemperatureMeasurement
/RelativeHumidityMeasurement
clusters).
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.
Yes, +1 to this
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.
@nickolas-deboom @DongHoon-Ryu not that this is a huge deal, but I think these changes that Nick suggested were missed in this PR.
local main_endpoint = find_default_endpoint(device) | ||
local main_endpoint | ||
if device:supports_capability(capabilities.temperatureMeasurement) then | ||
-- In case of Aqara Climate Sensor W100, in order to sequentially set the button name to button1, 2, 3 |
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.
nit:
-- In case of Aqara Climate Sensor W100, in order to sequentially set the button name to button1, 2, 3 | |
-- In case of Aqara Climate Sensor W100, in order to sequentially set the button name to button 1, 2, 3 |
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.
@hcarter-775 I modified as below. I deleted the fingerprint of the Aqara Climate Sensor W100
device and modified it as follows because device:supports_capability
is not available at the init
stage if there is no fingerprint of the device. The reason for deleting fingerprint is added to the review opinion below.
local temperature_eps = device:get_endpoints(clusters.TemperatureMeasurement.ID)
local humidity_eps = device:get_endpoints(clusters.RelativeHumidityMeasurement.ID)
if #temperature_eps > 0 and #humidity_eps > 0 then
-- In case of Aqara Climate Sensor W100, in order to sequentially set the button name to button 1, 2, 3
main_endpoint = device.MATTER_DEFAULT_ENDPOINT
else
main_endpoint = find_default_endpoint(device)
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.
@DongHoon-Ryu thank you for making this update, it addresses the comment I made above as well.
if device:supports_capability(capabilities.temperatureMeasurement) then | ||
-- to call configure_buttons, keep the profile_name as nil. | ||
device.log.debug("So far, it means Aqara Climate Sensor W100.") | ||
elseif battery_support then | ||
profile_name = string.format("%d-button-battery", #button_eps) | ||
else | ||
profile_name = string.format("%d-button", #button_eps) |
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.
if device:supports_capability(capabilities.temperatureMeasurement) then | |
-- to call configure_buttons, keep the profile_name as nil. | |
device.log.debug("So far, it means Aqara Climate Sensor W100.") | |
elseif battery_support then | |
profile_name = string.format("%d-button-battery", #button_eps) | |
else | |
profile_name = string.format("%d-button", #button_eps) | |
if device:supports_capability(capabilities.temperatureMeasurement) and device:supports_capability(capabilities.relativeHumidityMeasurement) then | |
profile_name = "temperature-humidity" | |
end | |
if battery_support then | |
profile_name = string.format("%d-button-battery", #button_eps) .. profile_name | |
else | |
profile_name = string.format("%d-button", #button_eps) .. profile_name |
@nickolas-deboom do you think we should support full dynamicism here (a device:get_endpoints() call) or is leaving this as a fingerprint specific handling ok?
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_name
assumes the profile name has been changed according to my previous comment
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 am fine with it either way for now, especially since we'd just be re-profiling to the same profile it has already joined. If we start supporting more devices like this in the future then I'd definitely support making it more dynamic.
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.
agreed, that was my thinking as well
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.
@nickolas-deboom @hcarter-775 If we use fingerprint of Aqara Climate Sensor W100
device, there is a problem that configure_buttons(device)
is not called because a value is assigned to profile_name
. So I modified to use the number of temperature_eps
and humidity_eps
obtained using device:get_endpoints
to specify profile in the more dynamic way you mentioned.
if #button_eps > 1 and tbl_contains(STATIC_BUTTON_PROFILE_SUPPORTED, #button_eps) then
if #temperature_eps > 0 and #humidity_eps > 0 then
device.log.debug("So far, it means Aqara Climate Sensor W100.")
profile_name = "-temperature-humidity"
end
if battery_support then
profile_name = string.format("%d-button-battery", #button_eps) .. profile_name
else
profile_name = string.format("%d-button", #button_eps) .. profile_name
end
elseif not battery_support then
-- a battery-less button/remote
profile_name = "button"
end
if profile_name ~= "" then
device:try_update_metadata({profile = profile_name})
device:set_field(DEFERRED_CONFIGURE, true)
device:set_field(BUTTON_DEVICE_PROFILED, true)
else
configure_buttons(device)
end
This device has a Temperature Sensor(0x0302), a Humidity Sensor(0x0307), and 3 Generic Switchs(0x000F).
…ensor." This reverts commit 511f361.
2136d4d
to
423c1ec
Compare
…y it to operate more dynamically
@nickolas-deboom @hcarter-775 @Apshakil Thank you for your comments on many reviews all the time. Please review and if there is no problem, please approve. |
@DongHoon-Ryu this looks good to me! Thank you for making the requested updates. |
* Add Aqara Climate Sensor W100 This device has a Temperature Sensor(0x0302), a Humidity Sensor(0x0307), and 3 Generic Switchs(0x000F). * It is modified to support w100 in Matter-switch, not Matter-sensor. * Revert "It is modified to support w100 in Matter-switch, not Matter-sensor." This reverts commit 511f361. * It is modified to support w100 in matter-switch, not matter-sensor. * It is modified to support w100 in matter-switch, not matter-sensor. * Use device:get_endpoints to delete the device's fingerprint and modify it to operate more dynamically
This device has a Temperature Sensor(0x0302), a Humidity Sensor(0x0307), and 3 Generic Switchs(0x000F).
Check all that apply
Type of Change
Checklist
Description of Change
As the first type of device with buttons in the sensor device, button feature is added to the sensor EdgeDriver
Summary of Completed Tests
Successful test for Plugin UI and Dashboard update according to the change of sensor or button operation