Suddenly have the same lua error in all my scenes

Hi All,
I’m running a Vera3, UI5 (1.5.622 .)
I’ve been delving into the wonderful world of lua scripting for exactly 2 weeks and have made some great scenes. Everything was working great until this morning when I made a small lua code change on one scene. Suddenly, after saving the scene, the dashboard status showed ERROR : Error in lua for scenes and events. I thought "No biggie, I obviously screwed up something, I’ll just delete what I added. Well, I deleted exactly the line I added, then saved again and got the same error. Then I tried running the scene anyway and got the following error in the log.
Scene::RunScene running 60 test logging <0x2d73f680>
01 05/19/14 11:41:24.469 e[31;1mLuaInterface::CallFunction_Scene Scene 60 failed attempt to call a nil valuee[0m <0x2d73f680>
I went back into the log and found a log entry that references a possible issue with one of my scenes, the log entry is:

01 05/19/14 11:51:22.569 e[31;1mLuaInterface::LoadCode: [string “function scene_52()…”]:157: ‘)’ expected near 'opensensors’e[0m <0x2b8cb000>
01 05/19/14 11:51:22.585 e[31;1mJobHandler_LuaUPnP::Run cannot start lua with code:

Here is the scene lua code:

[code]local vol = 65
local son = 27 --mast bdr =33, kitch=27
local devcnt = 0
local devno = 0
local numopen = 0
local isare = “is”
local opensensors = " "
luup.log(‘Commencing sensor device search loop’)
for deviceNo,d in pairs(luup.devices) do
if d.category_num == 4 then

  local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceNo) or "Nil"
  
  if (tripped == "1") then
     opensensors = opensensors .. ". " .. d.description
     numopen = numopen + 1
  end

luup.log(d.description … ’ status:’ … tripped … ’ Dev #’ … deviceNo … ’ id:’ … d.id … ’ cat #:’ … d.category_num … ’ type:’ … d.device_type)
devcnt = devcnt + 1
end
end
if numopen == 0 then --If there are no sensors tripped, log and announce!
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and all are closed’)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=“There were " … devcnt … " door and window sensors found, and all are closed”, Language=“en”, Volume=vol}, son)

else --If there are any sensors tripped, log and announce!
if numopen > 1 then
isare = “are”
end
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and ’ … numopen … " " … isare … ’ open’ … opensensors)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=“There were " … devcnt … " sensors found and " … numopen … " " … isare … " open.” … opensensors, Language=“en”, Volume=vol}, son)

end[/code]

Can anyone see where the expected ‘)’ is supposed to go? Would this one issue stop all lua code from running?
Thanks
Pasqual

Try adding a blank line to the end of the script.?

Update: I saved all of my lua scripts from my scenes then deleted them all, then recreated the scenes and pasted the scripts back in and everything works again… Very strange, I can’t imaging what happened…

Hi folks

I ended up here because none of my LUA commands in scenes were working, even though the LUA test box in Apps/Develop was working.

I’m a noob and didn’t realise that any errors in the LUA code in any scene will cause the LUA in ALLscenes to stop working.

When saving new scenes containing LUA you can see if there are errors in the code in the Vera log. It shows as all the LUA code in your scenes in red, preceded by an error message. It took me a few hours to figure all this out, so I thought I would post here just in case anyone else ends up here.

Cheers, Rob.

Hi Rob,

thanks for this hint which solved my problem too. I had setup may vera from ground up and I made a typo in one LUA command in another scene (only wanted to comment out a line, but switched to Python language → #). After correcting the comment my new scene also runs as expected. Hours later and after reading your post only…

Sebastian.