Page 1 of 2
Wierd lua error after... no change?
Posted: Monday 14 April 2014 19:12
by pipari
Hello,
After doing.... nothing? This shows up:
------
Mon Apr 14 19:09:00 2014 (PAJ2) Temperature (TempPaj2)
Mon Apr 14 19:09:00 2014 Hardware Monitor: Fetching data (System sensors)
Mon Apr 14 19:09:00 2014 (PAJ) Temperature (TempPaj)
Mon Apr 14 19:09:06 2014 Error: Lua script error: [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)
Mon Apr 14 19:09:16 2014 Error: Lua script error: [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)
Mon Apr 14 19:09:16 2014 (PAJ2) Lux Meter (ZLightSensor1)
Mon Apr 14 19:09:17 2014 Error: Lua script error: [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)
Mon Apr 14 19:09:17 2014 (PAJ2) Lux Meter (ZLightSensor1)
Mon Apr 14 19:09:17 2014 (PAJ2) Temperature + Humidity (TempLivingroom)
Mon Apr 14 19:09:17 2014 (PAJ2) Temperature + Humidity (TempLivingroom)
Mon Apr 14 19:09:19 2014 (PAJ) Temperature + Humidity (TempBathroom)
-------
For some reason some lua script can't get the value from utilitydevice...
I have a event (made with the blocky gui) thats uses my Lightsensor that is under "utilitydevide". When I deactivate it this error dissapears. BUT I havent changed the event... Worked yeasterday. I have not updated Domoticz either.
Hope someone have an idea!
Best regards,
Cristopher
Re: Wierd lua error after... no change?
Posted: Monday 14 April 2014 20:22
by SweetPants
You have to supply some more information. What is the calling script line?
Re: Wierd lua error after... no change?
Posted: Monday 14 April 2014 20:26
by Hendrik
I have the same problem, change the device for the humidity, and then a error in the log, and the event don't do it
disable the event, and no errors
change to an other hum sensor, and it works well
Re: Wierd lua error after... no change?
Posted: Monday 14 April 2014 20:42
by pipari
This is the event Im trying to do. THIS worked before.
Is like Domoticz can't get the value from ZLightSensor1 anymore.. when I press "Show current states" I can see the value..
//Cristopher
Re: Wierd lua error after... no change?
Posted: Monday 14 April 2014 21:22
by pipari
Tried this instead (did a lua script instead):
-------
commandArray = {}
if ((otherdevices['ZLightSensor1'] <= '20' or otherdevices['DuskSensor'] == 'On') and otherdevices['LivingRoomWindow'] == 'Off') then
commandArray['Scene:LightsInsideON']='On'
print('LightsInsideON triggered!')
end
return commandArray
-------
Re: Wierd lua error after... no change?
Posted: Monday 14 April 2014 22:03
by pipari
If I want to write a script that turns on say "LightningDevice1" for 10 minutes if "MotionSensor" is triggered. BUT not turn the lights off if the "MotionSensor" is triggered again within 10 minutes... is it possible?
Best regards
Cristopher
Re: Wierd lua error after... no change?
Posted: Sunday 19 July 2015 9:55
by cask
Same thing here: Error: EventSystem: Lua script error (Blockly), Name: test event 2_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)
Am i doing something wrong? (sorry for a dumb question, very new to domoticz)
(this is a test event, trying to get the light on for 1 minute, when it is dark)
Re: Wierd lua error after... no change?
Posted: Wednesday 21 October 2015 21:13
by OssiJr
I experience exactly the same. Is there any solution available already?
Re: Wierd lua error after... no change?
Posted: Monday 04 January 2016 16:15
by hnogueira
Hi:
I have the same issue with a utility device for energy meter. Anyone has any idea how to solve this?
regards,
Helder Nogueira
Re: Wierd lua error after... no change?
Posted: Monday 04 January 2016 16:17
by OssiJr
Use the beta version of domotics and is solved.
Worked for me like charme.
Re: Wierd lua error after... no change?
Posted: Tuesday 05 January 2016 12:17
by hnogueira
Hi OssiJr:
Where can I find the beta versions?
regards,
Helder
Re: Wierd lua error after... no change?
Posted: Monday 11 January 2016 10:42
by hnogueira
Hi all:
Just upgraded to the last version and still have the problem. Anyone can help?
Error: EventSystem: Lua script error (Blockly), Name: teste switch_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)
regards,
Helder Nogueira
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 11:33
by rolandbreedveld
Have the same issue with latest stable and latest beta version. (Version: 3.4834 and Version: 3.5187)
Error: EventSystem: in Pwr gpio: [string "-- sript_update_Pwr gpio.lua..."]:5: attempt to index global 'devicechanged' (a nil value)
I use this to read gpio status and update a power counter (every pulse is 100Wh)
the script works perfect, but sometimes these errors in the log
the complete script:
commandArray = {}
if(devicechanged['Pi gpio1 IN']) then ------ this is line 5
cur_val=tonumber(otherdevices_svalues['Power test'])
print("gpio:" .. tostring(otherdevices['Pi gpio1 IN']) .. " pwr:" .. tostring(cur_val))
commandArray['UpdateDevice'] = 31 .. "|0|" .. tostring(100 + cur_val)
end
return commandArray
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 13:46
by jvdz
What about when you change that to:
Code: Select all
commandArray = {}
if(devicechanged['Pi gpio1 IN'] ~= nil) then
cur_val=tonumber(otherdevices_svalues['Power test'])
print("gpio:" .. tostring(otherdevices['Pi gpio1 IN']) .. " pwr:" .. tostring(cur_val))
commandArray['UpdateDevice'] = 31 .. "|0|" .. tostring(100 + cur_val)
end
return commandArray
Jos
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 17:02
by rolandbreedveld
jvdz wrote:What about when you change that to:
Code: Select all
commandArray = {}
if(devicechanged['Pi gpio1 IN'] ~= nil) then
cur_val=tonumber(otherdevices_svalues['Power test'])
print("gpio:" .. tostring(otherdevices['Pi gpio1 IN']) .. " pwr:" .. tostring(cur_val))
commandArray['UpdateDevice'] = 31 .. "|0|" .. tostring(100 + cur_val)
end
return commandArray
Jos
Thanxzz, for the idea, but it gave exactly the same error
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 17:16
by jvdz
So that means that the devicechanged table is none existent. Is this a script that runs as Time Event?
Jos
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 17:49
by rolandbreedveld
jvdz wrote:So that means that the devicechanged table is none existent. Is this a script that runs as Time Event?
Jos
Jos, it's running as lua script from Domotics events, same as Blocky
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 18:40
by jvdz
Is it a script file or a script in the internal script editor?
In the first case: What is the scriptname?
In the second case: Which option did you set in the box underneath the LUA option?
Jos
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 19:09
by rolandbreedveld
Options in Domoticz: Name "Pwr gpio" / LUA / All /Active
(Domoticz script editor is used)
even with a nil check outside it, the error stays:
Error: EventSystem: in Pwr gpio: [string "-- sript_update_Pwr gpio.lua..."]:16: attempt to index global 'devicechanged' (a nil value)
commandArray = {}
if(otherdevices['Pi gpio1 IN'] ~= nil ) then
if(devicechanged['Pi gpio1 IN']) then ------>>>> this is line 16, which gives the nil error !!
cur_val=tonumber(otherdevices_svalues['Power test'])
print("gpio:" .. tostring(otherdevices['Pi gpio1 IN']) .. " pwr:" .. tostring(cur_val))
commandArray['UpdateDevice'] = 31 .. "|0|" .. tostring(100 + cur_val)
end
end
return commandArray
Re: Wierd lua error after... no change?
Posted: Wednesday 01 June 2016 19:25
by jvdz
Change the All to Device as it will now runs for Timer and Variable events as well which will cause this error.
Jos