Hi all,
I'd like to know if is better to put the LUA script in the domoticz "events" or in the fonder "domoticz/script/lua" as file (script_device_demo.lua).
I'd like to know if is better regarding the performance, it's faster? It's more reliable?
Thanks.
Is better to put lua script in the domoticz "events" or in the folder "script/lua"?
Moderators: leecollings, remb0
-
Nautilus
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: Is better to put lua script in the domoticz "events" or in the folder "script/lua"?
In file system it is a bit faster. Shouldn't be any difference with reliability. Using the file system also allows you to create a master script ("container") for device changes so that the system needs to run only one script (saves a lot of CPU) when there is a device change. See the forum for more examples...
You can also look into dzVents which is kind of a framework to easily achiever the master script approach: https://www.domoticz.com/forum/viewforum.php?f=59 - or if you are into php search for "pass2php" (https://www.domoticz.com/forum/viewtopi ... 64&t=12343)
You can also look into dzVents which is kind of a framework to easily achiever the master script approach: https://www.domoticz.com/forum/viewforum.php?f=59 - or if you are into php search for "pass2php" (https://www.domoticz.com/forum/viewtopi ... 64&t=12343)
-
bigpea
- Posts: 91
- Joined: Thursday 11 August 2016 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: IT
- Contact:
Re: Is better to put lua script in the domoticz "events" or in the folder "script/lua"?
Ok many thanks.
I will see to follow your suggestion.
Thanks.
I will see to follow your suggestion.
Thanks.
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Is better to put lua script in the domoticz "events" or in the folder "script/lua"?
not only...
by my understanding the event system fires scripts as the events is triggered regadless of the state of the actual running script.
This means that if a device event is triggered, a script will run... if in the meantime another device is triggered, the same script is fired again, so you do have 2 session of the same script that is running
this COULD be a bit messy: tables are generated and available at the beginning of the script and commands are executed at the end of the script (when the return commandArray is computed) so the device table can be outdated by the first script while the second is still running.
An evidence of this behaviour could be a double notification (if you do have any)
In File system method, scripts are not fired twice... the system waits until the previous session has finished
(I'm unclear if this could mean I could miss some events or not
)
ciao
M
P.S.
I personally use the web ide to create and test scripts... than I move them to files
(since there is not a good IDE under ssh for domoticz/luz scripts
:P)
by my understanding the event system fires scripts as the events is triggered regadless of the state of the actual running script.
This means that if a device event is triggered, a script will run... if in the meantime another device is triggered, the same script is fired again, so you do have 2 session of the same script that is running
this COULD be a bit messy: tables are generated and available at the beginning of the script and commands are executed at the end of the script (when the return commandArray is computed) so the device table can be outdated by the first script while the second is still running.
An evidence of this behaviour could be a double notification (if you do have any)
In File system method, scripts are not fired twice... the system waits until the previous session has finished
(I'm unclear if this could mean I could miss some events or not
ciao
M
P.S.
I personally use the web ide to create and test scripts... than I move them to files
(since there is not a good IDE under ssh for domoticz/luz scripts
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
bigpea
- Posts: 91
- Joined: Thursday 11 August 2016 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: IT
- Contact:
Re: Is better to put lua script in the domoticz "events" or in the folder "script/lua"?
Yes emme, I agree with you.
The best way is to use the Web Interface to develope the script and after the test to put the script in the file system.
But regarding the dzVents, it seems very nice, I will study it.
The best way is to use the Web Interface to develope the script and after the test to put the script in the file system.
But regarding the dzVents, it seems very nice, I will study it.
Who is online
Users browsing this forum: No registered users and 1 guest