Mochad Reference

From mochad

Jump to: navigation, search

mochad Command Reference

Contents

[hide]

Commands

The following commands cause the CM15A/CM19A to send on power line or radio frequency.

Abbreviations

    <H> = A..P              House code
    <U> = 1..16             Unit/device code
    <Dims> = 0..31          Dim/bright range
    <Xdims> = 0x00..0xFF    Extended Preset dim range
    <SecAddr8> = 0x00..0xFF RF security 8 bit address
    <SecAddr17> = hh:hh:hh where h = hexideciaml digit 0-9a-f
                            RF Security 17 bit address. Valid bits are defined by 
                            the mask FF:FF:80

    The following are use in the extended_code_1 command
    <Type>      Command type 0..15
                    0 = Shutters, sunshades, blinds
                    1 = Sensors
                    2 = reserved
                    3 = Control modules (dimmers and appliances)
                    4 = Extended secure addressing
                    5 = Extended secure address for groups
                    6 - 15 = not specified
    <Func>      Command function 0..15
    <Param>     Command parameter 0..255

See the X10 Extended Code document target:ftp://ftp.x10.com/pub/manuals/xtdcode.pdf for functions and data values available for each command type.
    PL = power line
    RF = radio frequency
    Tx = transmit
    Rx = receive

Power Line Commands

    pl <H><U>
    pl <H><U> on
    pl <H><U> off
    pl <H><U> dim <Dims>
    pl <H><U> bright <Dims>
    pl <H><U> xdim <Xdims>
    pl <H><U> status_on
    pl <H><U> status_off
    pl <H><U> status_request
    pl <H><U> extended_code_1 <Type> <Func> <Param>

    pl <H> on
    pl <H> off
    pl <H> dim <Dims>
    pl <H> bright <Dims>
    pl <H> xdim <Xdims>
    pl <H> all_units_off
    pl <H> all_lights_on
    pl <H> all_lights_off

Radio Frequency Commands

    rf <H><U> on
    rf <H><U> off
    rf <H><U> dim
    rf <H><U> bright

RF Security Commands

    rfsec <Secaddr8> arm
    rfsec <Secaddr8> arm_home_min
    rfsec <Secaddr8> arm_away_min
    rfsec <Secaddr8> arm_home_max
    rfsec <Secaddr8> arm_away_max
    rfsec <Secaddr8> disarm
    rfsec <Secaddr8> panic
    rfsec <Secaddr8> lights_on
    rfsec <Secaddr8> lights_off
    rfsec <Secaddr17> arm
    rfsec <Secaddr17> disarm
    rfsec <Secaddr17> panic
    rfsec <Secaddr17> lights_on
    rfsec <Secaddr17> lights_off

RF Camera Commands

    rfcam <H> camup
    rfcam <H> camdown
    rfcam <H> camleft
    rfcam <H> camright
    rfcam <H> camcenter
    rfcam <H> camsweep
    rfcam <H> campreset1
    rfcam <H> campreset2
    rfcam <H> campreset3
    rfcam <H> campreset4
    rfcam <H> campreset5
    rfcam <H> campreset6
    rfcam <H> campreset7
    rfcam <H> campreset8
    rfcam <H> campreset9
    rfcam <H> cameditpreset1
    rfcam <H> cameditpreset2
    rfcam <H> cameditpreset3
    rfcam <H> cameditpreset4
    rfcam <H> cameditpreset5
    rfcam <H> cameditpreset6
    rfcam <H> cameditpreset7
    rfcam <H> cameditpreset8
    rfcam <H> cameditpreset9

RF to PL repeater

By default, received RF X10 commands are repeated on the PL interface for all house codes. This can be changed using the rftopl command (RF to PL repeater).

   rftopl *    -- enable all house codes (default)
   rftopl abc  -- enable for house codes A, B, and C. Disable for all others.
   rftopl 0    -- disable for all house codes. This is useful if more than
                   one CM15A is in use. Leaving both enabled will result in 
                   PL collisions and redundant commands.

Pass through

For testing, the passthrough command will pass raw binary data to the USB controller. This can be used to send vendor-specific or custom commands.

   pt hh hh ... hh -- h is a hexidecimal digit [0-9A-F]. Each pair of
                      hex digits must be separated by 1 or more spaces.

Device status

   st          -- Get status of X10 devices including security sensors
   st 0        -- Clear device status

The output is designed to be easily parsed on embedded systems without using external libraries. Use the Perl split() function or something similar.

   12/17 12:03:45 Device selected
   12/17 12:03:45 House A: 1
   12/17 12:03:45 House B: 5
   12/17 12:03:45 Device status
   12/17 12:03:45 House A: 1=1
   12/17 12:03:45 House B: 1=0,2=0,3=0,4=0,5=0
   12/17 12:03:45 Security sensor status
   12/17 12:03:45 Sensor addr: 569E80 Last: 39:09 Motion_normal_MS10A 
   12/17 12:03:45 Sensor addr: 9FAA00 Last: 50:02 Contact_alert_min_DS10A 
   12/17 12:03:45 End status

The first section starts with "Device selected". For each house code, the number of devices seen by mochad on PL or RF is shown. "House A: 1" means one device was seen using house code A. The next section lists which unit/device codes were seen. "House B: 5" means five devices were seen using house code B. This information could be used to allocate memory or print HTML table headers.

