LuaInterface::CallFunction_Scene failed

I somehow broke all LUUP scene programming and am looking for some help debugging.

Whenever I try to add any simple LUUP code to a scene, even just a simple luup.log comment in a new do nothing scene, I get this error in the log (viewed via ip/cgi-bin/cmh/log.sh?Device=LuaUPnP):

08 03/28/13 15:41:31.894 Scene::RunScene running 48 Test1 <0x2d833680>
01 03/28/13 15:41:31.895 LuaInterface::CallFunction_Scene Scene 48 failed attempt to call a nil value <0x2d833680>

I suspect I installed and/or uninstalled a wayward app (e.g. vera alerts) that tried to put a hook into every scene LUUP, but I’ve tried uninstalling almost all apps and still have the error.

Is there somewhere we can look to see what code was built for a scene, or even the whole vera system? Not sure how to debug it without being able to see that. Any other ideas?

Thanks!

Reinstall Vera Alerts.
Turn OFF notifications.
Save.
Then you can remove Vera Alerts.

I’m not sure the LUUP error is caused by VeraAlerts. I re-installed, created a new do-nothing scene, added an alert and a LUUP luup.log record. I still get the error, but I also see VeraAlerts running after that:

08 03/29/13 8:32:46.862 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=49 <0x2e6e9680>
08 03/29/13 8:32:46.862 Scene::RunScene running 49 Test2 <0x2e6e9680>
01 03/29/13 8:32:46.863 LuaInterface::CallFunction_Scene Scene 49 failed attempt to call a nil value <0x2e6e9680>
08 03/29/13 8:32:46.863 JobHandler_LuaUPnP::HandleActionRequest device: 74 service: urn:richardgreen:serviceId:VeraAlert1 action: SendAlert <0x2e6e9680>
08 03/29/13 8:32:46.864 JobHandler_LuaUPnP::HandleActionRequest argument Message=Hi1 <0x2e6e9680>
08 03/29/13 8:32:46.864 JobHandler_LuaUPnP::HandleActionRequest argument Recipients=ygkrefjogft0 <0x2e6e9680>
50 03/29/13 8:32:46.865 luup_log:74: VeraAlert:74:SendAlert:Msg:(3):%48%69%31 <0x2e6e9680>

If you still think VeraAlerts might be the problem, I wasn’t sure how to 'turn off notifications". I don’t have ‘Process Notifications’ checked. Simply blank out recipients?

Thanks for the help.

Click the Notifications on then off … on a new install.
Then with them off … goto the Additional Configuration.
This will remove the LUA code it had installed previously.

then save … then it’s ok to delete Vera Alerts.

I’m not sure if I did this right. I re-installed VeraAlerts, then went to Devices, then VeraAlerts, then Settings page. There I clicked then unclicked the ‘Process Notifications’ checkbox. Then I went to the Additional Configuration page, but didn’t change anything. Then I did a reload, although the red SAVE icon was not presented (Vera didn’t detect changes?)

That process didn’t help, maybe I mis-interpreted your instructions?

Given the error message, do you think this error is related to VeraAlerts?

Thanks again.

Yes this is related to VeraAlerts … I will have to look over the code … It might be the signature of what I am looking for uses the DeviceID of VeraAlerts … and it changed when you re-installed.

You can restore a backup from the MIOS site before you deleted VeraAlerts and go through the same procedure.

Oops … I misinterpreted the order you did things.
The log file above was when Vera Alerts was INSTALLed.
Then things are OK relative to Vera Alerts. I thought it was still calling things
after VeraAlerts was removed … and the fix I gave you would correct that problem.

There error is caused by LUA code you added to Scene #49

08 03/29/13 8:32:46.862 Scene::RunScene running 49 Test2 <0x2e6e9680>
01 03/29/13 8:32:46.863 LuaInterface::CallFunction_Scene Scene 49 failed attempt to call a nil value <0x2e6e9680>

Restoring from a backup would have been a great idea, had I thought of it in time. I introduced this problem over a month ago and it looks like, based on the listing in the Vera backup page, only 1 month of backups are kept.

I uninstalled VeraAlerts. I no longer see the call to VeraAlerts, as we expect, but I also still see the error:

08 03/30/13 22:10:42.719 Scene::RunScene running 49 Test2 <0x2d9e7680>
01 03/30/13 22:10:42.719 LuaInterface::CallFunction_Scene Scene 49 failed attempt to call a nil value <0x2d9e7680>
04 03/30/13 22:10:49.103 <0x2b9e7680>
08 03/30/13 22:10:57.783 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunScene <0x2d9e7680>
08 03/30/13 22:10:57.784 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=49 <0x2d9e7680>

Is there no file I can edit to take out the bad LUUP reminate from my old VeraAlerts install?

Is your Test2 scene hidden ?
You should be able to edit the LUA code from the Scene Editor.
Check your triggers as well, it could be LUA code for the trigger.
(This is where you would have seen Vera Alerts Interaction …
But Vera Alerts would have a comment around the Auto Inserted Code)

I don’t think my Test2 scene is hidden, not sure how to hide scenes, and it has no triggers.

To re-test the problem. I installed and uninstalling VeraAlerts using the procedure you suggested, then I created a new Test3 scene. The only thing I do in this scene is to go the LUUP tab and add this one record:

luup.log(“Hi from Test3”)

Then save code and run the scene and I see the same error in the log:

8 03/31/13 8:48:38.411 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunScene <0x2d903680>
08 03/31/13 8:48:38.412 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=50 <0x2d903680>
08 03/31/13 8:48:38.412 Scene::RunScene running 50 Test3 <0x2d903680>
01 03/31/13 8:48:38.412 LuaInterface::CallFunction_Scene Scene 50 failed attempt to call a nil value <0x2d903680>

If I delete that loop.log record, I don’t get that error. If I add that code, or any code, to any scene, new or old, I get that error and the scene’s LUUP code does not run.

It may not be VeraAlerts that created this issue. I didn’t notice my exactly when my Luup scene code quit working, so am not sure what I did to cause this problem.

So it seems there is some underlying code that gets created, but not exposed, that has the error. Is there no way to see or debug the resulting code that Vera actually ends up running?

Did Test 2 have any LUA code at the Scene level ?

The error is bad … It means that luup is undefined … That means there must have been an error
earlier in the log … luup is supposed to be globally defined.

Unless you have some code somewhere that does:
luup = …
or
luup.log = …

If you’re very comfortable with files, and searching them, you can do the following to see the entire content of your Vera.

Run the URL:
http://:49451/data_request?id=user_data2&output_format=json

substituting in your Vera’s IP address. In a browser like Firefox, this will emit a large amount of JSON content describing the [entire] setup of your Vera unit.

With this output, you can search for all of the potential “re-assignments” of “[tt]luup[/tt]”, in case it’s been overridden somewhere in one of your scenes.

If I were guessing, I’d say there’s something incorrect under:
Apps → Develop Apps → Edit Startup Lua

Of course, it could be anywhere in any of the scenes, but that’s where I’d look first.

PS: Technically this “file” is equivalent to [tt]/etc/cmh/user_data.json.lzo[/tt] but it’s easier to access via the URL. For “emergency” surgery it’s possible to edit this (with a few steps to BACKUP, Shutdown LuaUPnP, unpack and edit, then repack) … but that’s not for the faint of heart :wink:

I found my problem!

Using that json dump url was helpful. But the real key was the suggestion that the error could have been in any of my scene luups. Looking back at the log, I could see there was an error message “LuaInterface::LoadCode”. That error pointed to the wrong scene, but I kept deleting my various Scene luups (I had a bunch) until that error went away.

I had looked at the log for errors before, but there were a number of unrelated errors and I missed that key one. I think the moral of the story here is that you need to watch that log file closely, especially if you are writing lua code.

Richard, sorry for the false alarm on VeraAlerts and thanks for the help. Guessed, thanks for your tips, those were they key to the puzzle!