-
Notifications
You must be signed in to change notification settings - Fork 461
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 support for Inovelli VTM31-SN Dimmer Switch #1754
base: main
Are you sure you want to change the base?
Conversation
Duplicate profile check: Passed - no duplicate profiles detected. |
Invitation URL: |
Minimum allowed coverage is Generated by 🐒 cobertura-action against f48add6 |
|
||
local LATEST_CLOCK_SET_TIMESTAMP = "latest_clock_set_timestamp" | ||
|
||
local preference_map_inovelli_vtm31sn = { |
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 would make sense to move preferences that are specific to a certain device to a sub driver if we are able to. Or these configs could be moved to their own file at least to keep it separate from the base driver where we should try to handle things as generically as possible
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 moved the inovelli-specific handling to a subdriver in 2e8b4b5
for id, value in pairs(device.preferences) do | ||
if args.old_st_store.preferences[id] ~= value and preferences and preferences[id] then | ||
local new_parameter_value = preferences_to_numeric_value(device.preferences[id]) | ||
local req = clusters.ModeSelect.server.commands.ChangeToMode(device, preferences[id].parameter_number, new_parameter_value) |
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 the mode cluster is going to be used here, this would be the first use of it in the matter-switch
driver. This means we'd need to add it as an embedded cluster so it could be used on older FW that doesn't support the mode cluster via the lua libs definitions yet.
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 looks like ModeSelect has been been in the spec since matter 1.0. Is there a way to check when it was first added to the lua libs?
return | ||
end | ||
|
||
if device.manufacturer_info.vendor_id == fingerprint_profile_overrides[1].vendor_id and |
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 code is somewhat confusing and I think it could use some comments or documentation somewhere since there is some device specific knowledge here. For example, why is the time diff here and what is the significance of the values?
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 this code is used to prevent preferences from being changed faster than every two seconds. This was the same way that Inovelli implemented this for the zigbee driver, so it could be a device limitation. I will add some comments to make things a little more clear.
Type of Change
Checklist
Description of Change
CHAD-14347
This change adds support for the Inovelli VTM31-SN Dimmer Switch. Initial support for this device was added by PR 1663. This PR includes a profile for this device with embedded preferences as well as handling for these preferences.
The preferences were created to match those defined in Inovelli's matter driver for this device.
Summary of Completed Tests
See here for screenshots from testing with the device.
Also see test_matter_multi_button_switch_mcd.lua which tests a mock device with a similar endpoint structure as the Inovelli device.