Unexpected symbol  [Solved]

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

Moderator: leecollings

Post Reply
User avatar
havnegata
Posts: 114
Joined: Wednesday 10 September 2014 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10162
Location: Norway
Contact:

Unexpected symbol

Post by havnegata »

Anyone can tell me whats wrong here?:

..ticz/scripts/dzVents/generated_scripts/Lys parkering.lua:18: unexpected symbol near '}'

Code: Select all

return {
    on = {
        devices = {'Lux_Fibaro', 'MotionSensor', },
    
},
    execute = function(dz, item)
        local LuxFibaro = dz.devices('Lux_Fibaro')
        local Sensor = dz.devices('MotionSensor')
        local light = dz.devices('Motorvarmer')
        if Sensor.active and LuxFibaro.lux < 1 then
            light.cancelQueuedCommands()
        if dz.time.matchesRule("at 23:01-06:00") then
            light.switchOn().checkFirst()
        elseif Sensor.state == 'Off' or LuxFibaro.lux > 2 then
            light.switchOff().afterMin(3)
        end
    end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Unexpected symbol  [Solved]

Post by waaren »

havnegata wrote: Wednesday 10 June 2020 12:00 Anyone can tell me whats wrong here?:

..ticz/scripts/dzVents/generated_scripts/Lys parkering.lua:18: unexpected symbol near '}'
You missed an 'end' after the 'light.cancelQueuedCommands()'

did you meant this?

Code: Select all

return
{
    on =
    {
        devices =
        {
            'Lux_Fibaro',
            'MotionSensor',
        },
    },

    execute = function(dz, item)
        local LuxFibaro = dz.devices('Lux_Fibaro')
        local Sensor = dz.devices('MotionSensor')
        local light = dz.devices('Motorvarmer')

        if Sensor.active and LuxFibaro.lux < 1 then
            light.cancelQueuedCommands()
        end

        if dz.time.matchesRule("at 23:01-06:00") then
            light.switchOn().checkFirst()
        elseif Sensor.state == 'Off' or LuxFibaro.lux > 2 then
            light.switchOff().afterMin(3)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
havnegata
Posts: 114
Joined: Wednesday 10 September 2014 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10162
Location: Norway
Contact:

Re: Unexpected symbol

Post by havnegata »

Yes, sweet!! Thanks again waaren!
Post Reply

Who is online

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