X10Broker for Win32 ~~~~~~~~~~~~~~~~~~~~ ver 0.1 2005/09/01 Tomoichi Ebata E-mail:See http://www.kobore.net/mailAddress.gif http://www.kobore.net/ 0. History ~~~~~~~~~~ ver 0.1 2005/09/01 - The first edition 1. Copyright ~~~~~~~~~~~~ Copyright (c) 2005 Tomoichi Ebata. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified. 2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY Tomoichi Ebata ``AS IS'' AND ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tomoichi Ebata BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2. What is "X10Broker for Win32" ? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Before explaining "X10Broker", I would like to explain about "X10". "X10" is a kind of a network protocol, that enable low speed communication through home power lines. Though the communication quality is worse than telecommunication and the internet, "X10" has been one of the most popular, easiest and cheapest network for home surveillance system in the world, especially U.S. and Europe for more than ten years. Only putting X10 modules to outlet, you are able to put on/off lights in your room, and buzz and chime in combination with various sensor(like human detector sensor). Basically, master machine(like PC server) is no needed, X10 modules works independently with communicating between modules. Generally, the cost of X10 modules is cheap, so you can get them by 20-40 dollars (If you go to U.S. or Europe, you could get it cheapper) Further more information, you might go http://www.freecon.co.jp/pdf/X10_EXPLANATION.pdf http://www.x10-store.com/ ----- "X10Broker" is a windows software, that works as "Broker" for X10 network, and the main purpose of this software is making home security system cheaper and easier. "X10Broker" is always observing various control signal through X10 network, and users could set some conditons and actions for the control. Using this software, you could do something as follow, (1)ON/OFF Outlet control from remote place - whenever you are not home. - Sceduled ON/OFF control is also O.K. (2)Detection by various sensors and send it's alarm message - Detect robber and send the information to your cellphone by e-mail (3)Coordination with various softwares - cronNT, Blat, for example 3.Premise ~~~~~~~~~ - X10Broker works on X10 network. - X10Broker works as an Windows application/Service on PC server(not only XP but 2000,NT maybe) - PC that X10broker installs (X10BrokerBox) needs a powerline interface adapter that controls X10 modules and monitors X10 network(X10 promiscous mode) - If powerline in your house was divided more two systems, you need to make a bridge to transfer X10 signal in a system to another system. You could use a signal bridge like http://freecon.co.jp/pdf/X10_F7SBRIDGE.pdf 4. System components ~~~~~~~~~~~~~~~~~~~~ ( ) Windows BOX Powerline ( ) +------+ || +---+ (Internet) | X10 | |+--|| =[]--| |------|() ( )-----+Broker| || +---+ Motion detector sensor ( ) | Box | || X10PowerFlush ( ) | | || | +--+---+ || /~| | | |+--|| =[]--| | +------+ |RS-232C || +-+ | X10 | | || X10PowerHorn |Client| +-+-+ || +-+-+ | Box | | |----[]= ||--|| =[]--| |-------+ +------+ +-+-+ Outlet || +---+ | || X10 Lump Module | Powerline I/F adapter /~~~~\ + ~~O~~~ PC I/F kit Light - X10BrokerBox, X10ClientBox WindowsXP PC - X10 power line I/F adapter F7TW523 + FCPLC(PC I/F kit) http://www.freecon.co.jp/x10_lighting.php - X10 power flush F7PF284 http://www.freecon.co.jp/x10_lighting.php - X10 power horn F7SC546 http://freecon.co.jp/pdf/F7SC546_RemoteChaim.pdf - X10 lump module To homepage about X10 Fig 4.1 X10 network sample ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The above figure shows X10 network sample. X10Broker is installed to Windows box as a appplication or serivce. X10BrokerBox trys to capture X10 signals from X10 network(X10 promiscous). For example, when the signal is sent to the box through outlet and motion detect sensor and X10 alarm module, the module alarms Powerline I/F adapter captures the signal, and transfer it to X10Broker box. When a policy information, for example "if the motion detect sensor put a alarm signal, send mail to a user", is set up, X10Broker box trys to check the poilcy, and to control the message, and so on. When X10Broker receives a order that means "Turn the light off" for example, from remote machine through the internet, it interprets the order and control X10 module. X10Client is a client program that requests X10 network control to X10Broker from remote place. X10Client's work is very simple. First it try to make TCP connection to X10Broker, and just send message to X10Broker(See X10Client source code). ----- There are two types of "X10Broker for Win32". (1)XP/2000/NT service version "X10Broker for NT Service" x10broker4nts.exe (2)Executable version "X10Broker for Windows" x10broker4win.exe There is on type of X10Client for Win32". (2)Executable version "X10Client for Windows" x10client.exe 5.How to use "X10Broker for Win32" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.1 Preparation Put "x10broker4nts.exe" on the appropriate directory (for example, "c:\bin\x10broke"), and make "x10broker.cfg" and "x10policy.cfg" on the directory of %SystemRoot%system32(for example,"c:\WINNT\system32") The following is the sample of "x10broker.cfg". ---------------------------------------------------------------------- serverport 3055 <---- (1) X10Broker server port number COM COM1 <---- (2) RS-232C port number ---------------------------------------------------------------------- The delimiter of (1) and (2) should be [TAB]. The back of line should be [CR]. Comments are not available for the present version. The following is the sample of "x10policy.cfg". ---------------------------------------------------------------------- &A02 !A20 c:\bin\BlatJ c:\message\sensor2.txt -t ebata@ff.iij4u.or.jp &A05 !A28 c:\bin\BlatJ c:\message\sensor5.txt -t ebata@ff.iij4u.or.jp ^ ^ ^ | | (2)Application starts by Command line | (1)Action Command (0)Address Command ---------------------------------------------------------------------- The delimiter of (0)(1) and (2) should be [TAB]. The back of line should be [CR]. Comments are not available for the present version. The first line means.. "If a order (Control ON(!A20) to Address "A02") is detected, start the client mail program Blat and send sensor2.txt to ebata@ff.iij4u.or.jp" 5.2 Installation and start of "X10Broker for NT Service" From DOS window, input x10broker4nts.exe -install After that, you can see "X10Broker" in Service window ([Start] -> [Control Panel] -> [Services]). You choose this, and push the start button. "X10Broker" will start as a "XP/2000/NT service". 3.3 Uninstallation of "X10Broker for NT Service" From DOS window, input x10broker4nts.exe -remove You can confirm to delete "X10Broker" in Service window. 6. How to use "X10Broker for Windows" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6.1 Preparation Put "x10broker4win.exe" on the appropriate directory (for example, "c:\bin\x10broker"), and make "x10broker.cfg" and "x10policy.cfg" on the same directory. According to "x10broker.cfg" and "x10policy.cfg", refer to the above 5.1. 6.2 Start of "X10Broker for Windows" From DOS window, input x10broker4win.exe 6.3 Termination of "X10Broker for Windows" Use Ctrl-C. 7. How to use x10client.exe ~~~~~~~~~~~~~~~~~~~~~~~~~~~ From DOS window, input x10client [ServerName:PortNumber] [AddressCommand:ActionCommand] Samples x10client A01:A20 erukan.kobore.com:3055 x10client A01:A20 123.456.789.010:3055 Omittion of port number x10client A01:A20 erukan.kobore.com Omittion localhost name x10client A01:A20 x10client &A01:!A20 localhost:3055 7. Applications ~~~~~~~~~~~~~~~ Through the following applications are very helpful for X10Broker, you don't have to use them. You may use your favorite application. (1)Windows command line mail sender software BlatJ(http://www.piedey.co.jp/blatj/) (2)Windows version "crontab" CornNT(http://www.vector.co.jp/soft/winnt/util/se232096.html) 8.Others ~~~~~~~~ Recently, we are able to get cheap security lumps with motion detector, and many kinds of these lumps have a specific interface to connect with When I build my house, I discuss with an electric designer, and he made the outlet of a signal for chimes or horns. So the system could get the lump's signal and get patrol-lump work easily. To tell you the truth, it was me that this system captured for the first time. More than 105 dB big-horn welcomed me when I was home. Though I already set up a policy that a mail message comes to me when a robber invade my house, more thatn 100 mails comes to me every day whenever my wife enters my den in order to give the room clean. I think that X10 network works as a powerline ON/OFF timer. it is helpful for me to get recorde some radio programs. I think that it is great any outlet in my house is O.K X10Broker was made for just one week's summer vacation, so I am afraid that there are a lot of bugs in my program. I welcome any kinds of your bug reports. Thank you for your help. 9. Acknowledgement ~~~~~~~~~~~~~~~~~~ I thank Mr. Hideki Yoshimori in Mitsui Home Co., Ltd. who helped me for the infrastructure construction of a home security system from the start of my house design to the end of delivery. I thank Mr.Kenichi Miyashita in Daiwai Co.,Ltd who constructed various X10 network works, like signal bridge at power line breaker and moving detector light and its signal line, for example, though there was no case about X10 network construction in Japan. 10. Appendex ~~~~~~~~~~~~~ (T.B.D.)