I'm lost.
Does mochad control the CM15A and CM19A?
thx
#!/bin/bash
#This bash program connects to mochad then scans for alert/normal events from
#a specific DS10A. The lamp or appliance module M1 is turned on
#for alerts and off for normal. Assuming flite is installed, voice prompts
#should also be heard.
#Sample event generated by mochad for a DS10A
#12/20 11:53:58 Rx RFSEC Addr: EF:43:80 Func: Contact_alert_min_low_DS10A
# Connect TCP socket to 192.168.1.254 port 1099 on handle 6.
exec 6<>/dev/tcp/192.168.1.254/1099
# RF devices send the same event multiple times so to avoid multiple
# PL commands and voice prompts, keep track of the device state.
ds10state="unknown"
while read <&6
do
# Show the line on standard output just for debugging.
echo $REPLY >&1
case $REPLY in
*Rx\ RFSEC\ Addr:\ EF:43:80*alert*)
if [ "$ds10state" != "alert" ]
then
echo "pl m1 on" >&6
flite -t "Door open"
ds10state="alert"
fi
;;
*Rx\ RFSEC\ Addr:\ EF:43:80*normal*)
if [ "$ds10state" != "normal" ]
then
echo "pl m1 off" >&6
flite -t "Door closed"
ds10state="normal"
fi
;;
esac
done
Have you really tested the dim and xdim with a lamp module ?
I have LM465 modules, and I've bought very recently, probably they're the newer model.
$ nc localhost 1099
pl b3 on
12/21 09:20:06 Tx PL HouseUnit: B3
12/21 09:20:06 Tx PL House: B Func: On
pl b3 xdim 32 # 50% intensity
12/21 09:20:28 Tx PL HouseUnit: B3
12/21 09:20:28 Tx PL House: B Func: Ext code 1, data, control Data: 20 Command: 31
pl b3 xdim 63 # 100% intensity
12/21 09:20:36 Tx PL HouseUnit: B3
12/21 09:20:36 Tx PL House: B Func: Ext code 1, data, control Data: 3F Command: 31
pl b3 xdim 0 # 0% intensity
12/21 09:20:42 Tx PL HouseUnit: B3
12/21 09:20:42 Tx PL House: B Func: Ext code 1, data, control Data: 00 Command: 31
pl b3 off # off
12/21 09:20:55 Tx PL HouseUnit: B3
12/21 09:20:55 Tx PL House: B Func: Off
well maybe, but whatever the number I put in the command
pl a1 dim 0..31
it gets to minimum intensity (almost off).
pl a1 xdim 32
pl a1 xdim 63
pl a1 xdim 0
All my recent LM465s with soft start will not dim to 0%. The lowest I have gotten is about an estimated 20%.
n@my_gentoo - > nc localhost 1099
pl a2 on
12/21 17:44:02 Tx PL HouseUnit: A2
12/21 17:44:02 Tx PL House: A Func: On
pl a2 xdim 32
12/21 17:44:07 Tx PL HouseUnit: A2
12/21 17:44:07 Tx PL House: A Func: Ext code 1, data, control Data: 20 Command: 31
pl a2 xdim 63
12/21 17:44:22 Tx PL HouseUnit: A2
12/21 17:44:22 Tx PL House: A Func: Ext code 1, data, control Data: 3F Command: 31
pl a2 xdim 0
12/21 17:44:34 Tx PL HouseUnit: A2
12/21 17:44:34 Tx PL House: A Func: Ext code 1, data, control Data: 00 Command: 31
pl a2 off
12/21 17:44:45 Tx PL HouseUnit: A2
12/21 17:44:45 Tx PL House: A Func: Off
pl a2 dim 5
12/21 17:52:57 Tx PL HouseUnit: A2
12/21 17:52:57 Tx PL House: A Func: Dim(5)
pl a2 off
12/21 17:53:10 Tx PL HouseUnit: A2
12/21 17:53:10 Tx PL House: A Func: Off
pl a2 on
12/21 17:53:15 Tx PL HouseUnit: A2
12/21 17:53:15 Tx PL House: A Func: On
pl a2 dim 30
12/21 17:53:23 Tx PL HouseUnit: A2
12/21 17:53:23 Tx PL House: A Func: Dim(30)
Very strange indeed ??
any idea in whats the difference with heyu that is able to increase/decrease
by a % ?
do you support those commands ?
I am wondering in your case what is the difference between:
pl a2 xdim 32
and
pl a2 xbright 32
root@my_gentoo - > nc localhost 1099
pl a2 off
12/22 07:38:53 Tx PL HouseUnit: A2
12/22 07:38:53 Tx PL House: A Func: Off
pl a2 bright 5
12/22 07:39:01 Tx PL HouseUnit: A2
12/22 07:39:01 Tx PL House: A Func: Bright(5)
pl a2 dim 5
12/22 07:39:10 Tx PL HouseUnit: A2
12/22 07:39:10 Tx PL House: A Func: Dim(5)
pl a2 off
12/22 07:39:19 Tx PL HouseUnit: A2
I forgot to add mochad supports RF camera events/commands as well.
RFCAM <camera command>
where <camera command> is one of the following:
CAMUP CAMDOWN CAMLEFT CAMRIGHT CAMCENTER CAMSWEEP CAMPRESET1 CAMPRESET2
CAMPRESET3 CAMPRESET4 CAMPRESET5 CAMPRESET6 CAMPRESET7 CAMPRESET8 CAMPRESET9
CAMEDITPRESET1 CAMEDITPRESET2 CAMEDITPRESET3 CAMEDITPRESET4 CAMEDITPRESET5
CAMEDITPRESET6 CAMEDITPRESET7 CAMEDITPRESET8 CAMEDITPRESET9
I do not own any X10 cameras so this is based on examining USB packets generated by AHP when clicking buttons in the virtual remote control pad for the VK7X module. I am interested in hearing if this actually works.
Whew! I am glad to hear dim/bright is working.
Non-security/regular wireless motion sensors send "rf a1 on" and "rf a1 off" so they are pretty simple. I use the RF security MS10A which send out different messages. In either case, writing a program to connect to port 1099 then scan for specific events is the basis for creating an app. The apps/ directory in the 0.1.3 tarball has examples in shell and Perl.
I had to blacklist a couple of standard ubuntu modules and I'm not sure you mention that in the docs.
Anyone working on compiling a package for brcm-2.4 Kamikaze 8.09.2... I've been trying to coax it to work and alas it doesn't quite work out...
Based on observations of the decoded signals from the CR14A camera remote, and Dave Houston's breakdown of the x10 camera protocol (http://davehouston.net/cr14a-rf.htm) it would seem that mochad only supports encoding/decoding of commands for housecode N. Switching the CR14A remote to any other housecode and triggering commands results in "Unknown RF camera command" errors.
I'm a .net programmer so C is not my strong suit, but I thought I'd take a whack at adding support for a housecode parameter in the RFCAM command set. Shall I email you a patch or post it here?
Anyone working on compiling a package for brcm-2.4 Kamikaze 8.09.2... I've been trying to coax it to work and alas it doesn't quite work out...
I released mochad 0.1.4 on sourceforge.net. The RFCAM command should work with house codes now. "rfcam D camup" should send a camera pan up command to house D.
Let me know how it works.
http://sourceforge.net/projects/mochad/
# Python demo interface to mochad. Pressing GUI buttons sends commands to
# mochad to turn lights on,off,bright,and dim. There must be a better way
# to avoid such repetive code. Should work on other support Python platforms
# such as Windows and MacOS but only tested on Ubuntu Linux 10.04.
#
from Tkinter import *
import socket
# Change this to localhost if this program runs on the same host as mochad. Or
# change to the correct IP.
MOCHADHOST="192.168.1.254"
MOCHADPORT=1099
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
s.close()
def mochad(command):
netcat(MOCHADHOST, MOCHADPORT, command)
class App:
def __init__(self, master):
frame = Frame(master)
frame.grid()
Label(frame, text="Bedroom 1").grid(row=0)
self.bed1_on = Button(frame, text="On", command=self.bed1_on_cb)
self.bed1_on.grid(row=0,column=1)
self.bed1_off = Button(frame, text="Off", command=self.bed1_off_cb)
self.bed1_off.grid(row=0,column=2)
self.bed1_bright = Button(frame, text="Bright", command=self.bed1_bright_cb)
self.bed1_bright.grid(row=0,column=3)
self.bed1_dim = Button(frame, text="Dim", command=self.bed1_dim_cb)
self.bed1_dim.grid(row=0,column=4)
Label(frame, text="Bedroom 2").grid(row=1)
self.bed2_on = Button(frame, text="On", command=self.bed2_on_cb)
self.bed2_on.grid(row=1,column=1)
self.bed2_off = Button(frame, text="Off", command=self.bed2_off_cb)
self.bed2_off.grid(row=1,column=2)
self.bed2_bright = Button(frame, text="Bright", command=self.bed2_bright_cb)
self.bed2_bright.grid(row=1,column=3)
self.bed2_dim = Button(frame, text="Dim", command=self.bed2_dim_cb)
self.bed2_dim.grid(row=1,column=4)
# Callback functions invoked when buttons pressed.
# Change "pl" to "rf" if using a CM19A.
def bed1_on_cb(self):
print "bed 1 on"
mochad("pl b3 on\n")
def bed1_off_cb(self):
print "bed 1 off"
mochad("pl b3 off\n")
def bed1_bright_cb(self):
print "bed 1 bright"
mochad("pl b3 bright\n")
def bed1_dim_cb(self):
print "bed 1 dim"
mochad("pl b3 dim\n")
def bed2_on_cb(self):
print "bed 2 on"
mochad("pl b4 on\n")
def bed2_off_cb(self):
print "bed 2 off"
mochad("pl b4 off\n")
def bed2_bright_cb(self):
print "bed 2 bright"
mochad("pl b4 bright\n")
def bed2_dim_cb(self):
print "bed 2 dim"
mochad("pl b4 dim\n")
root = Tk()
app = App(root)
root.mainloop()
rf a1 on
04/25 13:26:31 Tx RF HouseUnit: A1 Func: On
04/25 13:26:31 Tx PL HouseUnit: A1
04/25 13:26:31 Tx PL House: A Func: On
04/25 13:26:36 Rx PL HouseUnit: A1
However when I issue the pl commands the devices do not respond (see below)
pl a1 on
04/25 13:30:28 Tx PL HouseUnit: A1
04/25 13:30:28 Tx PL House: A Func: On
pl a1 off
04/25 13:30:44 Tx PL HouseUnit: A1
04/25 13:30:44 Tx PL House: A Func: Off
512 if (r < 0) {
513 libusb_cancel_transfer(IntrOut_transfer);
514 while (IntrOut_transfer)
515 if (libusb_handle_events(NULL) < 0)
516 break;
517 return r;
518 }
to read:512 if (r < 0) {
513 libusb_cancel_transfer(IntrOut_transfer);
514 return r;
515 }
without this change the code would get stuck in that while loop until kill -9'ed. I figured this was an okay change to make since in your main loop you call the handle_events anyway but with the timeout so things won't get stuck. unknown option -dunless you make line 807 in mochad.c, which looks like:
807 if (strcmp(argv[i], "--raw-data") == 0)
to read: 807 else if (strcmp(argv[i], "--raw-data") == 0)
Thanks for the hard work!
PT 5a 05 07 e7 09 12 01
should set the blinds at B10 to roughly 50%, hopefully...thank you, I saw that too, but that could only be a guide how to modify the mochad source code, right?It can tell you whether or not mochad is sending the codes as defined in the document as well as serve as a guide for modifying the source if that's where the problem lies.
It can tell you whether or not mochad is sending the codes as defined in the document as well as serve as a guide for modifying the source if that's where the problem lies.
pt 07 e7 0F 0F 01
pl a4 dim 26should do the job. Preset dim in mochad range from 0..31 but the thermostat manual shows dim levels from 1..32 so just subtract 1.