[PLEG] "Startup Lua Failed" frequent - only Vera physical plug/unplug will fix

I have 4 PLEG devices which work fine when these errors are not showing.

This issue started approx a week ago… I frequently/daily get “Startup Lua Failed” for ALL PLEGs when Vera’s UI restarts (several times a day sometimes - not sure why). I removed all unused Apps to free memory.

The only fix to remove the “Startup Lua Failed” messages seems to be a complete unplug/replug of the power. Once the problem starts, neither a Soft reboot (using Vera’s reboot under Wifi) nor ‘Reload’ button will fix.

But again, when the “Startup Lua Failed” messages are not showing, the PLEG seem to work just fine.

thoughts?

I would need to see the Debug Log file to see what is causing the message.

Vera debug log attached

Also, it looks like some Conditions are not triggering (Away - which only has 1 action) + I get errors when Clicking ‘Status’ for a Condition that no longer exists… setGuestSecureON

thanks.

Observations and questions:

How long ago did you turn on the Energy Plugin ? There is a lot of correlation between this plugin and Vera instability.
Do you have a USB stick for /tmp ? Are your logs going to it all the time ? I noticed an error about USB UIRT not starting.
The log report looks weird … it transitions from a log to an output of some data files on vera … Even the log was corrupted …
What type of Vera do you have … I think you might be out of memory.

Attach a status report … so I can see the details of your PLEG.

UPDATED
PLEG device HTML Status Report in attached ZIP file.
status report error popup = “Error Getting status of: setGuestSecureOn”
… I figured out this specific problem. If I changed the Condition named ‘setGuestSecureOn’ it was not changing the Notification. Thus, I suspected the notification was corrupt. I deleted that single notification, and the error is gone.

Problem remaining…
all PLEGs throw “Startup Lua Failed” error every time, even after physical power down.

I’m running 5.9 but manually updated using the update URLs… even with the latest versions, same problem
AND I restored a version from 3/11, way before the problem started… same issue.

  • thus I restored to my latest backup since it was running fine for me until a few days ago.

When I try to choose ‘Bypass’ on ANY of the PLEGs I get popup error “Device not Ready”.
Most of the PLEGs seem to be working, except Security Scenes: Conditions are evaluating properly AND the PLEG based Notifications are triggering - just the Actions are not ???

I also attached a new Vera log, showing a UI Restart and also what should be triggering the failing PLEG condition in the device in question.

I’ve never had a USB-UIRT connected to the Vera.
I’ve never had any Energy monitoring devices, and no energy app is installed… you are seeing the Battery Monitor app?
USB drive has been installed for a long time with the Vera logs going to it.

Apps installed…

Wake-on-LAN 1.62
Virtual ON/OFF Switches 1.31
Wunderground Weather Plugin 1.54
Day or Night 1.3
XBMCState 1.1
Program Logic Event Generator 5.9
Program Logic Core 5.9
Program Logic Timer Switch 5.9
Ping Sensor 0.16
VeraAlerts 4.91
EventWatcher 1.20140123
MultiSwitch 1.1*
Battery Monitor 0.6*

If you search your PLEG report … you will see you still have a notification on “setGuestSecureOn”

And I see the following in your log files:

10 03/30/14 16:38:56.942 USB_UIRT::FindAlternatePorts line 26=usbserinfo:1.0 driver:2.0 <0x2b228000>
10 03/30/14 16:38:56.942 USB_UIRT::Start not existant <0x2b228000>
10 03/30/14 16:38:56.943 JobHandler_LuaUPnP::StartPlugins USB UIRT failed to start <0x2b228000>
22 03/30/14 16:38:56.943 Energy::Start 70 <0x2b228000>
10 03/30/14 16:38:56.944 Energy::SetNextEnergyLogAlarm next call in 3064 seconds <0x2b228000>

What does it say when you click the Energy Tab at the top of the Dashboard ?

That log was from before I found and I fixed this artifact. Must have been a corrupt Notification. You can see from the new log I attached, ‘setGuestSecureOn’ no longer exists.

[quote=“RichardTSchaefer, post:6, topic:180458”]And I see the following in your log files:

10 03/30/14 16:38:56.942 USB_UIRT::FindAlternatePorts line 26=usbserinfo:1.0 driver:2.0 <0x2b228000>
10 03/30/14 16:38:56.942 USB_UIRT::Start not existant <0x2b228000>
10 03/30/14 16:38:56.943 JobHandler_LuaUPnP::StartPlugins USB UIRT failed to start <0x2b228000>
22 03/30/14 16:38:56.943 Energy::Start 70 <0x2b228000>
10 03/30/14 16:38:56.944 Energy::SetNextEnergyLogAlarm next call in 3064 seconds <0x2b228000>

What does it say when you click the Energy Tab at the top of the Dashboard ?[/quote]

