Change brightness Hue Lamp  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
HighDangerr
Posts: 2
Joined: Friday 25 October 2019 22:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Change brightness Hue Lamp

Post 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?


:)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Change brightness Hue Lamp  [Solved]

Post 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
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest