Error in script  [Solved]

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

Moderator: leecollings

Post Reply
janpeetoom
Posts: 12
Joined: Sunday 29 December 2019 12:07
Target OS: Linux
Domoticz version:
Contact:

Error in script

Post by janpeetoom »

Can anyone point me to the error in this script?
I don't see any :shock: .

Code: Select all

return 
{
    active = true
    on = {
        timer = {
            'at 17:29 on fri'
        }
},
execute = function(domoticz, timer)
    local esperessomachine = domoticz.devices('espressomachine')
    if (timer.trigger == 'at 18:45 on thu') then
        espressomachine.cancelQueuedCommands()
        espressomachine.switchOn()
    end
end

}
This is the error get when the script is active:

Thanks in advance.
2020-03-06 17:28:00.413 ...domoticz/scripts/dzVents/generated_scripts/Script #2.lua:4: '}' expected (to close '{' at line 2) near 'on'
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Error in script

Post by waaren »

janpeetoom wrote: Friday 06 March 2020 17:35 Can anyone point me to the error in this script?
You forgot the , after active = true
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Error in script

Post by freijn »

Not an expert but try this....

Code: Select all

return 
{
    active = true
    on = {
        timer = {
            'at 17:29 on fri'
        },
    },
execute = function(domoticz, timer)
    local esperessomachine = domoticz.devices('espressomachine')
    if (timer.trigger == 'at 18:45 on thu') then
        espressomachine.cancelQueuedCommands()
        espressomachine.switchOn()
    end
end

}
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Error in script

Post by freijn »

AAAaahhh Waaren never sleeps or is at Dinner :-)
janpeetoom
Posts: 12
Joined: Sunday 29 December 2019 12:07
Target OS: Linux
Domoticz version:
Contact:

Re: Error in script  [Solved]

Post by janpeetoom »

Thanks again.
There where also 2 writing errors in the script.
This is the working script:

Code: Select all

return 
{
    active = true,
    on = {
        timer = {
            'at 18:15 on thu'
        },
    },
execute = function(domoticz, timer)
    local espressomachine = domoticz.devices('Espressomachine')
    if (timer.trigger == 'at 18:15 on thu') then
        espressomachine.cancelQueuedCommands()
        espressomachine.switchOn()
    end
end

}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Error in script

Post by waaren »

janpeetoom wrote: Saturday 07 March 2020 14:34 This is the working script:
If this is the complete and final script then I don't understand why you double check the timer rule.

This version would do the same.

Code: Select all

return 
{
    on = {
        timer = {
            'at 18:15 on thu'
        },
    },
execute = function(domoticz)
    	local espressomachine = domoticz.devices('Espressomachine')
        espressomachine.cancelQueuedCommands()
        espressomachine.switchOn()
end

}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
janpeetoom
Posts: 12
Joined: Sunday 29 December 2019 12:07
Target OS: Linux
Domoticz version:
Contact:

Re: Error in script

Post by janpeetoom »

You are quite right Waaren.
Beginners unexperience :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest