Simple plus and minus  [Solved]

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

Moderator: leecollings

Post Reply
User avatar
Varazir
Posts: 487
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Simple plus and minus

Post by Varazir »

Hello I can't see why this isn't working.

Code: Select all

return {
	on = {
		devices =   {
		                'IKEA Switch Right Arrow'
		            },
    },
		        
	    data =      {
	                    loop  = { initial = 0 }
	                },
	    logger =    {   
	                    level            =  domoticz.LOG_DEBUG,   
                        marker           =  "ikeaSelect" 
                    },

                
	execute = function(domoticz, device)
    
        if (device.state == "Click" )
            then
                if domoticz.data.loop < 5
                    then
                        domoticz.data.loop = domoticz.data.loop + l
                    else
                        domoticz.data.loop = l
                end
            currentGroup = domoticz.globalData.globGroups[domoticz.data.loop]
            domoticz.log(domoticz.data.loop, domoticz.LOG_INFO)
            domoticz.log(currentGroup, domoticz.LOG_INFO)
            domoticz.log(device.state, domoticz.LOG_INFO)
            domoticz.log(device.name, domoticz.LOG_INFO)
            domoticz.log(domoticz.globalData.globGroups[2], domoticz.LOG_INFO)
            device.switchOff().silent()
        end

	end
}
I keep getting

Code: Select all

2019-06-30 20:56:24.234 Error: dzVents: Error: (2.4.24) ...omoticz/scripts/dzVents/generated_scripts/ikeaSelect.lua:23: attempt to perform arithmetic on global 'l' (a nil value)
Something is wrong but I can't see it
Raspberry PI 4 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
jake
Posts: 751
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Simple plus and minus  [Solved]

Post by jake »

Did your accidentally use a capital 'i' instead of the number 1?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Simple plus and minus

Post by waaren »

Varazir wrote: Sunday 30 June 2019 21:19 Hello I can't see why this isn't working.
You used the letter l where you probably intended to use the digit 1
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Varazir
Posts: 487
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Simple plus and minus

Post by Varazir »

waaren wrote: Sunday 30 June 2019 23:16
Varazir wrote: Sunday 30 June 2019 21:19 Hello I can't see why this isn't working.
You used the letter l where you probably intended to use the digit 1
yes, it was it DAMN log10 autocomplete
Raspberry PI 4 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
Varazir
Posts: 487
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Simple plus and minus

Post by Varazir »

jake wrote: Sunday 30 June 2019 22:59 Did your accidentally use a capital 'i' instead of the number 1?
yes, it was it DAMN log10 autocomplete
Raspberry PI 4 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest