SmartThingsEdgeDrivers icon indicating copy to clipboard operation
SmartThingsEdgeDrivers copied to clipboard

Fix wrong colorControl values emitted after device power cycle

Open nickolas-deboom opened this issue 9 months ago • 3 comments

Type of Change

  • [ ] WWST Certification Request
    • If this is your first time contributing code:
      • [ ] I have reviewed the README.md file
      • [ ] I have reviewed the CODE_OF_CONDUCT.md file
      • [ ] I have signed the CLA
    • [ ] I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • [x] Bug fix
  • [ ] New feature
  • [ ] Refactor

Checklist

  • [x] I have performed a self-review of my code
  • [x] I have commented my code in hard-to-understand areas
  • [x] I have verified my changes by testing with a device or have communicated a plan for testing
  • [x] I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Following a device power cycle, hub power cycle, or device going offline and then back online, it sends a subscription report with Hue, Saturation, X, and Y values. The ColorMode needs to be checked before emitting the colorControl capability with the hue and saturation values. The issue is that the ColorMode attribute is not guaranteed to be processed by the driver before the other color attributes. Therefore, the ColorMode handler should send a read request for the proper color attributes after checking the ColorMode.

Changes were previously made by PR 1772, but that only addressed hub power cycles. This PR handles every case in which the driver might receive a subscription report from the device where this problem could occur.

Summary of Completed Tests

Tested with a Zemismart color bulb, IKEA color bulb, and by CN team.

nickolas-deboom avatar Mar 26 '25 19:03 nickolas-deboom

Channel deleted.

github-actions[bot] avatar Mar 26 '25 19:03 github-actions[bot]

Test Results

   65 files    419 suites   0s ⏱️ 2 141 tests 2 141 ✅ 0 💤 0 ❌ 3 660 runs  3 660 ✅ 0 💤 0 ❌

Results for commit d042ed5c.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Mar 26 '25 19:03 github-actions[bot]

File Coverage
All files 94% :white_check_mark:
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 95% :white_check_mark:
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/embedded-cluster-utils.lua 38% :x:
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/aqara-cube/init.lua 96% :white_check_mark:
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua 91% :white_check_mark:

Minimum allowed coverage is 90%

Generated by :monkey: cobertura-action against d042ed5c297b5ef52dcd0d4590141fcb69b149ff

github-actions[bot] avatar Mar 26 '25 19:03 github-actions[bot]