Page 1 of 1

attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 18:54
by Deluka
I have this small script

Code: Select all

return 
{
	on = { timer = { "every minute" }}, 
	    
	execute = function(domoticz, switch)

	    local x = {59,56,47,4,1}
	    local MyDevices = domoticz.devices().filter(x)
	    local CurrentLux = domoticz.devices("Lux Living").lux
	    local Geo = domoticz.devices('Geofence')
	    
	    if (Geo.state == 'Off') and (Geo.lastUpdate.minutesAgo == 5) then
	        domoticz.notify('Qbert Says:','I turned everthing Off for you',domoticz.PRIORITY_HIGH)
	        
		MyDevices.forEach(function(mydevice)
                 mydevice.switchOff().checkFirst()
		end)

    
 	    elseif (Geo.state == 'On') and (Geo.lastUpdate.minutesAgo == 2) then
		domoticz.notify('Qbert Says:','I turned everything On for you',domoticz.PRIORITY_LOW) 
		
		MyDevices.forEach(function(mydevice)
		    
		 if mydevice.description == 'light' and CurrentLux < 15 then
	            mydevice.switchOn().checkFirst()
	         elseif mydevice.description == 'switch' then
	            mydevice.switchOn().checkFirst()
	         end

                end)
    end
    end

}
and i get the following error

Code: Select all

Error: dzVents: Error: /home/pi/domoticz/scripts/dzVents/runtime/Domoticz.lua:408: attempt to call local 'filter' (a table value)
On the beta latest beta everything works but this error i get under the stable version
I tried re-installing domoticz but the problem remains :oops:

Re: attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 19:01
by SweetPants
Deluka wrote: Sunday 18 March 2018 18:54 On the beta latest beta everything works but this error i get under the stable version
I tried re-installing domoticz but the problem remains :oops:
Maybe this is not implemented in stable version? There where some major changes in dzVents since stable release

Re: attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 19:03
by dannybloe
Yes. That’s because you need a younger version of dzVents that’s only in the beta.

Re: attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 19:08
by Deluka
Oke but this comes direct of the DZvents wiki

Code: Select all

local livingLights = {
        'window',
        'couch',
        33, -- kitchen light id
    }
    local lights = domoticz.devices().filter(livingLights)
    lights.forEach(function(light)
        -- do something
        light.switchOn()
    end)
and also gives the same error
If its on the wiki sure its in the stable version, right ?

Re: attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 19:15
by Deluka
Oke found out i'm using version 2.2 and the wiki was for 2.4
Can i just upgrade DZvents to 2.4 in a stable version ?

Re: attempt to call local 'filter' (a table value)

Posted: Sunday 18 March 2018 20:06
by dannybloe
No. It goes hand in hand with Doniticz.