Skip to content

Matter camera: camera subscriptions are not registered for the generic refresh handler #3181

Description

@ldeora

Summary

The generic matter-switch subscription path stores its computed attributes_seen table in fields.SUBSCRIBED_ATTRIBUTES_KEY because the Edge Lua refresh handler uses that field to determine which attributes to read.

The camera subdriver builds the same attributes_seen structure in CameraUtils.subscribe(), but currently never stores it.

As a result, the camera-specific subscription set is not registered for the normal refresh path.

Environment / verification

Verified against SmartThingsCommunity/SmartThingsEdgeDrivers main at commit
60bbf2716412fdf04fd59f967bdd37be6995d664 (2026-08-12).

Real-device validation used:

  • Aqara Camera Hub G350
  • VID/PID: 0x115F / 0x3013
  • firmware: 4.5.70 / 4005070
  • reported Matter SpecificationVersion: 1.5.1
  • Camera device type: 0x0142
  • Camera endpoint in this device: endpoint 2

The proposed changes are generic Matter-camera changes. No Aqara VID/PID fingerprint or proprietary Aqara cluster handling is required.

Current behavior

The main matter-switch subscription implementation explicitly documents and stores the field:

-- The refresh capability command handler in the lua libs uses this key
-- to determine which attributes to read.
device:set_field(fields.SUBSCRIBED_ATTRIBUTES_KEY, attributes_seen)

The camera subdriver similarly builds attributes_seen:

but ends with:

if #subscribe_request.info_blocks > 0 then
  device:send(subscribe_request)
end

without storing attributes_seen.

The camera profile includes the standard refresh capability:

Reproduction

This can be reproduced directly from the driver code:

  1. Let a camera device run CameraUtils.subscribe().
  2. Observe that the function builds the camera subscription map in attributes_seen.
  3. Compare it with the normal switch_utils.subscribe() path.
  4. The camera path does not update fields.SUBSCRIBED_ATTRIBUTES_KEY.
  5. Invoke the standard refresh capability.

The refresh handler therefore cannot use the camera subscription set in the same way as the normal Matter Switch path.

Expected behavior

A camera's standard Refresh command should read the same camera attributes that the camera subdriver considers subscribed/managed.

Suggested change

At the end of CameraUtils.subscribe(), before sending the subscription request, mirror the existing generic Matter Switch behavior:

device:set_field(fields.SUBSCRIBED_ATTRIBUTES_KEY, attributes_seen)

if #subscribe_request.info_blocks > 0 then
  device:send(subscribe_request)
end

No camera-specific refresh implementation should be necessary.

G350 evidence

The G350 exercises a large camera subscription set including:

  • occupancy;
  • privacy;
  • night vision;
  • speaker/microphone state;
  • PTZ;
  • stream settings;
  • WebRTC-related camera state.

The tested camera driver included the SUBSCRIBED_ATTRIBUTES_KEY fix and continued to operate normally on the real G350.

This issue was identified primarily by comparing the two driver subscription paths; no isolated user-visible "Refresh failed" log was required to prove the bookkeeping discrepancy.

Affected files

  • src/sub_drivers/camera/camera_utils/utils.lua
  • src/test/test_matter_camera.lua

Suggested regression coverage

After CameraUtils.subscribe():

  1. inspect fields.SUBSCRIBED_ATTRIBUTES_KEY;
  2. verify that it contains representative camera attributes, e.g.:
    • Occupancy;
    • NightVision;
    • a privacy attribute;
    • MPTZPosition;
  3. verify that the contents match the attributes added to the subscription request.

Scope

This is a small generic driver consistency fix and is independent of the Aqara device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions