py-spirit1
I published the code I've been writing to github after refactoring it slightly to make it simpler to use and easier to expand from. There is still a lot missing but it's working for me and and as I delve further I will try and keep it up to date. If anyone can improve on it, let me know! Pull requests are always welcome :-)
You can find it at https://github.com/zathras777/py-spirit1
Patterns?
Now that I have a more reliable and consistent packet grabber, I have been trying to find any patterns in the output. I assume each message will have some form of header followed by a body. There may also be a CRC and it could be that the builtin AES encoder/decoder is used for the payload?
The RF controllers are powered by batteries and seem to exhibit fantastic battery life, so I assume they have very little interaction with the heaters unless I press a button. As the heaters are mains powered I assume they have no such low power requirements and hence send out regular packets. This appears to be the case from what I have observed. The messages I have used for this post are all from these regular transmissions.
I considered that these regular packets could have been noise or generated from something else in the house, but they have the correct preamble and sync words which makes this unlikely.
Time & Size?
This output shows the time 16 packets were received with their sizes.
There are 2 different sizes, 40 bytes or 72 bytes which is a consistent pattern I have been seeing. What is the time between packets?
- 72 byte packets - 40 seconds, 40 seconds, 5 seconds, 35 seconds, 40 seconds, 40 seconds
- 40 bytes - 40 seconds, 18 seconds, 21 seconds, 18 seconds, 22 seconds, 40 seconds, 22 seconds
40 seconds seems to be a common theme :-)
Payload?
Every single packet starts with the same 3 bytes: 0xa7 0x46 0x99.
The next 4 bytes are one of
- 0x77 0x46 0x9d 0x0d
- 0x73 0xc6 0x80 0x95
- 0x71 0xc3 0x9a 0x97
After 4 bytes of more variable content we have a block of 4 identical bytes
- 0x8a 0x1b 0xf9 0xca.
Packets with the 0x73 byte in position 3 are 72 bytes long, the others are 40 bytes.
The final portion of the 0x77 payloads shows the variations,
AES?
Could the payload be AES encoded? If it was I would expect the size of be divisible by 16. If we assumed that there was an 8 byte header then each packet fits neatly within the sizes,
- 8 + 2 * 16 = 40
- 8 + 4 * 16 = 72
However, if it was an AES encoded block I wouldn't expect to see the repeated 4 byte block starting at byte 11? For this reason I'm assuming that AES isn't being used.