Skip to content

Commit 4de8064

Browse files
committed
update rounding for step percent
1 parent a980277 commit 4de8064

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function CapabilityHandlers.handle_step_color_temperature_by_percent(driver, dev
130130
local step_mode = step_percent_change > 0 and (clusters.ColorControl.types.StepModeEnum.DOWN or 3) or (clusters.ColorControl.types.StepModeEnum.UP or 1)
131131
local min_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MIN, endpoint_id) or 2200 -- default min mireds
132132
local max_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MAX, endpoint_id) or 6500 -- default max mireds
133-
local color_change_in_mireds = st_utils.round((max_mireds - min_mireds) * (math.abs(step_percent_change)/100))
133+
local color_change_in_mireds = (max_mireds - min_mireds) * st_utils.round((math.abs(step_percent_change)/100))
134134
device:send(clusters.ColorControl.server.commands.StepColorTemperature(device, endpoint_id, step_mode, color_change_in_mireds, fields.TRANSITION_TIME, min_mireds, max_mireds, fields.OPTIONS_MASK, fields.OPTIONS_OVERRIDE))
135135
end
136136

0 commit comments

Comments
 (0)