I’ve never-ever had USB-UIRT connected to the Vera. After a search, it looks like Vera has USB-UIRT drivers built-in, thus I suspect this is standard procedure and since it failed to find the USB-UIRT device, it does not load the driver. This looks normal…
http://docs5.mios.com/doc.php?language=1&manual=1&platform=3Pro&page=USB%20UIRT

‘Energy’ tab… “The energy plugin is not activated.”
… I installed an energy app like a year ago accidentally and uninstalled it immediately.
… I suspect this is the same as the UIRT, it is not really running.

I’m sure these artifacts have nothing to do with the problem at hand since this “Startup Lua Failed” problem started infrequently about a week ago and starting today PLEG has stopped triggering Actions completely. There is some hidden bug going on … with PLEG or Vera itself. I have done nothing recently except add a new PLEG device a few days ago (which worked fine like all my Devices, until today) and uninstalled a few apps since starting to have this issue - hoping it was a memory problem, which it seems is not likely now.

None of the last 3 logs actually showed the crash and the restart.

Hi Richard,
new ZIPs…
logs from \var\log\cmh: LuaUPnP.log
two of the main PLEGs
scrolling log after I tried to select Bypass, and did a UI Restart.

If these don’t show the problem then I’m not sure what we can do? Since all other Vera functions (Native Scenes, etc) work perfectly, I’d like to ask if you can write a way to export/import PLEG devices and I can remove PLEG app and reinstall, then import the devices.

updated ZIP file since initial post

Richard,
I opened a ticket with MCV. John Max responded and I’ve asked for more specifics on what lead him to this conclusion…

“I have checked the logs on the Vera and it?s something to do with the conditions you’ve used in the scenes but i couldn’t say which condition is not good.”

So I did a test… and I deleted my most comple PLEGs, one-by-one to see if the errors went away. They did not BUT I think I figure out something useful…

I deleted my most used PLEG devices and 2 or the 4 seem to be still causing a problem even though they no longer exhist…
VeraAlerts Logic[, device 142
Security Scenes, device 127
… but even after several CTRL-F5 I was still getting “Security Scenes[127] : Startup Lua Failed” & “VeraAlerts Logic[142] : Startup Lua Failed” in the status window. Only a reboot cleared those 2 from the status window… and the 3 other PLEGs that still existed (small, rarely used) still threw errors.

I’ve seen PLEG devices get corrupt many times in the past and I simply deleted them, which previously fixed the issue… this time not so lucky. Please add an export/import to help this problem, and just make backups easier too. It seems that Vera has an problem where PLEGs that are modified too many times get corrupt. These are by far my most used and modified PLEG devices… I’m tweaking and adding to it every month or so.

thoughts?

Also, I did some digging and found the way to export all the User Data (devices, etc) so I attached both JSON & XML formats in the ZIP file here. Hoping this can help you identify the problem… maybe something saved incorrectly in syntax?

When you delete a PLEG it leaves stuff around … That’s because MCV does not provide a call to the plugin to cleanup itself before being deleted.
That’s why when you open another PLEG/PLTS after deleting a PLEG/PLTS … it will tell you it found stuff and is cleaning up.

I modify my PLEGs lots of times … and I never have deleted one of my production devices … I have deleted test devices.
So there is something in your workflow … that must be triggering the problems … but I do not know what it is.
Export/Import are on the list … but they are complicated … since PLEG can reference ANY device on Vera … A change to another device could make the Import useless.
And it would be very difficult to verify.

Tests below show my workflow is not the problem.

After doing some searches it seems some people had “Startup Lua Failed” due to license issues… you never posted how to install the license in 5.9 so I did not… maybe this is the problem ?

All PLEG devices partly work (conditions are evaluated and notifications occur) but yet I cannot Enable or Bypass (error: Device not ready) and they all throw “Startup Lua Failed” … PLEG is the only thing not (or really half) working for me.

As a test… I deleted ALL PLEG devices. Then I create a brand new, never touched PLEG device and it STILL gets “Startup Lua Failed” … there should be nothing in it to fail at this point, correct?

I attached an interesting screen shot - it is from right after I deleted ALL PLEG devices and created a fresh one; then opened it up and choose Actions.

The ONLY fix I found is to remove all existing PLEG devices, uninstall all PLEG apps, and reinstall. There is a bug or corruption, somewhere and it only affects the PLEG install.

I opened each device and copied the fields into a text file (PLEG_devices_backup)… hoping you can take a look to see if anything jumps out… maybe some syntax issue?

thx for the help. I want to avoid recreating all of this… I’ve already spent 6 hours trying to troubleshoot the problem.

Startup LUA as a result of License only started today.

The easiest way to get a license is to move up to the latest version that has the interface in it.
The older versions actually have the code to add the license … I thought I would be able to show people how to turn it on … but it has bugs in some cases (Vera 2s, Chained Veras, and a License that has a + character in it) … so the best way is to move up to 6.5

Those popups are me cleaning up AFTER you delete PLEG/PLTS devices … I explained this in my previous post.

Do you know if we can…

[ol][li]pull the PLEG device data from \etc\cmh\User_Data[/li]
[li]uninstall/reinstall PLEG[/li]
[li]put back the PLEG device data[/li][/ol]

?

I’d be happy to pay for licenses but I’m not eager to recreate all of this manually - This is the second time where I’ve had serious corruption of PLEG devices requiring deletion but last time they were not as large/complex.

This happened ~ 4 months ago so I’ve been cautious and have only 25% of all my scenes in the PLEGs. Vera is likely corrupting the devices and/or PLEG code (since only an uninstall/reinstall fixes it this time) but the end result is the same… hours of work to recover/rebuild every 4 months is not acceptable.

If I had an easy way to export/import I’d not be so concerned since recreating would only take a minute, not several hours.

You can save/restore the state for a PLEG from the following variables in the Advanced TAB:

Triggers
Schedules
Properties
ConditionMap
Actions
ConditionRepeat

I have to make a change so that you can save/restore:
StartupLUA

I’ve done that a few times in the past. It works but there are more steps required.

Advanced tab fields don’t exist by default - unless you changed this in 6.x?
So you must first create bogus entries using the UI so the fields are created, then you can go back and paste directly into the, now existing, Advanced tab fields. And you MUST do them in order, one at a time and save after each… Due to your programming checks.

Really need an easier way. Just the 4 pleg devices I have takes an hour to restore using that method.

Sent from my SAMSUNG-SGH-I747 using Tapatalk

You can create them easily with some LUA Script:

The serviceID is:
urn:rts-services-com:serviceId:ProgramLogicC
for all the variables except ConditionMap, it’s servicedID is:
urn:rts-services-com:serviceId:ProgramLogicEG

To Create a variable:
luup.variable_set(ServiceID, VariableName, “”, deviceID)

And you MUST do them in order, one at a time and save after each... Due to your programming checks.
Yes you have to create them ... they do not have to be done in order ... and they do not need to be done one at a time. The checks are only there if you open up any tabs besides the advanced tab, control tab, or notifications. Do not click on any button that is PLEG specific.

[quote=“RichardTSchaefer, post:17, topic:180458”]You can create them easily with some LUA Script:

The serviceID is:
urn:rts-services-com:serviceId:ProgramLogicC
for all the variables except ConditionMap, it’s servicedID is:
urn:rts-services-com:serviceId:ProgramLogicEG

To Create a variable:
luup.variable_set(ServiceID, VariableName, “”, deviceID)

And you MUST do them in order, one at a time and save after each... Due to your programming checks.
Yes you have to create them ... they do not have to be done in order ... and they do not need to be done one at a time. The checks are only there if you open up any tabs besides the advanced tab, control tab, or notifications. Do not click on any button that is PLEG specific.[/quote]

Got it. So manually create the devices using the PLEG app, then script the variable population like this…

luup.variable_set(urn:rts-services-com:serviceId:ProgramLogicC, Schedules, "[['MorningTimeON','2','06:30a:00','1,2,3,4,5,6,7','','0','','',''],['EveningTimeON','2','18:45:00','1,2,3,4,5,6,7','',null,null],['MorningTimeOFF','2','09:00:00','1,2,3,4,5,6,7','',null,null],['EveningTimeOFF','2','21:30:00','1,2,3,4,5,6,7','',null,null]] ", 127) ... and so on for each

also, response from Vera Support…

This is the log sequence in which i see the PLEG error. 01 04/01/14 11:41:46.971 LuaInterface::CallFunction_Startup-1 device 211 function Initialize failed [string ?module(?L_ProgramLogicCRG", package.seeall)?"]:100: attempt to perform arithmetic on local ?tmp? (a nil value) LEAK this:61440 start:1568768 to 0?186b000 <0?2bb07680> 01 04/01/14 11:41:46.971 LuImplementation::StartLua running startup code for 211 I_ProgramLogicEG.xml failed <0?2bb07680> According to this sequence one PLEG condition has nil/(nothing or zero) value and it;s causing the error. In the

… does this tell you anything – before I blow everything away?

Yes to script create …
But the arguments to ServiceID and Variables in luup.variable_set are strings … you need to wrap the values with double quotes … You did this properly for the value.
[hr]
Yes the log file indicates that maybe your temp space is filled up … Licensing needs to create a small file … about 20 bytes … It puts a number in the file.
The number is computed when the first PLEG runs … it’s a time consuming operation, so it save the result in a file for other PLEGs to use.
The number is based on the VeraID, the time of day, and the License. The number is only good for 60 seconds.

The fact that the value is NULL tells me that the file was not written properly … as I said … either the tmp space (USB stick) is full … or it had write errors, and could not be read properly.
Another thing that could cause that problem is that the overall startup is taking to long … more than 60 seconds from the init of the first PLEG to the last in your version … I increased it to 90 seconds for 6.5

I will be changing that logic … it has already been a problem for people doing two reboots in a row.

my USB drive shows 7% full, up from 5% a few days ago due to starting Verbose… it is an 8GB drive. I will try reformatting the drive.