LUA scripts hangs
Posted: Saturday 15 July 2017 21:33
I have a Dimmer switch and I want to set level when It's turned on (by default it's only switching on, without level change):
(bedled.php output is a json processor, which outputs the last value of the dimmer, example 43)
Result?
Domoticz freezes.
I even tried to decode JSON directly in LUA, same problem:
Code: Select all
if devicechanged[DomDevice] then
lastValue = os.execute ("php /home//domoticz/userscripts/bedled.php")
print(lastValue)
print("dev " .. devicechanged[DomDevice]);
if(devicechanged[DomDevice]=='On') then
commandArray[DomDevice] = 'Set Level 40' --test
return commandArray
end
end
Result?
Code: Select all
2017-07-15 21:45:38.149 Error: EventSystem: Warning!, lua script /home/madrian/domoticz/scripts/lua/script_device_BEDLED.lua has been running for more than 10 seconds
2017-07-15 21:45:28.140 (LED) Lighting 5 (BEDLED)
2017-07-15 21:45:38.239 LUA: exit
2017-07-15 21:45:38.240 LUA: 0
2017-07-15 21:45:38.240 LUA: dev Set Level: 37 %

Domoticz freezes.
I even tried to decode JSON directly in LUA, same problem:
Code: Select all
local address = '192.168.1.54:8080'
url = 'curl "http://'..address..'/json.htm?type=devices&rid=25"'
local config=assert(io.popen(url)
local location = config:read('*all')
config:close()
local jsonLocation = json:decode(result)