Page 1 of 1

dimTo for X minutes, will this work?

Posted: Saturday 19 December 2020 16:17
by rgroothuis
When the light is switch on at 50% brightness, then I want to set the brightness to 100% for 5 min, I'm using this command:

VoorDeurLight.dimTo(100).forMin(5)

It will switch to 100% but it doesn't go back to the 50% after 5 min. How can I achieve this?

Re: dimTo for X minutes, will this work?

Posted: Saturday 19 December 2020 16:38
by rwblinn
Use

Code: Select all

.afterMin(5)
Tested with following dzVents snippet:

Code: Select all

local IDX_SWITCH = 49

return {
	on = {
		timer = {
			'at 16:33',
		}
	},
	execute = function(domoticz, timer)
		
		-- Get current dimmer level
		local dimmerLevel = domoticz.devices(IDX_SWITCH).level
		
		-- Set dimmer full level
		domoticz.devices(IDX_SWITCH).dimTo(100).forMin(1)
		
		-- Set back to previous level
		domoticz.devices(IDX_SWITCH).dimTo(dimmerLevel).afterMin(1)
    end
}

Re: dimTo for X minutes, will this work?  [Solved]

Posted: Sunday 20 December 2020 16:30
by rgroothuis
Thanks, looks like this is working for me. Thanks.