Page 1 of 1

Where are my Lua scripts ?

Posted: Wednesday 02 January 2019 15:21
by fsabatie
Disclaimer: I'm new to Domoticz

I'm trying to use Lua scripts to run when some virtual switch is ON (on action ON).

I have written my Lua script in the Setup>More Options>Events GUI under "Lua". However, the script does not appear once saved in my /home/pi/domoticz/scripts/lua folder as it should (?). Therefore I cannot link to it from a switch starting with script:// ...

Am I missing something?

Cheers,
Frank

Re: Where are my Lua scripts ?

Posted: Wednesday 02 January 2019 15:44
by Siewert308SW
Lua scripts written in Domoticz it self are stored into the database and not as fiscal file

Re: Where are my Lua scripts ?

Posted: Wednesday 02 January 2019 15:52
by waaren
fsabatie wrote: Wednesday 02 January 2019 15:21 I'm trying to use Lua scripts to run when some virtual switch is ON (on action ON).

I have written my Lua script in the Setup>More Options>Events GUI under "Lua". However, the script does not appear once saved in my /home/pi/domoticz/scripts/lua folder as it should (?). Therefore I cannot link to it from a switch starting with script:// ...

Am I missing something?

Cheers,
Frank
domoticz Lua and dzVents scripts in domoticz are not to be used in the On or Off section as script:// types.
It will not work as they need domoticz data that is not available to OS level Lua scripts.

Re: Where are my Lua scripts ?

Posted: Wednesday 02 January 2019 16:14
by fsabatie
I think I understand :)
thanks !

Where are my Lua scripts ?

Posted: Thursday 03 January 2019 12:58
by mvzut
As an additional remark, just in case you didn't know yet:
You can still make your script run when your switch is operated (regardless of whether it is saved under ~/domoticz/scripts/lua or in the database). Just set the type to "device", and do a check such as

Code: Select all

if devicechanged['Your device'] == 'On' then
 ... (your code)
end
Change 'On' to whatever state you want your script to start on (also depends on the device type).