The next section starts with "Device status". For each house code, and for each unit/device was seen, the device status is shown. "House A: 1=1" means for house code A, unit/device 1 is ON (=1). "House B: 1=0,2=0,3=0,4=0,5=0" means for house code B unit/devices 1 through 5 are OFF (=0).

WARNING: The on/off status is not completely accurate. There are many X10 commands including ON, OFF, ALL_LIGHTS_ON, ALL_LIGHTS_OFF, ALL_UNITS_OFF, etc. and X10 devices respond to some but not all commands. mochad does not know the capabilities of each X10 device so can only guess whether the device is really ON or OFF. Very few X10 devices report their status (RR501 is one) so this feature is mostly useful for determining which X10 house/unit codes are in use.

mochad watching PL and RF packets for ON/OFF commands.

The last section starts with "Security sensor status".

   Sensor addr: 569E80 Last: 39:09 Motion_normal_MS10A

This means an update from an MS10A was received 39 minutes and 09 seconds ago. The MS10A is in its normal (no motion detected) state. The sensor address is 569E80.

   Sensor addr: 9FAA00 Last: 50:02 Contact_alert_min_DS10A 

This means an update from a DS10A was received 50 minutes and 02 seconds ago. The DS10A is in its alert (door or window open) state. The sensor address is 9FAA00.

The last section is ends with "End status".

Event Messages

mochad sends the following event messages to all TCP clients when the CM15A/CM19A controller receives or sends on PL or RF.

Receive event messages

For example, the A1 ON button is pressed on an RF remote control (KR19A) and the RF packet is received by a CM15A. The following receive (Rx) event message will be sent to all clients.

   12/17 01:24:04 Tx RF HouseUnit: A1 Func: On

Power Line

    mm/dd hh:mm:ss Rx PL HouseUnit: <H><U>
    mm/dd hh:mm:ss Rx PL House: <H> Func: All units off
    mm/dd hh:mm:ss Rx PL House: <H> Func: All lights on
    mm/dd hh:mm:ss Rx PL House: <H> Func: On
    mm/dd hh:mm:ss Rx PL House: <H> Func: Off
    mm/dd hh:mm:ss Rx PL House: <H> Func: Dim <Dims>
    mm/dd hh:mm:ss Rx PL House: <H> Func: Bright <Dims>
    mm/dd hh:mm:ss Rx PL House: <H> Func: Ext code 1 Data: <Xdims> Command: 31
    mm/dd hh:mm:ss Rx PL House: <H> Func: All lights off 
    mm/dd hh:mm:ss Rx PL House: <H> Func: Status on
    mm/dd hh:mm:ss Rx PL House: <H> Func: Status off
    mm/dd hh:mm:ss Rx PL House: <H> Func: Status request

Radio Frequency

    mm/dd hh:mm:ss Rx RF House: <H><U> Func: On
    mm/dd hh:mm:ss Rx RF House: <H><U> Func: Off
    mm/dd hh:mm:ss Rx RF House: <H><U> Func: Dim
    mm/dd hh:mm:ss Rx RF House: <H><U> Func: Bright

RF Security

Older devices send an 8 bit address.

    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Arm_Home_min_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Arm_Away_min_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Arm_Home_max_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Arm_Away_max_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Disarm_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Panic_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Lights_On_SH624
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr8> Func: Lights_Off_SH624

Newer devices send a 17 bit address.

    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Motion_alert_MS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Motion_normal_MS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_alert_min_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_normal_min_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_alert_max_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_normal_max_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_alert_min_low_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_normal_min_low_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_alert_max_low_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Contact_normal_max_low_DS10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Arm_KR10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Disarm_KR10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Lights_On_KR10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Lights_Off_KR10A
    mm/dd hh:mm:ss Rx RFSEC Addr: <Secaddr17> Func: Panic_KR10A

RF Camera

    mm/dd hh:mm:ss Rx RFCAM <H> CAMUP
    mm/dd hh:mm:ss Rx RFCAM <H> CAMDOWN
    mm/dd hh:mm:ss Rx RFCAM <H> CAMLEFT
    mm/dd hh:mm:ss Rx RFCAM <H> CAMRIGHT
    mm/dd hh:mm:ss Rx RFCAM <H> CAMCENTER
    mm/dd hh:mm:ss Rx RFCAM <H> CAMSWEEP
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET1
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET2
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET3
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET4
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET5
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET6
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET7
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET8
    mm/dd hh:mm:ss Rx RFCAM <H> CAMPRESET9
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET1
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET2
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET3
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET4
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET5
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET6
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET7
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET8
    mm/dd hh:mm:ss Rx RFCAM <H> CAMEDITPRESET9

Transmit event messages

When a command is processed resulting in the controller sending on PL or RF, a transmit (Tx) event message is generated identical the messages in the previous section except Rx is replaced with Tx.

For example, a client sends the command "pl a1 on\n". All clients will receive notification that the CM15A transmitted via the following two lines.

   12/17 01:19:50 Tx PL HouseUnit: A1
   12/17 01:19:50 Tx PL House: A Func: On