Page 1 of 1

Error in script

Posted: Friday 06 March 2020 17:35
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'

Re: Error in script

Posted: Friday 06 March 2020 17:46
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

Re: Error in script

Posted: Friday 06 March 2020 17:49
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

}

Re: Error in script

Posted: Friday 06 March 2020 17:50
by freijn
AAAaahhh Waaren never sleeps or is at Dinner :-)

Re: Error in script  [Solved]

Posted: Saturday 07 March 2020 14:34
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

}

Re: Error in script

Posted: Saturday 07 March 2020 23:36
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

}

Re: Error in script

Posted: Tuesday 10 March 2020 22:43
by janpeetoom
You are quite right Waaren.
Beginners unexperience :)