Scenes stopped working after firmware update

Hello everybody.
I had lua scripts that worked stably for a long time. I updated the firmware to 7.31 and my lua scripts stopped working. I followed many tips, but not one and it does not help.

In the logs I see:
LuaInterface::CallFunction_Scene Scene 23 failed attempt to call a nil value <0x74ad8520>

All my scripts work fine from APPS->Developer apps->Test Luup code (Lua)

I did a lot of experiments. I deleted all the scripts and tried to create a new one.
Very simple script:
luup.log("I AM HERE")

I still get the error:
LuaInterface::CallFunction_Scene Scene 23 failed attempt to call a nil value <0x74ad8520>
I killed my weekend to fight this problem.
Help me please, I have no ideas.

1 Like

Use the following url, substituting vera_ip for your vera’s ip address, to dump your scenes and look specifically at Scene 23 to see what might be happening.

http://vera_ip:3480/data_request?id=lu_lua&DeviceNum=0

1 Like

I use it url: http://VERA_IP/port_3480/data_request?id=scene&action=list&scene=23
and I got:
{
“Timestamp”: 1587900946,
“name”: “Turn off all”,
“triggers_operator”: “OR”,
“groups”: [],
“triggers”: [],
“timers”: [],
“users”: “”,
“modeStatus”: “0”,
“lua”: “bHV1cC5sb2coIkkgYW0gSEVSRSIp”,
“encoded_lua”: 1,
“id”: 23,
“room”: 0,
“last_run”: 1587903723
}

I got:
–Devices with UPNP implementations:
-lu_lua&DeviceNum=1
-lu_lua&DeviceNum=130
-lu_lua&DeviceNum=152

–GLOBAL LUA CODE:
function scene_23()
luup.log(“I am HERE”)
end
– Bathroom
luup.attr_set(“invisible”,“1”,147)
luup.attr_set(“invisible”,“1”,148)
luup.attr_set(“invisible”,“1”,63)
– Livingroom
luup.attr_set(“invisible”,“1”,90)
luup.attr_set(“invisible”,“1”,92)
luup.attr_set(“invisible”,“1”,95)
– Hall
luup.attr_set(“invisible”,“1”,42)
luup.attr_set(“invisible”,“1”,49)
luup.attr_set(“invisible”,“1”,77)
– Kitchen
luup.attr_set(“invisible”,“1”,39)
– Badroom
luup.attr_set(“invisible”,“1”,57)
luup.attr_set(“invisible”,“1”,80)
luup.attr_set(“invisible”,“1”,83)

Are the quotes around your strings smart quotes or "? They look like smart quotes and that will be a problem.

2 Likes

Thanks, I changed the quotes to ’ and this helped.
Now I am trying to return my scripts that worked before, but the problem repeated:
LuaInterface::CallFunction_Scene Scene 23 failed attempt to call a nil value <0x74672520>

I used the link and got it:

–Devices with UPNP implementations:
-lu_lua&DeviceNum=1
-lu_lua&DeviceNum=130
-lu_lua&DeviceNum=152

–GLOBAL LUA CODE:
function scene_23()
local equipmentLightOff={41,43,76,78,40,38,91,93,94,79,84,82}
for i=1,#equipmentLightOff do
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“0”},equipmentLightOff[i])
end
end
– Bathroom
luup.attr_set(“invisible”,“1”,147)
luup.attr_set(“invisible”,“1”,148)
luup.attr_set(“invisible”,“1”,63)
– Livingroom
luup.attr_set(“invisible”,“1”,90)
luup.attr_set(“invisible”,“1”,92)
luup.attr_set(“invisible”,“1”,95)
– Hall
luup.attr_set(“invisible”,“1”,42)
luup.attr_set(“invisible”,“1”,49)
luup.attr_set(“invisible”,“1”,77)
– Kitchen
luup.attr_set(“invisible”,“1”,39)
– Badroom
luup.attr_set(“invisible”,“1”,57)
luup.attr_set(“invisible”,“1”,80)
luup.attr_set(“invisible”,“1”,83)
Have I to replace all smart quotes with simple ones?

