Page 1 of 1

dzVents only updating 1 switch/light

Posted: Sunday 22 January 2017 19:40
by mischa
Perhaps I'm doing something wrong or is this not supposed to happen?

I have a script made that dim my garden light to 80 % when the door is opened and it is dark outside, works fine. But only the first device is activated.

Code: Select all

return {
    active = true,
    on = {'Achterdeur'},
    execute = function(domoticz, Achterdeur)
	    if (Achterdeur.state == 'Open' and domoticz.variables['DarkOutside'].value == 'True')
	    	then 
	    	domoticz.devices['Tuin Verlichting'].dimTo(80).for_min(2) 
	    	domoticz.devices['Lamp Achterdeur'].dimTo(80).for_min(2)
	    end
    end
}

Re: dzVents only updating 1 switch/light

Posted: Tuesday 24 January 2017 22:51
by mischa
figured out that dimTo() does not support duration, but this seems not to be the problem.
Only the level of [1] = Tuin Verlichting gets set. and [2] = Lamp Achterdeur does nothing.

Anybody an idea?

Re: dzVents only updating 1 switch/light

Posted: Wednesday 25 January 2017 0:25
by elmortero
And if your remove for both the .for_min(2) ? Does the second one work then?
Duration does not work, that is correct. But you can still add an extra command for both, switchOff().after_min(2) to switch them back off

Re: dzVents only updating 1 switch/light

Posted: Thursday 26 January 2017 19:52
by mischa
I tried that, but no success. Still, only one switch gets updated.
And I don't want to switch them off, but dim them back to the previous level (5%)

Thinking about setting a user variable and make a time script that compares the last update time with the minutes past since the last update.