Page 1 of 1

possibility to start script when switch is pushed

Posted: Sunday 12 March 2017 10:35
by JacquesMulders
Hi,

does someone know if it is possible to start a script when a switch is pushed, with a variable in the end (just like the evohome hardware)

for example:
dimmer slider is set to 60% "script://dimmer.sh" 60 is started.

another example from the evohome hardware:

Code: Select all

script:///usr/local/bin/settemp.sh {deviceid} {mode} {setpoint} {until}
so is it possible for switch/dimmer hardware to send e.g. level, data, idx

Code: Select all

script:///home/pi/dimmer.sh {level} {data} {idx}

Re: possibility to start script when switch is pushed

Posted: Sunday 12 March 2017 10:43
by jvdz
Don't think this is possible in the On/Off action script option, but you can do this with a LUA event script which then shells the bash file.

Jos

Re: possibility to start script when switch is pushed

Posted: Sunday 12 March 2017 10:47
by JacquesMulders
thats not really the action that i want, i can call the api call to get al the data, but it would be much cleaner to just get the variables with the script start.

for the record, ive tryed:

Code: Select all

script:///home/pi/dimmer.sh {level} {data} {idx}

Code: Select all

script:///home/pi/dimmer.sh $Level $Data $idx

Code: Select all

script:///home/pi/dimmer.sh $level $data $idx
the last 2 where as the json output would be if you retrieve the switch status

Re: possibility to start script when switch is pushed

Posted: Sunday 12 March 2017 11:27
by jannl
If you do this via an eventscript in lua, you get almost what you want I think.