SmartThingsCommunity / SmartThingsEdgeDrivers

Apache License 2.0
259 stars 446 forks source link

Matter Switch: clamp hue and saturation values #1581

Closed ctowns closed 3 weeks ago

ctowns commented 3 weeks ago

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

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



[CHAD-13809]: https://smartthings.atlassian.net/browse/CHAD-13809?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
github-actions[bot] commented 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

github-actions[bot] commented 3 weeks ago

Channel deleted.

github-actions[bot] commented 3 weeks ago

Test Results

   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.