Wierd lua error after... no change?

Moderator: leecollings

pipari
Posts: 19
Joined: Saturday 23 November 2013 21:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Wierd lua error after... no change?

Post 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
SweetPants

Re: Wierd lua error after... no change?

Post by SweetPants »

You have to supply some more information. What is the calling script line?
Hendrik
Posts: 18
Joined: Saturday 04 January 2014 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post 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
CubieTruck with Domoticz
RfxTrx 433Mhz Usb, Rfx Sensor, Z-Wave
Slave Raspberry Pi with Domoticz, Piface, P1 usb
pipari
Posts: 19
Joined: Saturday 23 November 2013 21:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post 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
Attachments
Untitled-1.jpg
Untitled-1.jpg (24.53 KiB) Viewed 5378 times
pipari
Posts: 19
Joined: Saturday 23 November 2013 21:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post 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
-------
pipari
Posts: 19
Joined: Saturday 23 November 2013 21:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post 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
cask
Posts: 1
Joined: Sunday 19 July 2015 9:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post 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)
Attachments
Knipsel.PNG
Knipsel.PNG (8.64 KiB) Viewed 5157 times
OssiJr
Posts: 2
Joined: Wednesday 21 October 2015 21:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Wierd lua error after... no change?

Post by OssiJr »

I experience exactly the same. Is there any solution available already?
hnogueira
Posts: 25
Joined: Saturday 28 November 2015 12:10
Target OS: Windows
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post 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
OssiJr
Posts: 2
Joined: Wednesday 21 October 2015 21:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Wierd lua error after... no change?

Post by OssiJr »

Use the beta version of domotics and is solved.

Worked for me like charme.
hnogueira
Posts: 25
Joined: Saturday 28 November 2015 12:10
Target OS: Windows
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post by hnogueira »

Hi OssiJr:

Where can I find the beta versions?

regards,
Helder
hnogueira
Posts: 25
Joined: Saturday 28 November 2015 12:10
Target OS: Windows
Domoticz version:
Contact:

Re: Wierd lua error after... no change?

Post 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
User avatar
rolandbreedveld
Posts: 156
Joined: Wednesday 09 March 2016 11:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Wierd lua error after... no change?

Post 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
Raspberry Pi(SSD)+UPS HAT,Dashticz on WallTablet,HomeBridge, P1, HarmonyHub,FritzBox,API to 123Solar+ABB-PowerOne+SMA,ESP-Leds(flashed LSC),Tasmota,Shelly,MQTT,Mosquito,Node-Red,http://wiki.breedveld.net/index.php?title=RPiWaterMeter, Mercedes-Me
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
rolandbreedveld
Posts: 156
Joined: Wednesday 09 March 2016 11:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Wierd lua error after... no change?

Post 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
Raspberry Pi(SSD)+UPS HAT,Dashticz on WallTablet,HomeBridge, P1, HarmonyHub,FritzBox,API to 123Solar+ABB-PowerOne+SMA,ESP-Leds(flashed LSC),Tasmota,Shelly,MQTT,Mosquito,Node-Red,http://wiki.breedveld.net/index.php?title=RPiWaterMeter, Mercedes-Me
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post by jvdz »

So that means that the devicechanged table is none existent. Is this a script that runs as Time Event?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
rolandbreedveld
Posts: 156
Joined: Wednesday 09 March 2016 11:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Wierd lua error after... no change?

Post 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
Raspberry Pi(SSD)+UPS HAT,Dashticz on WallTablet,HomeBridge, P1, HarmonyHub,FritzBox,API to 123Solar+ABB-PowerOne+SMA,ESP-Leds(flashed LSC),Tasmota,Shelly,MQTT,Mosquito,Node-Red,http://wiki.breedveld.net/index.php?title=RPiWaterMeter, Mercedes-Me
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
rolandbreedveld
Posts: 156
Joined: Wednesday 09 March 2016 11:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Wierd lua error after... no change?

Post 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
Raspberry Pi(SSD)+UPS HAT,Dashticz on WallTablet,HomeBridge, P1, HarmonyHub,FritzBox,API to 123Solar+ABB-PowerOne+SMA,ESP-Leds(flashed LSC),Tasmota,Shelly,MQTT,Mosquito,Node-Red,http://wiki.breedveld.net/index.php?title=RPiWaterMeter, Mercedes-Me
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Wierd lua error after... no change?

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest