VeraLite Locked Up?

as you might can deduce from my frequency of questions lately, I’ve been trying to learn Lua/LUUP stuff. I had everything working fine yesterday. I went int this morning to add some stuff. I have one scene that runs every 15 m. I noticed that the last time it ran was ~2am. So, I simply clicked on that scene to run it. Then, the status window showed unit busy and never snapped out of it. So, I logged out and tried again. Now, I can login, but when I try to access the unit, I get the dreaded white screen. This happened last week and killed the unit. I ended up starting frm scratch and rebuilding from backups. That scared the hell out of me! I’m just thrilled I got it working again. So, everything worked great yesterday and I was able to get in this morning. So, any ideas? Is there a fundamental oops I might be doing in Lua/LUUP? Is there any way I can get back into my unit remotely (I am at work)? Thanks for the help. This is pretty frustrating. It baffles me how it ran all day yesterday and then died when I tried to run the scene. Very strange. I wish there was a better method of recovery and troubleshooting code.

Tony

Well, it happened again this morning! This is really getting old. I logged in and evrything seemed fine. I have one scene scheduled to run every 15 minutes. Once again, I noticed it had not run since just after 2am, same as yesterday. I clicked on the scene, then checked the schedule setup. I had not named it (Still New Schdule), so I typed in a name, confirmed, then save and the unit is locked up tighter than a drum…for the third time. I don’t understand why what I did would have locked it up? Here is the LUUP code I have in the scene…

In a scene that runs 15 minutes after sunset, I send an emial with the strLightLevel value and then set the variables to " " to start over.

Any ideas?

Thanks,

Tony

--starting out, strLightLevel could be nil and that causes a problem - can't add a nil value --so, lets set it so something non-nil if (strLightLevel == nil) then strLightLevel = " " end

–go get sky condition
local skyCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “ConditionGroup”, 5)

–go get light level

local curLightLevel = luup.variable_get(“urn:micasaverde-com:serviceId:LightSensor1”, “CurrentLevel”, 45)

–make variables non nil just in case
if (curLightLevel == nil) then
curLightLevel = " "
end

if (skyCondition == nil) then
skyCondition = " "
end

–only append string if it is daytime
if (not luup.is_night()) then
strLightLevel = strLightLevel…" , “…curLightLevel…” , "…skyCondition
end

–now send email
–we only want emails during the day, so check…
–if (not luup.is_night()) then

–luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”, {Message = strLightLevel, Recipients = “xxxxxx”}, 18)

–end – end check for night

return true

I don’t see anything in your code that is likely to cause a crash but it has been reported that scenes with repeating interval schedules can kill UI7. If you are running this every 15 minutes you may have tripped over that bug.

BTW: There is a useful facility in Lua to handle nil values in variables using the OR operator:

strLightLevel = (strLightLevel or " ") .. " , " .. (curLightLevel or " ") .. " , " .. (skyCondition or " ")

Thank you for looking and verifying my code. I checked last night and I am still on UI6. But obviously, it doesn’t like the interval timer. Funny that it stopped two nights in a row at the same time, but it doesn’t lock up until I go in and make a change and save. I’m gettign real good at reseting my VeraLite! I’m still not sure about the button sequence, but I did find that after you hit the right button sequence (like twice and hold for 10 or 15 s on the second hit), it takes a while for the unit to come back to life. I had to go through it twice last night to get everything back.

Thanks again,

Tony

I don’t know if this will circumvent the problem but it could be worth a try. If you place this code in your Startup Lua file, it will run scene 11 one minute after a restart and then every 15 minutes. Obviously you can change the scene number and timing.

luup.call_delay("runScene11",60) function runScene11() luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "11"}, 0) luup.call_delay("runScene11",900) end

I did a search on interval schdules and there was a discussion back in July about the issue if inserting LUUP into a scene on an interval schdule casuing the unit to lock up. So, there it is. Glad it ain’t just my ignorance (or stupidity? - either way!). So, I’ll try and put humpty back together again this evening and get rid of that interval schedule.

What I was trying to do was collect data from a light sensor throughout the day, store it in one string, send the string at 15m past sunset (to make sure I got the last value and give the unit time to “get it together”, clear the strings I used, and then let it start over. I only store the values if it is day time. I actually worked for a little while!

I’ll figure out a different way.

Tony

oops, we were typing at the same time.

Thanks, I’ll try that. Learning somethign new - activating a scene from Luup. Much appreciated.

Tony

If that doesn’t solve the problem, you could place your code that accumulates the data in the timed function in Startup Lua. Then you would just need to run the scene/code to report results once per day.

Thanks much for the help. The code in Startup Lua is indeed working. Maybe someday, I’ll get real adventerous and learn to store the data in a file. I haven’t even figured out how to access a log file yet…

Thanks for the ‘OR’ tip for nul values too. That will tidy things up a bit.

Thanks again,

Tony

I’m glad to hear it is working now.

Maybe someday, I'll get real adventerous and learn to store the data in a file.

It really isn’t that hard. See kwikLog for an example.

I haven't even figured out how to access a log file yet.....

There’s an explanation in Logs. Personally I use the log viewer in the InfoViewer plugin.