Support additional Camera device types#2590
Conversation
|
Duplicate profile check: Passed - no duplicate profiles detected. |
|
Invitation URL: |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 42bfb6a |
samadDotDev
left a comment
There was a problem hiding this comment.
Will need to re-evaluate after rebase
96ccae6 to
67332b9
Compare
e012e2a to
a25f0c7
Compare
| @@ -6,116 +6,166 @@ local dkjson = require "dkjson" | |||
| local clusters = require "st.matter.clusters" | |||
|
|
|||
| local mock_device = test.mock_device.build_test_matter_device({ | |||
There was a problem hiding this comment.
Mentioned elsewhere, but after making the changes in 0542fb3 the tests here began to fail because they expect subscriptions to the button events yet no endpoints with the Switch cluster were present in the mock device. I added the endpoints and also fixed the tabbing in this file which is why the diff looks so large
31bd85e to
164095f
Compare
| if status_light_brightness_present then | ||
| table.insert(status_led_component_capabilities, capabilities.mode.ID) | ||
| end | ||
| if #device:get_endpoints(clusters.Chime.ID, {cluster_type = "SERVER"}) > 0 then |
There was a problem hiding this comment.
SERVER or BOTH? Basically reuse logic similar to has_server_cluster_type()
There was a problem hiding this comment.
Done in b082796, does that look alright? It uses the first endpoint containing the Chime cluster, but I wasn't sure if the client and server clusters would necessarily be on the same endpoint or not
b1faa74 to
297c2e3
Compare
| --- @param subscribed_events table key-value pairs mapping capability ids to subscribed events | ||
| function utils.populate_subscribe_request_for_device(checked_device, subscribe_request, capabilities_seen, attributes_seen, events_seen, subscribed_attributes, subscribed_events) | ||
| for _, component in pairs(checked_device.st_store.profile.components) do | ||
| function utils.populate_subscribe_request_for_device(checked_device, parent_device, subscribe_request, capabilities_seen, attributes_seen, events_seen, subscribed_attributes, subscribed_events) |
There was a problem hiding this comment.
Before merging, let's document a little testing here, since this change does affect our subscription logic. LGTM, but I think it's still worth ensuring we haven't missed something
63e0a39 to
17d5bb3
Compare
a19ba8c to
0080716
Compare
| local version = require "version" | ||
| if version.rpc >= 10 and version.api >= 16 and | ||
| #switch_utils.get_endpoints_by_device_type(device, fields.DEVICE_TYPE_ID.CAMERA) > 0 then | ||
| #device:get_endpoints(clusters.CameraAvStreamManagement.ID, {cluster_type = "SERVER"}) > 0 or |
There was a problem hiding this comment.
We would want to use the version gating for any of these device types, so you'd need to add parentesis around the string of or conditionals so that the logic is something like if version > X and (has_camera_cluster or is_chime or is_doorbell):
if version.rpc >= 10 and version.api >= 16 and
(#device:get_endpoints(clusters.CameraAvStreamManagement.ID, { cluster_type = "SERVER" }) > 0 or
#switch_utils.get_endpoints_by_device_type(device, fields.DEVICE_TYPE_ID.CHIME) > 0 or
#switch_utils.get_endpoints_by_device_type(device, fields.DEVICE_TYPE_ID.DOORBELL) > 0) then
return true, require("sub_drivers.camera")
end
| table.insert(main_component_capabilities, capabilities.nightVision.ID) | ||
| end | ||
| if #chime_endpoints > 0 then | ||
| table.insert(main_component_capabilities, capabilities.sounds.ID) |
There was a problem hiding this comment.
We would also need to include audioMute for handling the Enabled attribute on the chime cluster, which is mandatory
| --- @param subscribed_events table key-value pairs mapping capability ids to subscribed events | ||
| function utils.populate_subscribe_request_for_device(checked_device, subscribe_request, capabilities_seen, attributes_seen, events_seen, subscribed_attributes, subscribed_events) | ||
| for _, component in pairs(checked_device.st_store.profile.components) do | ||
| function utils.populate_subscribe_request_for_device(checked_device, parent_device, subscribe_request, capabilities_seen, attributes_seen, events_seen, subscribed_attributes, subscribed_events) |
There was a problem hiding this comment.
Could we just update this function to get the parent device of the checked_device as needed rather than passing on the parent device in the function parameters? If the device doesn't have a parent device, then we would know that it is the parent device.
| deviceTypes: | ||
| - id: 0x0145 # Snapshot Camera | ||
| deviceProfileName: camera | ||
| - id: "matter/chime" |
There was a problem hiding this comment.
A device that supports Camera and Chime would equally match to the generic fingerprint for both Matter Camera and Matter Chime, so it is ambiguous which profile would be used initially. I know we would expect this to be fixed by the match profile logic, but could you add an additional fingerprint that matches on both the Camera and Chime device types and uses the camera profile? Also, this would allow us to set the default name to "Matter Camera" for these devices.
This adds support for the following device types: * 0x0140 Intercom * 0x0141 Audio Doorbell * 0x0142 Camera * 0x0143 Video Doorbell * 0x0144 Floodlight Camera * 0x0145 Snapshot Camera * 0x0146 Chime * 0x0148 DoorBell
0080716 to
394d80d
Compare
This adds support for the following device types: