-
Notifications
You must be signed in to change notification settings - Fork 485
Matter Switch: Add subdriver for Third Reality MK1 #2109
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?
Conversation
Duplicate profile check: Passed - no duplicate profiles detected. |
Invitation URL: |
Test Results 66 files 427 suites 0s ⏱️ Results for commit 064c7a6. ♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 064c7a6 |
Is there a reason why the profiles for 9, 10 and 11 buttons are intentionally omitted? A device like the 3rd Reality MK1 Keyboard would work out of the box with these profiles. The device and the platform are Matter certified after all... |
This PR is specifically meant for supporting the 3rd Reality MK1. |
7a822d1
to
ccbdbbd
Compare
52e5174
to
bc937cc
Compare
drivers/SmartThings/matter-switch/src/third-reality-mk1/init.lua
Outdated
Show resolved
Hide resolved
end | ||
|
||
local function device_added(driver, device) | ||
device_init(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.
maybe let's just subscribe or even return
here rather than re-call the whole init? I understand we're mostly doing this call to overwrite the main driver, so I think we could also make a comment of 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.
The main driver also calls device_init within device_added, which was done to ensure init is called in the case of device caching: ed8fe8f
So I think it might be needed here still?
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.
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 was done to ensure that subscribe
was called for all devices, because in some cases there is a race condition that causes the init
event to not fire for some devices. Therefore, calling init
again in added
was meant to ensure that the processing in init
was occuring even if the init
event was not queued due to the race condition.
Parent-Child devices were primarily affected, so I wouldn't expect it to be an issue here.
There is a detail explanation here: https://smartthings.atlassian.net/browse/CHAD-13449
local function match_profile(driver, device) | ||
device:try_update_metadata({profile = "12-button-keyboard"}) | ||
build_button_component_map(device) | ||
configure_buttons(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.
would we want to use the new buttons.configure call here 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.
Yes but that will need to wait until PR 1754 gets merged (or if this one gets merged first, then that other PR will need to do this change)
local function info_changed(driver, device, event, args) | ||
if device.profile.id ~= args.old_st_store.profile.id then | ||
configure_buttons(device) | ||
subscribe(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.
You could potentially just override the device:subscribe
function directly by calling:
device:extend_device("subscribe", subscribe)
which will override the library subscribe
function directly and point the device to the subscribe
function you have defined here. I can't think of any cases where this would be needed over the solution you currently have, but if a library function call somewhere calls device:subscribe
, it might be nice to just have the default subscribe
itself overridden, since that is what the extend_device
api is meant to be used for.
49ba419
to
ea07e1b
Compare
ac5d0a0
to
02b2f8a
Compare
ea07e1b
to
653030b
Compare
02b2f8a
to
07b6e65
Compare
653030b
to
ea1236c
Compare
07b6e65
to
2e69acd
Compare
Add new profile and a subdriver to support the Third Reality keyboard, which contains 12 matter-enabled buttons.
2e69acd
to
064c7a6
Compare
Type of Change
Description of Change
Add new profile and a subdriver to support the Third Reality keyboard, which contains 12 matter-enabled buttons.
Summary of Testing
Tested on device and with new unit tests.