Skip to content

Conversation

@hcarter-775
Copy link
Contributor

Description of Change

If no power is currently being used when the driver is starting or restarting, devices generally report Null as their value. This should be taken as 0.0 for a better user experience that is more consistent with other protocols.

Summary of Completed Tests

Tested on-device. Since we do not support the TLV-encoded null type in lua right now, we cannot make a unit test for this case.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Test Results

   71 files    480 suites   0s ⏱️
2 485 tests 2 485 ✅ 0 💤 0 ❌
4 267 runs  4 267 ✅ 0 💤 0 ❌

Results for commit 540a964.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

File Coverage
All files 92%
/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/ikea_scroll/init.lua 85%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua 99%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.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/sub_drivers/third_reality_mk1/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/utils.lua 95%
/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/camera/camera_handlers/capability_handlers.lua 78%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/attribute_handlers.lua 95%
/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/capability_handlers.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua 84%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 540a964

@nickolas-deboom
Copy link
Contributor

In the spec I'm seeing that a device would report NULL for ActivePower if the power cannot be measured, not necessarily if no power is being used. Since you mentioned the issue occurs primarily on driver start/restart, should we emit 0 in device_init rather than in this NULL case?

@hcarter-775
Copy link
Contributor Author

In the spec I'm seeing that a device would report NULL for ActivePower if the power cannot be measured, not necessarily if no power is being used. Since you mentioned the issue occurs primarily on driver start/restart, should we emit 0 in device_init rather than in this NULL case?

@nickolas-deboom I think keeping actual device actions and capability events coupled is an good principle, which is why I lean against the idea of adding this to init.

And, in that same vein, I wonder whether emitting a 0 event for a null event is really what we should do either? Yes, it is an unexpected value, but it is what the device reported. I know I opened this PR (lol) but the possible unintended consequences here seem important to keep in mind...

@nickolas-deboom
Copy link
Contributor

Plus there's the fact that if it was emitted during init it could cause offline devices to be marked online... definitely not a good idea 😅

And, in that same vein, I wonder whether emitting a 0 event for a null event is really what we should do either? Yes, it is an unexpected value, but it is what the device reported.

Yeah I think you have a point. Are you thinking we continue to ignore Null values then?

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