Page 1 of 1
Change brightness Hue Lamp
Posted: Sunday 24 November 2019 17:37
by HighDangerr
Goodevening,
Can anyone help me what i for code i need setting a brightness to a Hue lamp?
And where to put it in the code?

Re: Change brightness Hue Lamp [Solved]
Posted: Sunday 24 November 2019 19:57
by waaren
HighDangerr wrote: ↑Sunday 24 November 2019 17:37
Goodevening,
Can anyone help me what i for code i need setting a brightness to a Hue lamp?
And where to put it in the code?
You can use dimTo
Below an example.
Code: Select all
return {
on = {
devices = {
2640 -- change to the ID of a switch controlling the brightness of your hue light
}
},
logging =
{
level = domoticz.LOG_DEBUG
},
execute = function(dz, item )
_G.logMarker = _G.moduleLabel
local hueLight = dz.devices(156) -- change to ID of your huelight.
local stepSize = 5 -- Adjust to the value you want
if item.active then
hueLight.dimTo(math.min( hueLight.level + stepSize, 100 ))
else
hueLight.dimTo(math.max( hueLight.level - stepSize, 0 ))
end
end
}