From: Noah S. <ns...@ho...> - 2007-11-12 04:21:52
|
According to this the snippet below the W800 will only be able to receive 32 out of 48 bits. http://www.cheapertronics.com/product_details.php?item_id=20 The preferred receiver for the RFXPwr data is the RFXCOM X10 receiver. This receiver can receive the full 48 bits data packets. The maximum power that can be measured before the counter rolls over to zero is 16777.215kWh. The 48 bits data packet enables a parity check on the received data. The W800 receiver can receive 32 bits and is therefore able to receive the first 32 bits of the data packet. These 32 bits contain the RFXPower unit address and the lower 2 bytes of the measured value. The maximum power that can be measured before the counter rolls over to zero is then 65.535kWh. A parity check is not possible when the W800 is used and the configuration packets can not be received by the W800. The Homeseer ACRF plug-in version 1.2.0.3 and up supports the RFXMeter with the RFXCOM receiver only. In you code you'd probably have to keep track of each 65.535 kWH interval during your billing cycle. declang wrote: > Hi folks, > > In my wisdom, I decided to have a go at this myself, but I'm a bit lost. > > I added a new module, X10_RF_RFXPower.pm, containing 2 subs : > > rf_is_rfxpower, rf_process_rfxpower > > Within X10_RF.pm I added: > > > use X10_RF_RFXPower; > > and I added similar check & process calls. > > } elsif (&rf_is_digimax210(@bytes)) { > return &rf_process_digimax210($module, @bytes); > > } elsif (&rf_is_rfxpower(@bytes)) { > return &rf_process_rfxpower($module, @bytes); > > } > > > Now, I think I'm in the right direction. > > ---------------------------------- > sub rf_is_rfxpower { > my($initial_checksum_good, @nbytes) = @_; > > # From the RFXCOM specs for the data transmitted : > # | Byte 0 | Byte 1 | Byte 2 | Byte3 | > # 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 > # <-------------address---------><---------Counter Value -------> > > # 2 Bytes Address. Byte 2 = Byte 1 with compliment of upper nibble (bit > 7-4). > # This way max 256 power phases can be measured > # What does that mean ? > # With compliment of upper nibble (bit7-4) ? > > # So, if we can verify that 2nd byte received is byte 1 with compliment of > upper nibble > # then we can pretty much assume that the data is from teh RFXPower device > # I Think :) > # > # So, how can I do that ? > # For now, we assume we have checked all the other options for RF, so it > MUST > # be from the RFXPOWER > # Yes, I know its crazy, but lets try it & see what happens > # > > return ( $initial_checksum_good > ); > } > ---------------------------------- > Fine, so how do I get the data from the 4 bytes & return it ? > > Here's my attempt, mabye its as simple as the format of the variables .. > > --------------------------------------------------- > sub rf_process_rfxpower { > my($module, @nbytes, @bbytes) = @_; > > # Bytes 1 and 2 dictate the RFXPower Address > # Byte 2 is some check on byte 1, so ignore byte 2 > > my($rfx_address, $power_used); > > $rfx_address = $nbytes[0] ; > $power_used = ($nbytes[2] & $nbytes[3]); > if ($main::Debug{$lc_module}) { > &::print_log(sprintf "%s: reordered: byte 1: %s (0x%02x)", > $uc_module, $bbytes[0], $nbytes[0]); > &::print_log(sprintf "%s: reordered: byte 3: %s (0x%02x)", > $uc_module, $bbytes[2], $nbytes[2]); > > &::print_log(sprintf "%s: rfx_address = %s: Power Used = %s", > $uc_module, $rfx_address, $power_used ); > } > > # Build the state to send off for processing. > > $state="RFXPower : $rfx_address : Units Recorded = $power_used kWH"; > > # Set state of all MR26/W800 and X10_RF_Receiver objects. > &rf_set_receiver($module, $state); > > return $state; > } > ------------------------------------- > But, this gives the following with a mh -debug=w800 > > --------------------------------------------------------------- > 08/10/07 09:11:23 PM W800: raw data: 00f04737 > 08/10/07 09:11:23 PM W800: reordered data: e2 ec 00 0f > 08/10/07 09:11:23 PM W800: reordered: byte 1: (0x00) > 08/10/07 09:11:23 PM W800: reordered: byte 3: (0x00) > 08/10/07 09:11:23 PM W800: rfx_address = : Power Used = > --------------------------------------------------------------- > > Help ! > :teeth: > > I *think* its probably my silly use of these lines to assign the variables. > > > $rfx_address = $nbytes[0] ; > $power_used = ($nbytes[2] & $nbytes[3]); > |