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  ± 0    460 suites  +1   0s ⏱️ ±0s
2 382 tests ± 0  2 382 ✅ ± 0  0 💤 ±0  0 ❌ ±0 
4 064 runs  +13  4 064 ✅ +13  0 💤 ±0  0 ❌ ±0 

Results for commit c818081. ± Comparison against base commit fb3f845.

This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
Added should call refresh for child devices
Child device profiles should be overriden for specific devices
Button/Switch device : button/switch capability should send the appropriate commands
Check Energy/Power Management and powerConsumptionReport

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

File Coverage
All files 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/eve_energy/init.lua 92%
/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/init.lua 67%
/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/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/event_handlers.lua 97%
/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/utils/switch_utils.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/device_configuration.lua 96%
/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/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against c818081

@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.

Comment on lines +30 to +31
clusters.ElectricalEnergyMeasurement.ID = 0x0091
clusters.ElectricalPowerMeasurement.ID = 0x0090
Copy link
Contributor

@nickolas-deboom nickolas-deboom Oct 29, 2025

Choose a reason for hiding this comment

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

Aren't these ID's already present in the embedded clusters? Or is it just that the IDs are the only thing needed in this module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I could have just included the whole thing there, but since only the IDs are being used in this file I just specified the IDs.

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
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