Switch workbench light to new color temperature light
All checks were successful
Build and deploy / Build application (push) Successful in 5m55s
Build and deploy / Build container (push) Successful in 2m16s
Build and deploy / Deploy container (push) Successful in 34s

This commit is contained in:
2025-08-22 03:09:05 +02:00
parent 3c5bd9ffb8
commit 7f41132965

View File

@@ -250,7 +250,7 @@ automation.device_manager:add(OutletOnOff.new({
client = mqtt_client, client = mqtt_client,
})) }))
local workbench_light = LightBrightness.new({ local workbench_light = LightColorTemperature.new({
name = "Light", name = "Light",
room = "Workbench", room = "Workbench",
topic = mqtt_z2m("workbench/light"), topic = mqtt_z2m("workbench/light"),
@@ -258,13 +258,26 @@ local workbench_light = LightBrightness.new({
}) })
automation.device_manager:add(workbench_light) automation.device_manager:add(workbench_light)
local delay_color_temp = Timeout.new()
automation.device_manager:add(IkeaRemote.new({ automation.device_manager:add(IkeaRemote.new({
name = "Remote", name = "Remote",
room = "Workbench", room = "Workbench",
client = mqtt_client, client = mqtt_client,
topic = mqtt_z2m("workbench/remote"), topic = mqtt_z2m("workbench/remote"),
callback = function(_, on) callback = function(_, on)
workbench_light:set_on(on) delay_color_temp:cancel()
if on then
workbench_light:set_brightness(82)
-- NOTE: This light does NOT support changing both the brightness and color
-- temperature at the same time, so we first change the brightness and once
-- that is complete we change the color temperature, as that is less likely
-- to have to actually change.
delay_color_temp:start(0.5, function()
workbench_light:set_color_temperature(3333)
end)
else
workbench_light:set_on(false)
end
end, end,
})) }))