Need help getting X10 working

@vicom I do not have a MT10A and the commands I see with “nc” for my single security device looks like this:

04/15 13:31:27 Rx RFSEC Addr: A1:C1:80 Func: Panic_KR10A
04/15 13:31:27 Rx RFSEC Addr: A1:C1:80 Func: Panic_KR10A
04/15 13:31:42 Rx RFSEC Addr: A1:C1:80 Func: Disarm_KR10A
04/15 13:31:43 Rx RFSEC Addr: A1:C1:80 Func: Disarm_KR10A

This is my cron job @reboot that intercepts that and converts to MQTT:

#!/bin/sh
#
# mochad to mqtt relay.
#
sleep 2
nohup /bin/nc -d localhost 1099 | /usr/bin/awk -W interactive ' /RFSEC/ && /Panic_KR10A/ { system("mosquitto_pub -V mqttv311 -t /HASS/X10/C16 -m On" ) }'
exit 0

@netrunner, I have the following when i “nc” mochad.

12/30 18:46:59 Rx RF HouseUnit: M11 Func: On
12/30 18:47:05 Rx PL HouseUnit: A5
12/30 18:47:06 Rx PL House: A Func: Off
12/30 18:47:13 Rx PL HouseUnit: A8
12/30 18:47:14 Rx PL House: A Func: On
12/30 18:47:17 Rx PL HouseUnit: A8
12/30 18:47:18 Rx PL House: A Func: Off

As you can see the “RF” commands come through as a single command, but “PL” as two …annoying
:frowning:

I don’t have any hardwired (PL) controllers. They are all wireless. I have a CM15A connected to the PI via USB and running Mochad. The CM15A is set to transceive all house codes from RF to PL so the log below is what I normally see on nc for my RF controllers, including MS16a motion detectors.

12/30 13:12:31 Rx RF HouseUnit: D5 Func: On
12/30 13:12:31 Tx PL HouseUnit: D5
12/30 13:12:31 Tx PL House: D Func: On

I’m sure with cleverness, you could modify the nc script or split it into two scripts with revised MQTT signaling to handle two line commands from X10.

Honestly the only reason I’m using X10 at all is because I have a ton of it from years ago and I like to puzzle through technical challenges! It works perfectly for me, but it took a lot of work to get it there.

Thanks … this solved my problems with mochad_dispatch. I augmented it slightly to a pattern for “Rx RF” so I don’t get multiple RF and PL entries.

/bin/nc -d localhost 1099 | /usr/bin/awk -W interactive ' /Rx RF HouseUnit:/ && /Func:/ { system("mosquitto_pub -q 1 -t /X10/"$6" -m "$8) } ' &

errror ? help me

Traceback (most recent call last):
File “/usr/local/bin/mochad_dispatch”, line 11, in
load_entry_point(‘mochad-dispatch==0.1.9’, ‘console_scripts’, ‘mochad_dispatch’)()
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2631, in load_entry_point
return ep.load()
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2291, in load
return self.resolve()
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2297, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/local/lib/python2.7/dist-packages/mochad_dispatch-0.1.9-py2.7.egg/mochad_dispatch/main.py”, line 107
yield from asyncio.sleep(1)
^
SyntaxError: invalid syntax