Page 1 of 1

How to check on which device lua scripts runs

Posted: Sunday 07 April 2019 7:27
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?

Re: How to check on which device lua scripts runs

Posted: Sunday 07 April 2019 12:39
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 948 times

Re: How to check on which device lua scripts runs

Posted: Sunday 07 April 2019 12:58
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

Re: How to check on which device lua scripts runs

Posted: Tuesday 09 April 2019 15:47
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!!!!