Where are my Lua scripts ?

Moderator: leecollings

Post Reply
fsabatie
Posts: 2
Joined: Wednesday 02 January 2019 15:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Where are my Lua scripts ?

Post 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
User avatar
Siewert308SW
Posts: 288
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Where are my Lua scripts ?

Post by Siewert308SW »

Lua scripts written in Domoticz it self are stored into the database and not as fiscal file
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Where are my Lua scripts ?

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
fsabatie
Posts: 2
Joined: Wednesday 02 January 2019 15:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Where are my Lua scripts ?

Post by fsabatie »

I think I understand :)
thanks !
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Where are my Lua scripts ?

Post 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).
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest