forSec error

Moderator: leecollings

Post Reply
jandirkv
Posts: 27
Joined: Monday 19 February 2018 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9117
Contact:

forSec error

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jandirkv
Posts: 27
Joined: Monday 19 February 2018 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9117
Contact:

Re: forSec error

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jandirkv
Posts: 27
Joined: Monday 19 February 2018 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9117
Contact:

Re: forSec error

Post by jandirkv »

Ahh ok. Thank you. Is the beta version stable enough?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jandirkv
Posts: 27
Joined: Monday 19 February 2018 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9117
Contact:

Re: forSec error

Post by jandirkv »

Thanks for your help. I update to the latest beta and now al my scripts work
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest