Skip to content

Conversation

@hcarter-775
Copy link
Contributor

Description of Change

Multi-switch plugs that support Electrical Sensor on multiple endpoints are not currently handled correctly in the driver, as the electrical handling is silently dropped when creating a profile for all child devices. This PR aims to fix that by adding handling of the PowerTopology cluster, a required cluster for the Electrical Sensor device type.

This cluster primarily indicates how Electrical Sensors are organized on the device through its feature map, and this PR handles 2 of the permutations, namely SET and NODE. For now, all other permutations (primarily TREE) will be silently dropped if it is supported, though we know of no real devices using this topology.

In the spec, a NODE topology indicates that there is only one source of electrical readings for the entire device, the "node". A SET topology indicates that the electrical sensor supports readings for some subset of the devices, and therefore there are likely >1 of these sensors, each with a SET topology and each supporting readings of different endpoints. These endpoints are specified through the AvailableEndpoints attribute, which we read on an initial join.

Summary of Completed Tests

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

Test Results

   71 files    460 suites   0s ⏱️
2 386 tests 2 386 ✅ 0 💤 0 ❌
4 067 runs  4 067 ✅ 0 💤 0 ❌

Results for commit 56ce2ea.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

File Coverage
All files 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded_clusters/Descriptor/init.lua 67%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/switch_fields.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/switch_utils.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/third_reality_mk1/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded_clusters/Descriptor/server/attributes/PartsList.lua 78%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/capability_handlers.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/attribute_handlers.lua 84%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/event_handlers.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/aqara_cube/init.lua 96%
/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/eve_energy/init.lua 92%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 56ce2ea

@hcarter-775 hcarter-775 changed the base branch from remove-energy-endpoint-field to main October 2, 2025 20:28
@hcarter-775 hcarter-775 force-pushed the power-topology-support branch 2 times, most recently from 3105c81 to 428476c Compare October 10, 2025 01:42
@hcarter-775 hcarter-775 changed the base branch from main to update-metadata-switch October 28, 2025 20:50
@hcarter-775 hcarter-775 force-pushed the power-topology-support branch from aee0647 to c818081 Compare October 29, 2025 19:55
@github-actions
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

function AttributeHandlers.active_power_handler(driver, device, ib, response)
if ib.data.value then
local watt_value = ib.data.value / fields.CONVERSION_CONST_MILLIWATT_TO_WATT
if ib.endpoint_id ~= 0 then
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this logic not needed anymore? I'm a bit confused

Copy link
Contributor Author

@hcarter-775 hcarter-775 Oct 29, 2025

Choose a reason for hiding this comment

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

see this PR: #2436
specifically here: #2436 (comment)

@hcarter-775 hcarter-775 force-pushed the update-metadata-switch branch from fb3f845 to 73aa8dc Compare October 29, 2025 20:07
Base automatically changed from update-metadata-switch to main October 31, 2025 17:15
@hcarter-775 hcarter-775 force-pushed the power-topology-support branch from c818081 to 39d282a Compare October 31, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants