Page 1 of 1

forSec error

Posted: Tuesday 27 March 2018 20:27
by jandirkv
Hello,

I'm fairly new to dzvents and its driving me crazy. I followed the wiki for my script and I get the following error when I run my script.
attempt to call field 'forSec' (a nil value)
this is my script

Code: Select all

return {
    on = {
        devices = { 'Wireless Switch Round1' }
    },
    execute = function(domoticz,switch)
    -- Lamp aan
        if (switch.state == 'Click' and domoticz.devices('Lamp Wand 1').state) == 'Off' then
            domoticz.devices('Lamp Hal').switchOn().forSec(2).repeatAfterSec(1,3)
            domoticz.devices('Lamp Wand 1').switchSelector(40)
            domoticz.devices('Lamp Wand 2').switchSelector(40)
            domoticz.devices('Lamp Eettafel').switchSelector(40)
            domoticz.devices('Lamp Staand').switchSelector(40)
       end 
    -- Lamp uit
        if (switch.state == 'Click' and domoticz.devices('Lamp Wand 1').state) == 'On' then
            domoticz.devices('Lamp Hal').switchOn().forSec(2).repeatAfterSec(1,3)
            domoticz.devices('Lamp Wand 1').switchOff()
            domoticz.devices('Lamp Wand 2').switchOff()
            domoticz.devices('Lamp Eettafel').switchOff()
            domoticz.devices('Lamp Staand').switchOff()
        end
    end
}
If followed the forsec in the wiki and still I get the error. What am I doing wrong. If I Remove the forsec it is working fine.

Re: forSec error

Posted: Tuesday 27 March 2018 20:48
by waaren
@Jandirkv,

forSec was introduced with dzVents 2.3. ; Could that be your problem ? From your signature or your profile I cannot tell on what hardware you run domoticz nor can I see which version domoticz, OS , dzVents you use.

Re: forSec error

Posted: Tuesday 27 March 2018 22:18
by jandirkv
I run the domoticz 3.8153. Dzvents version I don’t Know but I guess that if I run the latest version of domoticz that I also have the latest dzventz version? I run iT on raspberrypi stretch.

Re: forSec error

Posted: Tuesday 27 March 2018 22:29
by waaren
domoticz 3.8153 has dzVents 2.2 built in. For dzVents 2.3 or later you need a domoticz beta version. forSec will not work with your version.

Re: forSec error

Posted: Wednesday 28 March 2018 6:39
by jandirkv
Ahh ok. Thank you. Is the beta version stable enough?

Re: forSec error

Posted: Wednesday 28 March 2018 7:41
by waaren
For me the beta is stable enough but always make sure you have a recent backup and tested your recovery method before installing a new version.
There are some challenges on RPI with Debian stretch when using the pre-compiled beta together with Python plugins but with my locally compiled version I have no problem at all.
Happy to share my binary if/when needed.

Re: forSec error

Posted: Wednesday 28 March 2018 20:42
by jandirkv
Thanks for your help. I update to the latest beta and now al my scripts work