Script Error 512
Posted: Tuesday 07 February 2017 12:07
Ciao,
I'm struggling with a script that won't run....
I use to run speedtest as a device Event triggered by a virtual pushOn button...
that's the script:
it works fine.... but I'm willing to move from the event table and use as an external script.
to do this I've copied the script into script_RUNSpeedTest.lua and stored in /home/pi/domoticz/script/
I've also removed the sectionwhich is not needed anymore (the script runs ONLY when the button is pushed)
forsec runScript = true (to skip the removed block and have the rest running)
I've also added # !/usr/bin/lua on top and give the file 0777 rights (rwxrwxrwx)
trigger the OnAction on my pushbutton as: script://script_RUNSpeedTest.lua
...and got this ugly error

did anyone saw this before and came out from it?!
thanks
ciao
M
I'm struggling with a script that won't run....
I use to run speedtest as a device Event triggered by a virtual pushOn button...
that's the script:
Code: Select all
debugger = tonumber(uservariables['SpeedTest_Debug'])
JSON = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- File per la decodifica del tracciato JSON restituito dallo speedtest
cTime = os.date("*t")
scName = '/home/pi/domoticz/scripts/speedtest-json.sh'
runScript = false -- Semaforo per esecuzione Procedura
prxPrint = '>>> [ST] >>> ' -- Prefisso per stringhe di debug
idxPing = 146
idxDl = 147
idxUp = 148
commandArray = {}
-- Speedtest NET_SpeedTest Button Pushed
if devicechanged['RUNSpeedTest'] and otherdevices['RUNSpeedTest'] == 'On' then
runScript = true
end
-- Script Principale
if runScript == true then
print(prxPrint..'Esecuzione SpeedTest')
os.execute(scName)
file = io.open("/home/pi/domoticz/scripts/speed-test.json", "r")
print(file)
json_text = file:read()
speeds = JSON:decode(json_text)
print(prxPrint..'['..cTime.hour..':'..cTime.min..'] >>> Dl/Ul/Pg: '..speeds.Download_Mbit..'/'..speeds.Upload_Mbit..'/'..speeds.Ping_ms)
commandArray[1]={['UpdateDevice']=tostring(idxDl)..'|0|'..speeds.Download_Mbit}
commandArray[2]={['UpdateDevice']=tostring(idxUp)..'|0|'..speeds.Upload_Mbit}
commandArray[3]={['UpdateDevice']=tostring(idxPing)..'|0|'..speeds.Ping_ms}
os.execute("rm /home/pi/domoticz/scripts/speed-test.json")
end
return commandArray
to do this I've copied the script into script_RUNSpeedTest.lua and stored in /home/pi/domoticz/script/
I've also removed the section
Code: Select all
-- Speedtest NET_SpeedTest Button Pushed
if devicechanged['RUNSpeedTest'] and otherdevices['RUNSpeedTest'] == 'On' then
runScript = true
end
forsec runScript = true (to skip the removed block and have the rest running)
I've also added # !/usr/bin/lua on top and give the file 0777 rights (rwxrwxrwx)
trigger the OnAction on my pushbutton as: script://script_RUNSpeedTest.lua
...and got this ugly error


Cannot really figured out what's wrong....2017-02-07 11:59:55.920 Error: Error executing script command (/home/pi/domoticz/scripts/script_RUNSpeedTest.lua). returned: 512

did anyone saw this before and came out from it?!

thanks
ciao
M