Re: [PLUG] Home Automation mochad netcat ha-bridge

2020-12-05 Thread Ken Stephens
Michael,

Put the startup command in the /etc/rc.local.  The OS is a systemd system,
but you can turn on rc.local.service with systemctl.  You should add the &
at the end on the command in rc.local so it can complete.  If there is no
rc.local file create one and make it executable.

Ken

On Sat, Dec 5, 2020 at 1:22 PM Michael Barnes  wrote:

> Anybody have any experience with mochad or netcat?
> My project is using a Raspberry Pi Zero with an X-10 CM-19A transceiver to
> control my Christmas lights from Alexa.
>
> There are two components to this. First is to install mochad to pipe
> commands to the CM-19A. I got mochad installed and it seems to work. From
> the command line or script, I do
>
> echo "rf A2 on" | nc localhost 1099
>
> to turn on the controllers at address A2. Apparently piping the command
> through netcat gets it to mochad and on to the CM-19A. While that works and
> turns on the lights, the command stays open and I have to hit ^C to end and
> get a prompt back. The other issue is mochad does not start automatically
> on boot. The information I found said mochad should start automatically
> when the CM-19A is plugged into the USB port. I'm far from a USB genius, so
> I'm not sure how this is supposed to work. I do have
>
> /etc/udev/rules.d/91-usb-x10-controllers.rules
>
> which contains
> SUBSYSTEM=="usb", ATTR{idVendor}=="0bc7", ATTR{idProduct}=="0001",
> RUN+="/usr/local/bin/mochad"
> SUBSYSTEM=="usb", ATTR{idVendor}=="0bc7", ATTR{idProduct}=="0002",
> RUN+="/usr/local/bin/mochad"
>
> That should do the deed, but it does not.
>
> So, those are my first two issues, the command not completing cleanly and
> mochad not starting automatically.
>
> The other aspect to this setup is ha-bridge, which is a java thing. It is
> supposed to interface with my Alexa to run scripts on command. I haven't
> gotten far enough along with that to have any questions, yet, but if anyone
> is familiar with it and has any tips to offer, I would appreciate it.
>
> Thanks,
> Michael
> ___
> PLUG: https://pdxlinux.org
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Home Automation mochad netcat ha-bridge

2020-12-05 Thread Bill Barry
On Sat, Dec 5, 2020 at 3:22 PM Michael Barnes  wrote:
>
> Anybody have any experience with mochad or netcat?
> My project is using a Raspberry Pi Zero with an X-10 CM-19A transceiver to
> control my Christmas lights from Alexa.
>
> There are two components to this. First is to install mochad to pipe
> commands to the CM-19A. I got mochad installed and it seems to work. From
> the command line or script, I do
>
> echo "rf A2 on" | nc localhost 1099
>
Does
nc localhost 1099  << EOF
rf A2 on
EOF
work? Some netcats need more persuasion, but some way of feeding it an
EOF is needed.

Bill
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Home Automation mochad netcat ha-bridge

2020-12-05 Thread Michael Barnes
On Sat, Dec 5, 2020 at 5:58 PM Bill Barry  wrote:

> On Sat, Dec 5, 2020 at 3:22 PM Michael Barnes 
> wrote:
> >
> > Anybody have any experience with mochad or netcat?
> > My project is using a Raspberry Pi Zero with an X-10 CM-19A transceiver
> to
> > control my Christmas lights from Alexa.
> >
> > There are two components to this. First is to install mochad to pipe
> > commands to the CM-19A. I got mochad installed and it seems to work. From
> > the command line or script, I do
> >
> > echo "rf A2 on" | nc localhost 1099
> >
> Does
> nc localhost 1099  << EOF
> rf A2 on
> EOF
> work? Some netcats need more persuasion, but some way of feeding it an
> EOF is needed.
>
> Bill
>

Apparently, the EOF thing was an issue.  Adding the -q flag fixed it.

echo "rf A2 on" | nc -q 0 localhost 1099

An entry in /etc/rc.local seems to have fixed the startup problem.

Got ha-bridge and mochad talking. Now the last hurdle is getting Alexa to
talk to ha-bridge.

Michael
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Home Automation mochad netcat ha-bridge

2020-12-05 Thread Russell Senior
The last hurdle might be the realization that having an Alexa in the
first place was a mistake ;-)

On Sat, Dec 5, 2020 at 6:39 PM Michael Barnes  wrote:
>
> On Sat, Dec 5, 2020 at 5:58 PM Bill Barry  wrote:
>
> > On Sat, Dec 5, 2020 at 3:22 PM Michael Barnes 
> > wrote:
> > >
> > > Anybody have any experience with mochad or netcat?
> > > My project is using a Raspberry Pi Zero with an X-10 CM-19A transceiver
> > to
> > > control my Christmas lights from Alexa.
> > >
> > > There are two components to this. First is to install mochad to pipe
> > > commands to the CM-19A. I got mochad installed and it seems to work. From
> > > the command line or script, I do
> > >
> > > echo "rf A2 on" | nc localhost 1099
> > >
> > Does
> > nc localhost 1099  << EOF
> > rf A2 on
> > EOF
> > work? Some netcats need more persuasion, but some way of feeding it an
> > EOF is needed.
> >
> > Bill
> >
>
> Apparently, the EOF thing was an issue.  Adding the -q flag fixed it.
>
> echo "rf A2 on" | nc -q 0 localhost 1099
>
> An entry in /etc/rc.local seems to have fixed the startup problem.
>
> Got ha-bridge and mochad talking. Now the last hurdle is getting Alexa to
> talk to ha-bridge.
>
> Michael
> ___
> PLUG: https://pdxlinux.org
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug