Skip to content
ggodart edited this page Jan 6, 2021 · 3 revisions

X10_BX24

See original

DESCRIPTION

This is the second beta release of a module interfacing with the BX24-AHT kit from Dave Houston and Peter Anderson . This device could replace all TM751 and a MR26a modules. It could receive and interpret all RF housecode.

This module is based on the example code example_interface.pm and the MR26a modules (Many thanks to the authors).

On Dave Houston site, there is information on how to build a turnstyle antenna. This antenna is very cheap to produce, and give good result

For now, the module receive all RF code, and convert them to be compatible with MisterHouse X10 device definition (A1 ON -> XA1AJ).

A CM11A device could be plug in one of the 3 serial output port of the BX24. This allow the BX24 to receive RF signal and relay them to the CM11A, without interfacing with a computer.

If the CM11a is attached on one of the BX24 serial port, this module could send X10 command through in the same was as we do with a directly attached CM11a

If we are addressing a single unit, then we could use On/Off Bright/Dim and extended command. If we are addressing a whole house, then only on and off could be use

The interaction between the BX24 and the computer is done via a serial port (DB9) at 19200 Bauds.

The BX24 could have an optional barometer, and this code can handle the information provided by the barometer. There is 2 way to trigger the Barometer data. By programming a Parameter event via the BX24 computer interface, or by sending a "B" command to the serial port of the computer. I choose the later, to get more flexibility. So, my MisterHouse program, will have to send the command on a regular basis. NOTE:, the response received from this event may take up to 1 sec to get back.

When we receive an RF signal, we get this message RF: [764] 30 50 (P6 On)

Any other RF message (i.e.: Security device) are similar to RF: [632] 7F 00

When the CM11a detect a command on the line we have the following 2 lines note: the -3 represent the 3rd BX24 serial interface RX: P6-3 RX: P On-3

When we receive a barometric signal, we get Barometer: 868

INI PARAMETERS

Use these mh.ini parameters to enable the BX24 code:

  BX24_module = X10_BX24
  BX24_port   = /dev/ttyS1
  BX24_BarometricFactor = 8.39  # this is the correction factor

Items.mht

Defined in items.mht as

# Security device named EntranceSensor with a security code FD
  RF,     FD,     EntranceSensor,            Security

EXAMPLES

Here is some examples on how to use the module

 #This will create the BX24 object
 $v_BX24 = new X10_BX24;

 #this define a regular misterhouse X10 Device
 $Bathroom = new X10_Item('J2');

 #this is the other way to define the EntranceSensor
 $v_EntranceSensor  = new RF_Item('FD'    , 'EntranceSensor' );

 # If the BX24 receive a J2 On command.
 # A regular X10 event will be set
 # and the application will see the event like it
 # came from a CM11a

 if ( state = state_now $Bathroom) {
    my $level = level $Bathroom
    &main::print_log("J2 state is $state and level is $level\n");
 }


 # if we want to send X10 cmd via the BX24
 # Computer -> BX24 -> CM11a
 # we want to open the bathroom light
 set $Bathroom 'on';

 # if we want to dim the light by 40
 set $Bathroom '-40';

 # if we want to bright the light by 20
 set $Bathroom '+40';


 # If the optional barometer is installed
 if ($New_Minute) {
    $v_BX24->Query_Barometer;
 }

 # if we look at all BX24 received code
 if (my $Pressure = state_now $v_BX24) {
     # we should get somethings like    Barometer: 867
     $Pressure =~ s/Barometer: //;
     chomp $Pressure;
     return if $Pressure =~ /^$/;

     $Pressure = int( $Pressure * 100 / $config_parms{BX24_BarometricFactor} ) / 100;
     &main::print_log("The pressure is $Pressure\n");
 }

 # if we want to get the last Barometric pressure call by Query_Barometer;
 # note this will be 1 pass delayed
 if ($New_Minute) {
    my $Barometer=$v_BX24->Current_Barometer;
    &main::print_log("Current Barometer=$Barometer\n");
 }

 #The the following code will report the sensor state
 # state could be open or close
 if ( my $state = state_now $EntranceSensor ) {
    ::print_log "Entrance sensor is now $state";
 }

 #Now, if you define your sensor in user code like
 $v_EntraceSensor  = new RF_Item('FD'    , 'EntranceSensor' );
 Then the following code will behave the same
 if ( my $state = state_now $v_EntranceSensor ) {
    ::print_log "Entrance sensor is now $state";
 }

AUTHOR

Gaetan Lord email@gaetanlord.ca

SEE ALSO

http://www.laser.com/dhouston
http://www.phanderson.com

Clone this wiki locally