@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.
Posts made by Steve Porter
-
RE: Command format on Raspi
-
RE: Command format on Raspi
@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!
-
RE: Command format on Raspi
@tuicemen Oh, SWEET! So sounds as if this was a consulting gig for someone else? Very nice!
-
RE: Command format on Raspi
@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?)
-
RE: Command format on Raspi
@steve-porter Just realized that "Alexa, Turn off living Room Fan" also turns the fan ON......another Hmmmmmm.....
-
RE: Command format on Raspi
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....
-
RE: Command format on Raspi
@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)
-
RE: Command format on Raspi
@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 1099I'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
-
RE: Command format on Raspi
@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)
-
RE: Command format on Raspi
@russ steve-porter Am I completely off track on getting X10 working with TriggerCMD on RasberryPI?
-
RE: Command format on Raspi
Hi Russ, mocad is what sends x10 commands to a CM15A on Raspi, on Windows it's not used. My batch files in Windows look like this:
"C:\Program Files (x86)\Common Files\X10\Common\ahcmd.exe" sendplc I4 onI want to move all my commands from my Windows Desktop to my RasberryPI 4, preferable with the gui. Mocad use in a shell command window looks like:
echo "pl i6 on" | nc localhost 1099How do I get that to run from TriggerCMD on Raspi as a trigger? I can edit the trigger files, I'm just not sure how to format it.
-
RE: Command format on Raspi
Oh ya, forgot. Does the RasberryPI image you created include the GUI? Think not, but just clarifying.
Steve
-
Command format on Raspi
Hi, I've been running TriggerCMD on my Windows desktop for a couple of years. I'm working on getting it running on Raspi 4, with GUI. I've successfully installed, and see the Raspi in "My Computers" and the 4 default commands.
A few questions to help clarify things for me:
-
Does TriggerCMD find and use mocad? I have that installed and running but not sure TX is working. I had to change a bunch of variable declarations and definitions in the source code to get it to compile OK.
-
Should I have an Icon in the RasberryPI tool bar?
-
I don't understand the command formatting. How do I get this:
"C:\Program Files (x86)\Common Files\X10\Common\ahcmd.exe" sendplc I6 on
to this format?
{"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"},How are these fields defined?
Steve
-
-
RE: All computers stopped taking Alexa commands since the 21st
Hi Russ, this has been going on for a while. I've rebuilt all my stuff following your directions on "removing all" about 8 time not. It's really gotten to be a total PITA. I have 19 commands, lots of Alexa routines, and every time I have to rebuild all of it. Last night rebuild again and works. Today it all went to crap.....
About to give up....just tired of it.
Steve
-
RE: Installed agent on Rasberry Pi, broke Windows installation
Multiple times, after a fresh install of Pi. I just don't get it. I'll keep digging, thanks Russ.
-
RE: Installed agent on Rasberry Pi, broke Windows installation
Hi again Russ, I'm trying to get everything working with the gui version of Rasberri. Successfully installed the TRIGGERcmd agent, which shows up on the server. So far so good.
Off topic, but I can't get mochad to respond to echo "pl p1 off" | nc localhost 1099. Mochad is running, as a service. NC works, just nothing getting to my cm15a. (it shows up with lsusb)
Does your command line image include mochad? Been scratching my head for days. Searching all over the place. Just getting frustrated over it. Had mochad working on a previous install, but can't get back there for some reason.
Any thoughts or help / direction would be very appreciated.
Steve -
RE: Installed agent on Rasberry Pi, broke Windows installation
@Russ Thanks, that did the trick!
On to Rasberry, following the new instructions to the letter!!
-
RE: Installed agent on Rasberry Pi, broke Windows installation
Hi Russ, reboot of Windows doesn't help. Same behavior since last night after messing up the Rasberry install. Local Command Editor and website triggers don't work. Batch files still do.
I am ashamed to say when I tried installing the Rasberry agent, I just double clicked on the installer and entered my token. Saw nothing happen, so double clicked on the other installer. For now I'm forgetting about the Rasberry, it's shut down.
Did I mess things up on the website? Try deleting the computer on website and start over?
Just want to get it back to working on windows. Was thinking of removing the agent and reinstalling?