Page 1 of 1

Minimum dimmer level

Posted: Thursday 30 June 2022 6:37
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
}

Re: Minimum dimmer level

Posted: Thursday 30 June 2022 11:10
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

Re: Minimum dimmer level

Posted: Wednesday 06 July 2022 8:24
by fvdp80
Works, thnx!