# ti103

Last modified by Richard Johnson on 2018/08/01 00:46
Export
Office Formats
Export as PDF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

The X10 protocol allows a person to control devices (on, off, bright, dim, etc.) by sending commands over power lines. This protocol is extremely old (developed in 1975). I remember it being sold in Radio Shack catalogs when I was in high school, long before I knew anything about computers! This was the original "Home Automation". The protocol is actually pretty interesting in that it modulates the AC line during the short time when it's "crossing zero" (60 times a second). Commands are rather simple, but the devices have been around for many years and thus there's an X10 device for just about anything, and they're a lot cheaper than other, newer, Home Automation devices.
One of the devices is named "TI103". It's an interface between a serial line and the electrical system. You plug one side into a terminal serial line (I have mine plugged into a serial line to USB adapter and thus into a USB port), and the other inside plugs into your wall outlet. It can read and write X10 commands on the electrical system. As such, it allows the computer to both control other devices as well as see what other X10 commands are being sent elsewhere. This is important because (1) some X10 devices will send signals when they detect something, such as a motion sensor, and (2) if you use an X10 button box to turn on and off devices, the computer needs to know when this has happened, even though it didn't initiate the command, so it can track device state.
I purchased my TI103 device, then downloaded the hardware manual and wrote my own controller program. It's simple, yet it does everything I need. It serves as the backbone of all X10 interfaces in my home network. It allows me to turn on and off devices, track the state of devices, and initiate actions based on state transitions. This last ends up being very important, allowing me to do such things as turning on a light (X10 or even Wink controlled) when a motion sensor detects something. Since this is a script, it can even determine when an action is appropriate by looking at other information, such as whether or not it's past sunset, when recently the action occurred, etc., and sending email, or initiating other actions afterward.
Here's the source of the ti103.c program.
The program understands the following commands (case doesn't matter):

- "Description <house-code><unit-number> <descriptive string>"
  Associates a descriptive string with the X10 device.
- "Trigger <house-code><unit-number> <function> <command>"
  Runs the <command> given, when the X10 device specified is sent the <function> given
  E.g., "trigger j10 on /usr/local/etc/send_email.sh"
  <house-code><unit-number> may be "ALL"
  (Note, the command is only triggered upon a state transition change. Multiple functions of the same type will only trigger the command to be executed once.
- "Always <house-code><unit-number> <function> <command>"
  Always runs the command given when the X10 device receives any function code
- "Never <house-code><unit-number> <function>"
  Never run any commands when you see this X10 device receive this function.
- "Reset <house-code><unit-number> <function>"
  Clears any configuration associated with this X10 device.
- "Dump"
  Dumps all configuration commands.
- "Events <filename>"
  Specifies the location for an events log
- "Reinit"
  Simply resets all internal state.

For a small example, here's portion of my ti103 configuration file (this is not the complete file):

desc A 4 weather system

desc M12 bird mist

always M06

always M10

never M10

never J04

always M05 ON /usr/local/etc/ti103_scripts/spa_motion.sh ON

always J09 OFF /usr/local/etc/ti103_scripts/birds.sh OFF

trigger M10 OFF /usr/local/etc/ti103_scripts/veranda_dusk.sh OFF

trigger M10 ON /usr/local/etc/ti103_scripts/veranda_dusk.sh ON

always M09 ON /usr/local/etc/ti103_scripts/veranda_motion.sh ON

always J09 ON /usr/local/etc/ti103_scripts/birds.sh ON

trigger all /usr/local/etc/ti103_scripts/notify.sh '%h%u [%d] %f' >/tmp/ti103.out 2>&1

trigger M16 ON /usr/local/etc/ti103_scripts/front_door_dusk.sh ON

trigger M16 OFF /usr/local/etc/ti103_scripts/front_door_dusk.sh OFF

never J12

events /usr/local/etc/events.log

commands /usr/local/etc/ti103_commands.txt

Notice that the <command> portion can use some C printf() style encoding in order to substitute house-code, unit-number, description, and function names.

0
Tags:
Created by Richard Johnson on 2018/08/01 00:46

- Comments (0)
- Attachments (0)
- History
- Information

# Applications

# Tips

Press the x+x+x+a key combo to toggle the Advanced mode and x+x+x+h to toggle the display of hidden pages.

# Need help?

If you need help with XWiki you can contact:

- Community Support
- Professional Support

XWiki Debian 13.10.2