Yes, and be careful of copying code on these forums, as unless formatted correctly the forum adds smart quotes.
eg.
luup.log("test") formatted with `luup.log("test")`
luup.log(“test”) no formatting

2 Likes

@melih @Sorin when are you going to fix this issue?

So, I see an awful lot of and in your lua code. You should change all quotes to ' and see if that helps.

Thanks a lot. It helped, but I found a new problem.
I changed the quotes and simplified the code.
Scene 23 began to work. But when I created scene 24, everything stopped working again. Scene 24 has a Schedule and is triggered every 10 seconds.

LuaInterface::CallFunction_Scene Scene 24 failed attempt to call a nil value <0x73762520>

If I use manual triggering for the scene, this works correctly. How can I solve this problem?

{
  "Timestamp": 946684822,
  "name": "Mirror Illumination LED",
  "room": "4",
  "triggers_operator": "OR",
  "groups": [],
  "triggers": [],
  "timers": [
    {
      "id": 1,
      "type": 1,
      "interval": "10s",
      "enabled": 1,
      "last_run": 1587911351,
      "next_run": 1587911361
    }
  ],
  "users": "",
  "modeStatus": "0",
  "lua": "bHV1cC5sb2coJ0hlbGxvIHdvcmxkIGV2ZXJ5IDEwIHNlY29uZHMnKQ==",
  "encoded_lua": 1,
  "id": 24,
  "last_run": 1587911351
}

and

--Devices with UPNP implementations:
-lu_lua&DeviceNum=1
-lu_lua&DeviceNum=130
-lu_lua&DeviceNum=152


--GLOBAL LUA CODE:
function scene_23()
local equipmentLightOff={41,43,76,78,40,38,91,93,94,79,84,82}
for i=1,#equipmentLightOff do
luup.call_action('urn:upnp-org:serviceId:SwitchPower1','SetTarget',{newTargetValue='0'},equipmentLightOff[i])
end
end
function scene_24()
luup.log('Hello world every 10 seconds')
end

Perhaps I’m asking the obvious here, but why are you using Lua script to execute these device actions instead of, say, directly in a Scene or (better still) Reactor routine?

Had to ask, since (a) I despise Lua/Luup, and (b) prefer the readability and comparative ease of maintaining Reactor routines generally.

Meanwhile, the vast array of “stuff killed by official Vera firmware releases” continues to boggle the mind even after 12 years of this… :frowning:

I don’t see anything wrong with the excerpt that you provided so I’m running out of ideas, but here are a few questions/thoughts:

  1. Have you confirmed that the luup engine does not issue any warnings/errors in the log when it tries to load the scene and trigger lua?
  2. Do you have any other global events that you redacted from the post?
  3. Have you by chance tried rebooting your Vera since you removed the smart quotes?
1 Like

You were right. I spent time studying the logs and found errors there.

01      04/27/20 21:11:06.556   Device_LuaUPnP::LoadDeviceDoc can't load /etc/cmh-lu//D_TemperatureSensor1 <0x77b53320>
01      04/27/20 21:11:06.557   JobHandler_LuaUPnP::CreateDevice_LuaUPnP failed to load 153/D_TemperatureSensor1 so device 153 is offline <0x77b53320>
01      04/27/20 21:11:06.672   Device_LuaUPnP::CreateServices Aborting device 153 because the topmost device has no interface <0x77b53320>
01      04/27/20 21:11:06.673   JobHandler_LuaUPnP::CreateAllServices failed to reate 153 <0x77b53320>
01      04/27/20 21:11:06.796   Device_LuaUPnP::CreateImplementations Aborting 153 because it failed to load <0x77b53320>
01      04/27/20 21:11:06.796   JobHandler_LuaUPnP::CreateAllImplementations failed to create 153 <0x77b53320>

I found this link:
http://wiki.micasaverde.com/index.php?title=Remove_Obsolete_Files
I deleted the unused xml files and now my lua scripts work correctly.

1 Like

Well done. Glad you figured it out. Helpful to everyone that you followed up and shared your findings.

1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules