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

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

Moderator: leecollings

Post Reply
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

dimTo for X minutes, will this work?

Post 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?
rwblinn
Posts: 72
Joined: Wednesday 10 June 2015 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 4
Location: Hamburg (Germany)/Middelburg (NL)
Contact:

Re: dimTo for X minutes, will this work?

Post 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
}
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by rgroothuis »

Thanks, looks like this is working for me. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest