Skip to content

Commit

Permalink
fix(led) fix hex values in color.map
Browse files Browse the repository at this point in the history
  • Loading branch information
jshessen committed Feb 18, 2023
1 parent 788a8de commit 9f3368a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function color.hex_to_rgb(hex)
hex = hex:gsub("#", "")

-- Check if the hexadecimal string is valid
log.debug(string.format("hexadecimal string = %s",hex))
if not hex:match("%x%x%x%x%x%x") then
return nil -- Return nil if hex is invalid
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,11 @@ function led.set_status_color(device, command)
command.args.color.saturation = saturation
device:set_field(CAP_CACHE_KEY, command)

log.debug(string.format("%s: r=%d,g=%d,b=%d", device:pretty_print(), r,g,b))
log.debug(string.format("%s: h=%d,s=%d,l=%d", device:pretty_print(), hue,saturation,lightness))
log.debug(string.format("%s: value=%s", device:pretty_print(), value))

--- If the saturation and lightness values are 0, set the value to off
value = saturation == 0 and lightness == 0 and SwitchBinary.value.OFF_DISABLE or SwitchBinary.value.ON_ENABLE
end
log.debug(string.format("%s: value=%s", device:pretty_print(), value))
--- Set the value to off or the color value
value = value == SwitchBinary.value.OFF_DISABLE and value or color.value
log.debug(string.format("%s: value=%s", device:pretty_print(), value))

--- Get the parameter number and size from the device preferences
---@type number
Expand All @@ -122,7 +116,6 @@ function led.set_status_color(device, command)
size = size,
configuration_value = value
})
log.debug(string.format("%s: Configuration",set))
device:send(set)
end
---
Expand Down

0 comments on commit 9f3368a

Please sign in to comment.