Differences using LUA script in webinterface vs flat file

Moderator: leecollings

Post Reply
User avatar
Bartb
Posts: 17
Joined: Monday 29 August 2016 22:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Differences using LUA script in webinterface vs flat file

Post by Bartb »

Hi,

I have several LUA scripts running as files in the .../domoticz/scripts/ directory.
I also have one LUA script that I inserted via the web interface.
All works fine and in parallel.
The only difference I see is that scripts added to the .../domoticz/scripts/ directory are not visible in the web interface and visa versa.

Are there any other advantages/disadvantage for putting LUA scripts in the web interface, possibly in terms of speeds, flexibility, backing up, etc., that are worth knowing?

thanks!
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Differences using LUA script in webinterface vs flat file

Post by Egregius »

I believe file based scripts are executed before the database scripts (at least that was my finding several months ago).
So file based scripts are slightly faster, definnitely if there's only one. The more scripts the slower they get.
As for backup, I prefer files also because I backup my whole domoticz folder. Even when the database is completely corrupted I still have the scripts.
Another advantage that I can think of is that while you keep the script open in a editor you can use undo the revert recent changes.
lost
Posts: 662
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Differences using LUA script in webinterface vs flat file

Post by lost »

Egregius wrote:Another advantage that I can think of is that while you keep the script open in a editor you can use undo the revert recent changes.
That's right, but I wonder if there is a way to test without waiting for execution (every mn for a time script, once changed for a device)... Well, a way to trigger the Domoticz Lua interperter off line!

At the moment, I stick to python, only making the domoticz glue with Lua, for this reason (well, some heavy json results parsing, for instance; is usually easier in python too but sometimes I may have sticked to Lua if debug was easier)...
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Differences using LUA script in webinterface vs flat file

Post by Egregius »

I only use one lua script to pass the changed device to php, all the rest is done there.
You can always trigger the device by calling the json updatedevice command in a browser ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest