Page 1 of 1

Device identification in script

Posted: Friday 13 November 2020 20:36
by oliviers
Hello,
I have several ON/OFF switches, launching the same (bash) action script when turning on.
Question: What can I do, in the script, to identify the switch which triggered it ??
Take care,
Olivier

Re: Device identification in script

Posted: Friday 13 November 2020 21:45
by waaren
oliviers wrote: Friday 13 November 2020 20:36 I have several ON/OFF switches, launching the same (bash) action script when turning on.
Question: What can I do, in the script, to identify the switch which triggered it ??
Assuming you use the On action field of the devices for this; set it to something like

script:///<full qualified scriptName> <name of your device>

and in the bash script use something like

Code: Select all

parm=${1:-empty}

echo $parm >> /usr/local/domotica/data/parmTest.log

Re: Device identification in script

Posted: Friday 13 November 2020 21:53
by oliviers
Thank you, that would do it ! I will try this first thing in the morning tomorrow !

Edit: Saturday, noon: That indeed works!