forSec error

Post Reply
jandirkv
Posts: 22
Joined: Monday 19 February 2018 7:20
Target OS: Raspberry Pi
Domoticz version: 3.9117
Contact:

forSec error

Post by jandirkv » Tuesday 27 March 2018 20:27

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: 613
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post by waaren » Tuesday 27 March 2018 20:48

@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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

jandirkv
Posts: 22
Joined: Monday 19 February 2018 7:20
Target OS: Raspberry Pi
Domoticz version: 3.9117
Contact:

Re: forSec error

Post by jandirkv » Tuesday 27 March 2018 22:18

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: 613
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post by waaren » Tuesday 27 March 2018 22:29

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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

jandirkv
Posts: 22
Joined: Monday 19 February 2018 7:20
Target OS: Raspberry Pi
Domoticz version: 3.9117
Contact:

Re: forSec error

Post by jandirkv » Wednesday 28 March 2018 6:39

Ahh ok. Thank you. Is the beta version stable enough?

User avatar
waaren
Posts: 613
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: forSec error

Post by waaren » Wednesday 28 March 2018 7:41

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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave , dzVents 2.4.n, Amazon echo

jandirkv
Posts: 22
Joined: Monday 19 February 2018 7:20
Target OS: Raspberry Pi
Domoticz version: 3.9117
Contact:

Re: forSec error

Post by jandirkv » Wednesday 28 March 2018 20:42

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: No registered users and 3 guests