more G-Labs products

Author Topic: HomeGenie RF error with X10  (Read 5135 times)

February 04, 2014, 04:24:38 AM
Read 5135 times

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Based on this thread:

https://sourceforge.net/p/homegenie/discussion/general/thread/7db04a98/

I programmed the CM15A with AHP to transceive all house codes and moved it back to the RPi.  I am now able to see the raw RF followed by a House/Unit code line.  It would be very helpful if HG could automatically program the CM15A to all HC since the memory in the controller may not save the configuration for very long once power is removed.  I pulled the batteries and unplugged the unit for a few seconds and it still worked, but I don't know how long it would persist.


As for the errors, I am still seeing the following error in HG on the console:

Code: [Select]
ERROR in _modules_refresh_virtualmods(): Object reference not set to an instance of an object
  at HomeGenie.Service.HomeGenieService._modules_refresh_virtualmods () [0x00000] in <filename unknown>:0

I'm not sure what I need to do to fix this.  I have virtual modules turned on, but none are configured at the moment.


February 04, 2014, 07:25:54 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi kenobi,

googling I found this: http://www.linuxha.com/USB/cm15a.html

It contains lot of info about X10 protocol and it also show how to get current transceived house codes setting from the interface.
Unfortunately it does not explain how to set them =/


February 04, 2014, 07:47:51 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Documentation on uploading data to the CM15A is one thing that has been severely lacking from the beginning (based on reading lots of forum posts around the net).  I have only found 3 programs that are capable of uploading code to the CM15A (though have only tried 1).

ActiveHome Pro - obviously this works since X10 wrote the code.
Active Home Vista - I have not tried this myself, but it is purported to be able to fully replace AHP.
MacOS based program - I don't know the name, but there is supposedly a version of some code for Mac that can upload timers/macros.

None of this directly helps, but at least there are a couple 3rd party software programs out there that can communicate with the CM15A fully, so it must be possible.

February 04, 2014, 09:21:05 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Mmm... Active Home Vista cannot do that:

"CM15A (downloading macros / timers is not supported)"

and also

"In order to use it with the CM15A interface, the ActiveHome Pro SDK is needed (if you donĀ“t have the ActiveHome Pro software installed). This SDK can be downloaded here."


Btw I know it's possible, the problem is that right now I'm running win8 64bit and I am not sure if ActiveHome will work there.
If you have a working ActiveHome + CM15 configuration, please try this:

http://sourceforge.net/projects/usbsnoop/

and let me know if it's possible to capture CM15<->AH communication.

« Last Edit: February 04, 2014, 09:23:32 PM by Gene »

February 04, 2014, 10:36:15 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Yes, my current HA system is AHP on WinXP with a CM15A.  I'll try that program and see if it can capture any traffic.

February 05, 2014, 03:18:00 AM
Reply #5

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I installed SnoopyPro and updated the CM15A from AHP (told it to "download timers/macros").  The program captured 850 packets and provides information about each one.  I don't know what you'd need to see, but I can try to capture some operation(s) if you think that it would help.

My thought would be that I could create an empty profile with no house codes set to transceive and upload.  Then, create another with house code A set to transceive and upload.  The difference should be what you need to know.

February 05, 2014, 03:30:26 AM
Reply #6

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I went ahead and captured some packets.  This includes no house codes, house code A only, and all house codes.  It appeared to capture around 100-200 packets prior to me syncing.  I think it also uploaded 2 different times but I'm not sure.  I believe it initially updated the interface to fix the house codes to transceive and then again when I told it to download the timers/macros.  Either way, you should have the data you need albeit more than you wanted.

I can try again if you give more instructions on specifically what you want to see.

February 05, 2014, 04:17:19 AM
Reply #7

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
This is my guess:

# Set Transceived House Codes command is bb (byte 0) and settings are stored in the 16 bit data from byte 1 and 2
# "Transceive ALL House Codes" in this case 11111111=0xff 11111111=0xff
75   ??? down   n/a   18.059   BULK_OR_INTERRUPT_TRANSFER   bb ff ff 05 00 14 20 28   
                                       

# (No transceived house codes)
24   ??? down   n/a   1.355   BULK_OR_INTERRUPT_TRANSFER   bb 00 00 05 00 14 20 28   
                                          
                                          
# (House code A !?!?!?)
71   ??? down   n/a   6.707   BULK_OR_INTERRUPT_TRANSFER   bb 40 00 05 00 14 20 28   

