I'm glad to hear it is working for you.
There are two dim commands.
pl a1 dim 0..31 sends the dim command for older lamp modules
This only works with older lamp modules. I am fairly new to X10 so my gear has
been purchased in the last couple of years so none of my lamp modules
understand this command.
As far as I can tell, 0..31 is the number of steps to dim or brighten. The way
to make it go to 50% dim is to first turn the lamp on to full brightness then
send a dim 15. But this is just a guess because I have no way to test this.
pl a1 xdim 0..63 sends the extended pre-set dim
If you have newer lamp modules (LM465) with soft-start, the xdim command is
required. 0..63 is the absolute intensity level so for 50% send 32, 75% send
48, etc. 63 is a special value that means go to maximum intensity instantly.
62 is the maximum intensity with soft-start.
The value can range from 0..255 according to the X10 specification but the
LM465 ignores the higher values. The upper two bits are supposed to control the
rate at which the intensity changes (faster or slower) but the LM465 is not
affected.
I like the idea of mochad write a log file. I usually do something like this
"nc localhost 1099 >logfile.txt &" but it is one extra step.
At least for the moment, mochad is more like an SDK than a full HA application
like heyu or misterhouse. It is fairly easy to use Perl as a scripting language
to implement your own HA app. Any language that can connect to a TCP socket can
be used.
For example, bash has a socket programming API so shell programmers can connect
to mochad directly. It is "merely" a matter of examining ASCII text strings for
the desired events. This is simple enough for a single device but will get
complex if you have a house full of various kinds of modules. But the minimum
amount of code to create a useful HA app is quite small. BTW, flite is a small
text-to-speech command line program.
#!/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