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

Easy to use, 100% Lua-based event scripting framework.
Post Reply
Deluka
Posts: 21
Joined: Thursday 03 March 2016 19:38
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Deluka » Sunday 18 March 2018 19:54

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:

SweetPants
Posts: 2297
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10085
Location: The Netherlands
Contact:

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

Post by SweetPants » Sunday 18 March 2018 20:01

Deluka wrote:
Sunday 18 March 2018 19: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
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

dannybloe
Posts: 1480
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

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

Post by dannybloe » Sunday 18 March 2018 20:03

Yes. That’s because you need a younger version of dzVents that’s only in the beta.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

Deluka
Posts: 21
Joined: Thursday 03 March 2016 19:38
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Deluka » Sunday 18 March 2018 20:08

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 ?

Deluka
Posts: 21
Joined: Thursday 03 March 2016 19:38
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Deluka » Sunday 18 March 2018 20:15

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 ?

dannybloe
Posts: 1480
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

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

Post by dannybloe » Sunday 18 March 2018 21:06

No. It goes hand in hand with Doniticz.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests