Page 1 of 1

Simple plus and minus

Posted: Sunday 30 June 2019 21:19
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

Re: Simple plus and minus  [Solved]

Posted: Sunday 30 June 2019 22:59
by jake
Did your accidentally use a capital 'i' instead of the number 1?

Re: Simple plus and minus

Posted: Sunday 30 June 2019 23:16
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

Re: Simple plus and minus

Posted: Sunday 30 June 2019 23:45
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

Re: Simple plus and minus

Posted: Sunday 30 June 2019 23:45
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