Is it possible to have more then one parameter?
I'm playing with x10 on a Raspi using HomeGenie
x10 has a possible 256 addresses that's a lot of bash scripts just for On_Off
Is it possible to add house code (A-P) as an additional paramiter and unit codes (1-16) as another?
the command to turn on a device at house code A unit code 4 would look like this:
Russ last edited by Russ
@tuicemen, you can use $1, $2, and $3 as placeholders for multiple parameters to your script, like this:
russ@RussHP:~$ ./x10.sh A 4 on curl http://url:port/api/HomeAutomation.X10/A4/Control.on russ@RussHP:~$ cat ./x10.sh #!/bin/bash echo curl http://url:port/api/HomeAutomation.X10/$1$2/Control.$3
You'd want to remove echo from the script. I just included that so it would show you the substitutions in the curl command.
@russ thanks, creating the bash file was no problem. I had that working but think the commands.json file is where I've messed up.
Since HomeGenie can handle several different protocols, I've been rethinking what each parameter holds. I may be able to get one simple bash file to handle all protocols I use.
Just need to play with the commands.json file.
Russ last edited by
@tuicemen , if you show me your commands.json I can probably spot the problem. It's usually that you need to escape some characters with a backslash.
One way to do it is to use the GUI editor on another computer and copy the json text over.
@russ Thanks, I found my error, the line in the commands.json file was correct.
I was putting in the wrong X10 address for my test thus it was turning on/off a light in the basement not my test light.