Persistent data error

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

Moderator: leecollings

Post Reply
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Persistent data error

Post by wizzard72 »

I'm trying to make a dzVents Lua script with persistent data in it. I have read the documentation on the wiki, but can't find what I'm doing wrong. I'm on version 8394.

Simple script:

Code: Select all

return {	
    active = true,
    logging = {
		level = domoticz.LOG_INFO
		marker = 'TEST '
	},
	on = {
		devices  = {
			'Wasmachine2'
		},
		data = {
            temperatures = {history = true, maxItems = 10}
        },
	},

	-- actual event code
	-- in case of a timer event or security event, device == nil
	execute = function(domoticz, device)

        domoticz.data.temperatures.add(device.state)

	end
}
Can someone help me?

I see the following error in the log:
2017-09-18 20:07:37.765 Error: dzVents: Error: 0-Watt : An error occured when calling event handler dzVentsTest
2017-09-18 20:07:37.765 Error: dzVents: Error: 0-Watt : ...moticz/scripts/dzVents/generated_scripts/dzVentsTest.lua:20: attempt to index field 'data' (a nil value)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Persistent data error

Post by dannybloe »

You have to define the data section as a sibling of the on-section. Not inside the on-section.

😀
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
wizzard72
Posts: 116
Joined: Friday 20 December 2013 7:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Persistent data error

Post by wizzard72 »

Thank you, it's working now
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest