How to check on which device lua scripts runs

Moderator: leecollings

Post Reply
Rohald
Posts: 2
Joined: Monday 22 December 2014 7:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How to check on which device lua scripts runs

Post by Rohald »

Hello,

I've one question i have multiple RPI's with domoticz which all use the same scripts but in Bash I know how to select on which host the scripts runs and than executes the script on the other hosts the script won't be executed.


HOST=$(hostname)

if [ "$HOST" = "domoticz" ];
then
<EXECUTE>
else
exit
fi


Is the above also possible with LUA? And how could this be configured?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: How to check on which device lua scripts runs

Post by waaren »

Rohald wrote: Sunday 07 April 2019 7:27 I have multiple RPI's with domoticz which all use the same scripts. In Bash I know how to select on which host the scripts runs.
Is that also possible with LUA? And how could this be configured?
with dzVents (= Lua) and if you use a recent beta, you can identify the name of your system by the atrribute domoticz.settings.location.name which shows the Name you set in Location
System settings location
System settings location
Name.png (63.69 KiB) Viewed 945 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
jvdz
Posts: 2332
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: How to check on which device lua scripts runs

Post by jvdz »

... or simply create a similar uservariable on each system and set that to the systemname. Then you can test the content of that user variable in the script.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Rohald
Posts: 2
Joined: Monday 22 December 2014 7:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to check on which device lua scripts runs

Post by Rohald »

waaren wrote: Sunday 07 April 2019 12:39
Rohald wrote: Sunday 07 April 2019 7:27 I have multiple RPI's with domoticz which all use the same scripts. In Bash I know how to select on which host the scripts runs.
Is that also possible with LUA? And how could this be configured?
with dzVents (= Lua) and if you use a recent beta, you can identify the name of your system by the atrribute domoticz.settings.location.name which shows the Name you set in Location

Name.png
Thx works great!!!!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest