Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
greens committed Feb 28, 2024
1 parent 499a577 commit 50f127e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/SmartThings/zigbee-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ local mired_bounds_handler_factory = function(minOrMax)
local temp_in_kelvin = mired_to_kelvin(value.value)
if temp_in_kelvin > SANITY_CHECK_MIN_KELVIN and temp_in_kelvin < SANITY_CHECK_MAX_KELVIN then
device:set_field(BOUND_RECEIVED..minOrMax, temp_in_kelvin)
else
device.log.warn("Device reported a min or max color temp value outside of reasonable bounds: "..temp_in_kelvin..'K')
end

local min = device:get_field(BOUND_RECEIVED..MIN)
local max = device:get_field(BOUND_RECEIVED..MAX)
if min ~= nil and max ~= nil and min < max then
device:emit_event_for_endpoint(endpoint_id, capabilities.colorTemperature.colorTemperatureRange({ value = {minimum = min, maximum = max}}))
device:set_field(BOUND_RECEIVED..MAX, nil)
device:set_field(BOUND_RECEIVED..MAX)
device:set_field(BOUND_RECEIVED..MAX, nil)
end
end
end
Expand Down

0 comments on commit 50f127e

Please sign in to comment.