We have moved at community.getvera.com

Author Topic: which command for a lua reload?  (Read 2465 times)

Offline B3rt

  • Full Member
  • ***
  • Posts: 232
  • Karma: +2/-8
which command for a lua reload?
« on: December 20, 2015, 07:37:43 pm »
I am looking for the command to reload the engine remotely but cannot find it.

Can someone tell me which one i must use

I tried this one but i get an error?

http://192.168.1.3:3480/data_request?id=lu_action&serviceId=urn:micasaverde-om:serviceId:HomeAutomationGateway1&action=Reload

I do not seek the command for in lua code itself, searching specific for the http request version....

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: which command for a lua reload?
« Reply #1 on: December 20, 2015, 08:29:42 pm »
Try this one from the Wiki:
    http://wiki.micasaverde.com/index.php/Luup_Requests#reload

I just used it on my Vera3 / UI5 and it restarted.

Offline aa6vh

  • Hero Member
  • *****
  • Posts: 642
  • Karma: +15/-0
Re: which command for a lua reload?
« Reply #2 on: December 21, 2015, 11:05:46 am »
This is not what you asked for, but the information might be useful:

A LUA statement to get Vera to reboot is:

Code: [Select]
os.execute("reboot")

Offline B3rt

  • Full Member
  • ***
  • Posts: 232
  • Karma: +2/-8
Re: which command for a lua reload?
« Reply #3 on: December 21, 2015, 03:16:54 pm »
thx

I can use this..

But what i really need is a way to check externally if the lua enig is still running without any errors.
Sometimes i have random lua errors and this results in a 'dead' vera system, no scenes are executed anymore etc

I tried to use 'http://192.168.1.3:3480/data_request?id=alive' but this returns OK also when your have a lua startup error.

What i had in mind is to check reguarly from my NAS the vera unit if it still runs normally, when not then remotely restart the lua enige so it keeps running.

I now often have a compleet rando lua error in the middle of the night (or middle of day) when no body is at home or in bed. When someone enters the room no sensors are working or scenes are executed because the vera unit had again a complete rando lua error. A simple reload of the lua engine fixes this and the unit is running again.

On UI5 i never had this kind of random errors, the code is OK and according to micasaverde support it is mosttimes caused by plugins randomly.  So a real fix is not available.

This is why i am searching to monitor the unit externally and reboot it when not running anymore..

Who has some usefull tips?

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: which command for a lua reload?
« Reply #4 on: December 21, 2015, 03:35:06 pm »
You could make Vera make an outbound URL call to the NAS, and have the NAS periodically check to see if those logs are sufficiently 'fresh' before initiating the reload (or reboot)

And use the typical/classic fallback of a manual timer on Vera's PSU for a daily hard reboot for cases when it goes totally off the rails.

Offline B3rt

  • Full Member
  • ***
  • Posts: 232
  • Karma: +2/-8
Re: which command for a lua reload?
« Reply #5 on: December 21, 2015, 06:29:38 pm »
if did the following:

- added in one of my timebased scenes (15 minutes) a option to update a mysql database on my NAS, i update a unixtimestamp eachtime this cronjob on vera runs

- on my NAS i already have several script running which check devices in my network constantly and update them in vera, i added a check to read the database and calculate the diff between now and last update
- if the diff is more the 32 minutes it will call the lua enige to reload and when receive OK i update the unixtimestamp in database to prevent constant reloading of lua engine.

I hope with this trick that if the lua engine crashes/errors it is automaticly restarted within 32 minutes.