Closed ctowns closed 3 weeks ago
File | Coverage | |
---|---|---|
All files | 94% |
:white_check_mark: |
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/eve-energy/init.lua | 91% |
:white_check_mark: |
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua | 95% |
:white_check_mark: |
Minimum allowed coverage is 90%
Generated by :monkey: cobertura-action against 5e4b8dd291217ac3b3d9e8dae7d259020822022c
Channel deleted.
61 files ±0 375 suites ±0 0s :stopwatch: ±0s 1 822 tests +1 1 822 :white_check_mark: +1 0 :zzz: ±0 0 :x: ±0 3 170 runs +1 3 170 :white_check_mark: +1 0 :zzz: ±0 0 :x: ±0
Results for commit 5e4b8dd2. ± Comparison against base commit 2125c846.
Check all that apply
Type of Change
Checklist
Description of Change
CHAD-13809 Sometime invalid hue and saturation values outside the range [0,100] can be received from the app. This adds a clamp to make sure values we send to the device are within the spec range of [0,254]
Summary of Completed Tests
[X] Added unit test A unit test has been added to check that receiving a value over the max expected value of 100 for the saturation and hue attributes in the colorControl capability are properly clamped to expected range of [0,100].
[x] Tested on Matter VDA Tested with Matter VDA with the Extended Color Light device type. Without this change, the issue is easily reproducible with the VDA. With this change in place, I see that when the driver receives a saturation value > 100 from a capability event, it properly clamps the attribute value output to the max of 0xFE:
-- value is clamped to 0xFE instead of 0xFF, which would have been out of bounds 2024-08-15T19:37:56.674976163Z INFO Matter Switch <MatterDevice: ff4add2f-fa0a-45ac-a271-e9b576b26e6d [181527749812D144-8C42227E1699A498] (Virtual Extended Color Light 1)> sending InteractionRequest: <InteractionRequest || type: INVOKE, info_blocks: [<InteractionInfoBlock || endpoint: 0x01, cluster: ColorControl, command: MoveToHueAndSaturation, data: Structure: {options_mask: \x01, saturation: \xFE, transition_time: \x00\x00, options_override: \x01, hue: \x4A, }>]> 2024-08-15T19:37:56.694364121Z DEBUG Matter Switch Virtual Extended Color Light 1 device thread event handled 2024-08-15T19:37:56.830224913Z TRACE Matter Switch Received event with handler matter 2024-08-15T19:37:56.850795871Z INFO Matter Switch <MatterDevice: ff4add2f-fa0a-45ac-a271-e9b576b26e6d [181527749812D144-8C42227E1699A498] (Virtual Extended Color Light 1)> received InteractionResponse: <InteractionResponse || type: COMMAND_RESPONSE, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: ColorControl, command: MoveToHueAndSaturation>>]> 2024-08-15T19:37:56.859259288Z INFO Matter Switch Fallback handler for <InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: ColorControl, command: MoveToHueAndSaturation>> 2024-08-15T19:37:56.862929163Z DEBUG Matter Switch Virtual Extended Color Light 1 device thread event handled 2024-08-15T19:37:56.870750038Z TRACE Matter Switch Received event with handler matter 2024-08-15T19:37:56.875877704Z INFO Matter Switch <MatterDevice: ff4add2f-fa0a-45ac-a271-e9b576b26e6d [181527749812D144-8C42227E1699A498] (Virtual Extended Color Light 1)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: ColorControl, attribute: CurrentHue, data: Uint8: \x4A>>]> 2024-08-15T19:37:56.889725538Z TRACE Matter Switch Found MatterMessageDispatcher handler in matter-switch 2024-08-15T19:37:56.893096704Z INFO Matter Switch Executing AttributeReportHandler: cluster: ColorControl, attribute: CurrentHue 2024-08-15T19:37:56.896075621Z INFO Matter Switch <MatterDevice: ff4add2f-fa0a-45ac-a271-e9b576b26e6d [181527749812D144-8C42227E1699A498] (Virtual Extended Color Light 1)> emitting event: {"attribute_id":"hue","capability_id":"colorControl","component_id":"main","state":{"value":29}} 2024-08-15T19:37:57.000834829Z DEBUG Matter Switch Virtual Extended Color Light 1 device thread event handled