From: Marc M. <ma...@me...> - 2012-05-05 22:48:51
|
On Wed, May 02, 2012 at 12:42:57PM -0700, John Branch wrote: > > > Chris Engel wrote: > > > > CS in the name refers to "checksum". All extended messages place a > > checksum > > byte in D14. How this is computed or checked... uncertain. > > > > For those out there that are interested, I did a bit of research to try to > figure out how to use the PLM to send commands to the devices using the new > i2CS. From various online sources I collected a few command traces that use > i2CS: > > 1. 0262 XXXXXX 1F 6B 09 00000000000000000000000000 8C > 2. 0262 XXXXXX 1F 2F 000000 0F FF 01 0000000000000000 C2 > 3. 0262 XXXXXX 1F 2F 000000 0F F7 01 0000000000000000 CA > 4. 0262 XXXXXX 1F 2F 000000 0F EF 01 0000000000000000 D2 > > I quickly noticed that the bytes representing the device ID (XXXXXX) are not > used to compute the checksum as I was able to send the first command to a > new thermostat adapter (using i2CS) and it worked to turn it off. > > While I did not figure out how the checksum is computed, I noticed that, > from one command to another, the offset in the addition of all the bytes, > after the device ID bytes, matches the inverse offset in the checksum. Let > us look at the commands 2 and 3 above for an example. > > The checksum of command 2 is 0xC2 which is smaller than the checksum of > command 3, 0xCA, by 0x08 units. The sum of the extended command bytes in > command 2 is 0x10F and for the command 3 is 0x107. The difference between > the two sums is again 0x08. But as the difference in sums is positive, the > difference in the checksums is negative. This is what I mean by "inverse" > offset. > > By using this approach, various other commands can be built. These are > examples of commands used for the thermostat adapter: > > 1. 0262 XXXXXX 1F 6B 09 00000000000000000000000000 8C - thermostat off > 2. 0262 XXXXXX 1F 6B 04 00000000000000000000000000 91 - heat on > 3. 0262 XXXXXX 1F 6B 0A 00000000000000000000000000 8B - heat program > 4. 0262 XXXXXX 1F 6D 90 00000000000000000000000000 03 - heat at 72F > > Looking forward to learn about the actual algorithm used to compute the > checksum. Form what I can tell it may be the 16 bit 2's complement checksum. Thanks for the updates. I'm sure that you know you will get fame and glory if you add some of this support in misterhouse when you figure it out :) In your case, I absolutely recommend that you look at the insteon branch for adding code, since Gregg cleaned it up massively so that it would allow for adding new objects and support of protocols like this one. Thanks for looking into this. Marc -- "A mouse is a device used to point at the xterm you want to type in" - A.S.R. Microsoft is to operating systems .... .... what McDonalds is to gourmet cooking Home page: http://marc.merlins.org/ |