reading environment variables

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
koensch
Posts: 15
Joined: Sunday 27 December 2020 22:55
Target OS: Linux
Domoticz version: 2020.2
Location: Netherlands
Contact:

reading environment variables

Post by koensch »

Does anyone know if (and how) system environment variables can be read in a dzVents script?
User avatar
waltervl
Posts: 5730
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: reading environment variables

Post by waltervl »

You can use a shellcommand to list them with a standard Unix/windows command and parse the command output (.data) into Dzvents. See more info in
https://www.domoticz.com/wiki/DzVents:_ ... _execution
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
boum
Posts: 135
Joined: Friday 18 January 2019 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: reading environment variables

Post by boum »

https://www.lua.org/pil/22.2.html

Code: Select all

print(os.getenv("HOME"))
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest