Minimum dimmer level

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

Moderator: leecollings

Post Reply
fvdp80
Posts: 70
Joined: Tuesday 14 August 2018 8:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10303
Contact:

Minimum dimmer level

Post by fvdp80 »

To prevent a flickering lamp i want to restrict the dimming level when the light is dimmed through a remote control.
Is there a way to set this minimum level in dzvents?

I tried the follow code, but it interferes with some other scripts when using the switchOff() function.

Code: Select all

{
	on = 
	{
		devices = 
		{
		304,
		},
		
	},
	  
	    logging =  
        {
            level = domoticz.LOG_ERROR, -- set to LOG_ERROR when tested and OK
            marker = 'Woonkamer-Plafondlamp)'
        },
    
	execute = function(dz, item)
   
   lamp = dz.devices(304)
   
    if lamp.level < 30 then
       lamp.dimTo(31)
    end

end
}
mgugu
Posts: 220
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Minimum dimmer level

Post by mgugu »

You are right, the switchOff() command triggers momentarily the dimmer level. This is not normal.
You can use this workaround:

Code: Select all

if lamp.level < 30 then
      if lamp.state == 'On' then
          lamp.dimTo(31)
      end
end
fvdp80
Posts: 70
Joined: Tuesday 14 August 2018 8:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10303
Contact:

Re: Minimum dimmer level

Post by fvdp80 »

Works, thnx!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest