Skip to content

Support battery powered Matter cameras - #3314

Merged
samadDotDev merged 2 commits into
mainfrom
camera-battery
Nov 5, 2026
Merged

samadDotDev merged 2 commits into
mainfrom
camera-battery

Conversation

@samadDotDev

Copy link
Copy Markdown
Contributor

Description of Change

In order to support battery powered Matter Cameras, we need to add these 3 capabilities to the profile:

  • battery (to expose battery %)
  • batteryLevel (to expose levels such as "critical", "warning" and "normal", when the % isn't supported)
  • chargingState (for cameras with rechargeable batteries, which is almost always the case)

All 3 were added based on feature map and attributes list in Power source cluster. These have been tested with their state updates (so critical level or low % results in a notification, and the % is shown in the top-right corner of live-view player) as well as conditions of automation (e.g., a user can setup notification when camera charging is complete if unmounted etc)

Note that we only expose % capability when camera supports both % and level for the battery. This is to remain consistent with our existing usages in other Matter drivers, but it should be re-evaluated given that level has device/battery-subjective thresholds (which can vary depending on battery chemistry).

Summary of Completed Tests

  • Added unit tests that cover the 3 capabilities in various combinations
  • Self-tested with a mock device
  • Partner tested with an actual battery powered camera

@samadDotDev samadDotDev added AIReview CGAI Contains code that was generated by AI labels Oct 29, 2026
@github-actions

Copy link
Copy Markdown

Profile category check: ✅ Passed - all profiles have a category defined.

@github-actions

Copy link
Copy Markdown

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Channel deleted.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Test Results

   73 files    550 suites   0s ⏱️
3 353 tests 3 353 ✅ 0 💤 0 ❌
5 395 runs  5 395 ✅ 0 💤 0 ❌

Results for commit dab0d75.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

matter-switch_coverage.xml

File Coverage
All files 93% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/attribute_handlers.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua 83% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/scroll_utils/event_utils.lua 52% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/third_reality_garage_door/init.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/eve_energy/init.lua 91% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/aqara_cube/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/init.lua 90% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/scroll_handlers/event_handlers.lua 75% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/hager/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua 92% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/event_handlers.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua 81% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/utils.lua 98% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/device_configuration.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/third_reality_mk1/init.lua 93% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua 92% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua 97% ✅

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against dab0d75

@Kwang-Hui

Copy link
Copy Markdown
Contributor

Question on power_source_attribute_list_handler:
Can a battery-powered camera expose multiple PowerSource clusters across different endpoints (e.g., one for wired/USB power and another for the battery)? If so, is there any chance that AttributeList reports arriving from different endpoints could race and overwrite BAT_PERCENT_REMAINING_PRESENT / BAT_CHARGE_LEVEL_PRESENT back to false?

@samadDotDev

Copy link
Copy Markdown
Contributor Author

Question on power_source_attribute_list_handler: Can a battery-powered camera expose multiple PowerSource clusters across different endpoints (e.g., one for wired/USB power and another for the battery)? If so, is there any chance that AttributeList reports arriving from different endpoints could race and overwrite BAT_PERCENT_REMAINING_PRESENT / BAT_CHARGE_LEVEL_PRESENT back to false?

Good question and valid concern! There can be multiple instances of power source cluster indeed, per spec

In case the node has multiple power sources, each SHALL be described by its own cluster instance. Each instance of this cluster MAY be associated with one or more endpoints or the entire node.

I have added that handling in 7c748c7

@Kwang-Hui Kwang-Hui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@samadDotDev
samadDotDev merged commit 352d0f9 into main Nov 5, 2026
24 checks passed
@samadDotDev
samadDotDev deleted the camera-battery branch November 5, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIReview CGAI Contains code that was generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants