Page 1 of 1

Global variables always nil

Posted: Thursday 24 May 2018 22:44
by Inso80
Hi,

I have created a "global_data.lua", stored in "/home/pi/domoticz/scripts/dzVents/scripts"

Code: Select all

return {
        helpers = {},
        data = {
	    testini = { initial = 12.4 }
	    testinix = { initial = 12 }
            timedOff = { initial = false }
        }
    }
all three of them are always "nil". When trying to print , f.e.:

Code: Select all

            domoticz.log(domoticz.globalData.testinix, domoticz.LOG_INFO)
I always get the error

Code: Select all

2018-05-24 22:22:21.675 Error: dzVents: Error: An error occured when calling event handler TestGlobalVar
2018-05-24 22:22:21.675 Error: dzVents: Error: /home/pi/domoticz/scripts/dzVents/runtime/Utils.lua:62: attempt to concatenate local 'msg' (a nil value)
there is no other global_data.lua file on my raspi. Also tried to move it to "/home/pi/domoticz/scripts" , same problem. User Variables table in domoticz web interface is empty.

Any ideas?

Re: Global variables always nil

Posted: Thursday 24 May 2018 22:59
by dannybloe
It looks like you are using a very old version of dzVents. Can you try this with a more recent one? Yours is located in scripts/ instead of in dzVents/. That is really old.

Re: Global variables always nil  [Solved]

Posted: Friday 25 May 2018 1:17
by waaren
Inso80 wrote: Thursday 24 May 2018 22:44 Hi,

I have created a "global_data.lua", stored in "/home/pi/domoticz/scripts/dzVents/scripts"

Code: Select all

return {
        helpers = {},
        data = {
	    testini = { initial = 12.4 }
	    testinix = { initial = 12 }
            timedOff = { initial = false }
        }
    }
Any ideas?
My guess is that you got the syntax not completely right. When I look at my (working) version, which is also in scripts/dzVents/scripts, it has some extra comma's

Code: Select all

         data = {
                             domoticzLatitude                        = { initial = 0},
                            domoticzLongitude                       = { initial = 0 },
                            domoticzLocation                        = { initial = "Nederland" },
                    }

Re: Global variables always nil

Posted: Friday 25 May 2018 21:08
by Inso80
The syntax did the trick :oops: thank you very much :D

@dannybloe
the "check for updates" - dialog tells me I am up to date, also my Domoticz is max ~around a year old. As soon as I have more time, I will clean reinstall, hopefully it will not cause any other problems.

Re: Global variables always nil

Posted: Saturday 26 May 2018 9:27
by gizmocuz
@Inso80, in the settings you can select 'beta' as release channel