@Russ Thanks, that did the trick!
On to Rasberry, following the new instructions to the letter!!
@Russ Thanks, that did the trick!
On to Rasberry, following the new instructions to the letter!!
@tuicemen Got it all working tonight. YAY! Thanks again guys. Just to get it all in one place, here's what works for me:
/root/.TRIGGERcmdData/commands.json
[
{"trigger":"Living Room Fan","command":"/home/pi/scripts/X10.sh i6","ground":"background","voice":"Living Room Fan","allowParams": "true"},
]
(duplicated for each X10 house unit, i.e. i6, i5, etc.)
Script:
"/home/pi/scripts/X10.sh i6"
echo "pl $1 $2" | nc -w 1 localhost 1099
echo "sent powerline command $1 $2 to mochad"
Even with you guys' help this was a bit of a pain. This really should all be put into a simple install guide. But, it works great!
Cheers!
@steve-porter Actually, I just noticed in my example .json command I left a comma in at the end of the line. That'll be a gotcha. The LAST command line in that file can not have a comma, it won't tell you that, it'll just not update the .json file.
@tuicemen Got it all working tonight. YAY! Thanks again guys. Just to get it all in one place, here's what works for me:
/root/.TRIGGERcmdData/commands.json
[
{"trigger":"Living Room Fan","command":"/home/pi/scripts/X10.sh i6","ground":"background","voice":"Living Room Fan","allowParams": "true"},
]
(duplicated for each X10 house unit, i.e. i6, i5, etc.)
Script:
"/home/pi/scripts/X10.sh i6"
echo "pl $1 $2" | nc -w 1 localhost 1099
echo "sent powerline command $1 $2 to mochad"
Even with you guys' help this was a bit of a pain. This really should all be put into a simple install guide. But, it works great!
Cheers!
@tuicemen Oh, SWEET! So sounds as if this was a consulting gig for someone else? Very nice!
@tuicemen I'm mostly now using smart plugs and light bulbs via WiFi but still have a bunch of X10 stuff. My pool light and waterfall both have 220v X10 modules, and the smart plugs won't work with fan motors. And for my house ceiling fans I installed X10 "relay" switches cause they're way cheaper than the smart switches that would work.
I moved all the X10 stuff from my Windows Desktop to the Raspi. Mochad wouldn't compile without a bunch of errors, which is why I modified it. The version I started with was mochad-0.1.17. I've heard rumblings of a mochad-0.1.19 version floating around somewhere, so I'm bumping this one to mochad-0.1.21 just to be sure. Mochad recognized my X10 CM15a with no problem. That's the same hardware I was using with my Windows installation for years.
I'm going to be setting up the script stuff you and Russ pointed my towards today.
Cheers
(P.S: I'm in California, what region are you?)
@steve-porter Just realized that "Alexa, Turn off living Room Fan" also turns the fan ON......another Hmmmmmm.....
You guys ROCK! Thanks for your guidance for an old 80's c programmer (I'm 63 and still learning *-).....)
K, so I got all my desktop commands into the Raspi .json file. Had to delete my desktop and Raspi from Trig website, then reinstall the Raspi. K, so now commands half way work. Funny thing, Alexa can turn things on , but not off. Hmmmm.....Really just for the paper trail.....just was wondering why, Hmmmmm?
K, so I'll work on the script route, sounds like the best way to go....
@tuicemen Thank you for your replies, I appreciated it very much. Creating the shell script would shorten the amount of text in the commands.json triggers. It apprears that I would still need a trigger for each x10 unit on, x10 unit off.
I would really like to be able to send the variables [i6 on], or [i6 off] to the same trigger. In the TriggerCMD web interface you can trigger with parameters, but I just don't see how to get those parameters into the trigger command string.
Something like this:
{"trigger":"Living Room Fan On","command":"echo "pl $1 $2" | nc -w 1 localhost 1099","ground":"background","voice":"Living Room Fan Off","allowParams": "true"}
and be able to pass the i6, on. (just my attempt at a guess, this doesn't work)
@russ Hi Russ, just spent a week debugging mochad on Linux/Raspi. It now works sending to X10 perfectly, using the above command line example:
"echo "pl i6 on" | nc -w 1 localhost 1099
I've never worked with scripts in linux, but I have edited the commands.json file and have a couple of commands working and showing up in the web interface, and they work.
Right now one to turn on a fan, a separate one to turn that fan off. So I added a new one, changing "allowParams": "false" to "true". So now the Parameters button is there. How do I format the command in commands.json to pass the "on"/"off" param to this:
{"trigger":"Living Room Fan On","command":"echo "pl i6 on" | nc -w 1 localhost 1099","ground":"background","voice":"Living Room Fan On","allowParams": "true"} ?
I tried putting [param] in a few ways but haven't found the correct format.
Steve
@russ That works, I see the trigger run. I still need to figure out what's going on inside mocad. The Tx function runs, but isn't sending the x10 signal.
How would it look using parameters? (Obviously parameters true)