well this last one is a bit weird. I would expect bb 00 01 05 00 14 20 28 or bb 01 00 05 00 14 20 28 ...
but this is a 0x40 -->  01000000

so try to capture more combinations and keep an eye on how changes the line starting with bb.

Use this http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html to translate hexadecimal values to binary so to have a visual bit representation of the bytes in position 1 and 2.

February 05, 2014, 06:14:43 AM
Reply #8

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I recorded A thru P, one at a time.  I didn't do combinations this time, but perhaps I can do a few to verify.

February 05, 2014, 06:37:59 AM
Reply #9

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
This is what I came up with:

Code: [Select]
Raw USB code HC selected word 2 word 3 bin word 2 bin word 3 bit
bb 00 00 05 00 14 20 28 none 00 00 00000000 00000000 N/A
bb 40 00 05 00 14 20 28 A 40 00 01000000 00000000 2
bb 00 40 05 00 14 20 28 B 00 40 00000000 01000000 10
bb 04 00 05 00 14 20 28 C 04 00 00000100 00000000 6
bb 00 04 05 00 14 20 28 D 00 04 00000000 00000100 14
bb 02 00 05 00 14 20 28 E 02 00 00000010 00000000 7
bb 00 02 05 00 14 20 28 F 00 02 00000000 00000010 15
bb 20 00 05 00 14 20 28 G 20 00 00100000 00000000 3
bb 00 20 05 00 14 20 28 H 00 20 00000000 00100000 11
bb 80 00 05 00 14 20 28 I 80 00 10000000 00000000 1
bb 00 80 05 00 14 20 28 J 00 80 00000000 10000000 9
bb 08 00 05 00 14 20 28 K 08 00 00001000 00000000 5
bb 00 08 05 00 14 20 28 L 00 08 00000000 00001000 13
bb 01 00 05 00 14 20 28 M 01 00 00000001 00000000 8
bb 00 01 05 00 14 20 28 N 00 01 00000000 00000001 16
bb 10 00 05 00 14 20 28 O 10 00 00010000 00000000 4
bb 00 10 05 00 14 20 28 P 00 10 00000000 00010000 12
bb ff ff 05 00 14 20 28 all ff ff 11111111 11111111 N/A

Or, more simplified:
Code: [Select]
HC bit
none none
A 2
B 10
C 6
D 14
E 7
F 15
G 3
H 11
I 1
J 9
K 5
L 13
M 8
N 16
O 4
P 12
all all
« Last Edit: February 05, 2014, 06:39:56 AM by bkenobi »

February 05, 2014, 04:33:05 PM
Reply #10

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Wow! =)
I'll add the needed code for the next release.
Hopingly no extra messages have to be sent to configure transceiving.

10x for helping with this.

February 06, 2014, 12:13:40 AM
Reply #11

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi bkenobi,

Attacched the new version with some output debug when changing house codes from Configure->Interfaces.
Currently an interface disable/enable action is required to make changes effective.
Update and let me know if transceiving is working now.
« Last Edit: February 06, 2014, 07:42:52 PM by Gene »

February 06, 2014, 06:36:13 AM
Reply #12

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
That didn't seem to work.

I copied the XTenLib.dll into the root HomeGenie directory (backing up the original of course).  I restarted the RPi.  I used AHP to only enable house code A (B thru P turned off) and then moved the CM15A back to HG.  I disabled "I" and waited for the pinwheel to finish.  I then Disabled and then enabled the X10 interface.  HG wrote the following:

XTenLib: CM15 set transceived codes ==> BB-FF-FE-05-00-14-20-28

I figured this is good, but not so much.  First, nothing even showed a raw rf anymore.  Second, I think all codes should be FF-FF, not FF-FE.  I believe the code being sent (if it worked) would not turn HC N on. 

February 06, 2014, 05:52:00 PM
Reply #13

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
I think I did it.
There were some issues:

1) looks like a set time must be sent too (0x9B ....)
2) there is another message to be sent before setting codes which is: 0xFB 0x20 0x00 0x02
3) codes were built in a wrong way (mirrored bits)

As a test I connected my old Vista pc, did reset the codes to none with AHP, then attacched to HG with the new XTenLib and it succesfully setup transceiving for house codes I'm using.
It's not required anymore that you enable/disable the interface for settings to become effective.

Hope this work for you too!
« Last Edit: February 06, 2014, 07:38:12 PM by Gene »

February 06, 2014, 06:19:17 PM
Reply #14

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
never mind =) it stops receiving ALL RF after a very short while =/
I'm checking this right now.