-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new decoder for Velux shutter remote control - io-homecontrol protocoll #1376
Comments
Thanks for the research, I'll look into it soon. There are two possible ways to add support:
|
Thanks for the very detailed analysis! The start- and stop-bit then have the same timing as every other bit. If we don't know about the Sync-word (start byte) then every bit could be seen as a start bit.
I guess we could try to find the start- and stop-bits by searching for a 0b10 pattern repeating after every 8 bits, but that seems like it could fail/false positive a lot. I'll prototype something soon. |
UART decoder support has now been added. The syntax for the flex spec will likely change, but to test this right away use
|
Made a executable with msys/mingw64 after git pull of master branch. So I used the velux remote control and got without decode_uart: New defaults active, use "-Y classic -s 250k" for the old defaults! Disabling all device decoders. time : 2020-05-14 17:45:13 time : 2020-05-14 17:45:13 time : 2020-05-14 17:45:13 time : 2020-05-14 17:45:13 time : 2020-05-14 17:45:14 time : 2020-05-14 17:45:14 time : 2020-05-14 17:45:14 New defaults active, use "-Y classic -s 250k" for the old defaults! Disabling all device decoders. time : 2020-05-14 17:53:39 time : 2020-05-14 17:53:40 time : 2020-05-14 17:53:40 time : 2020-05-14 17:53:40 time : 2020-05-14 17:53:40 time : 2020-05-14 17:53:40 time : 2020-05-14 17:53:40 |
If you have a PCM code of say You need to align one bit to the right, e.g.
|
Yes - I can approve. preamble 55ff made the job:
time : 2020-05-14 18:25:20
model : uart count : 1 num_rows :
1 rows :
len : 208 data :
33f60000003fdacdea000161d20000000d41e9d5c6c86a8c8b24
codes : {208}33f60000003fdacdea000161d20000000d41e9d5c6c86a8c8b24
Some of the 8 telegrams have this bit shift we have discussed before.
They come with 0xaaff and will be shown w/o preamble and decode option.
But if I give preamble=aaff I got never the following data string.
|
To clarify: the preamble can match anywhere in the data. No need to use all bits from the start. Preamble here means: search these bits and cut exactly there.
|
Christian,
nevertheless I can't follow your encoding scheme below I can agree that
with preamble 55ff (better 5555ff) all data can decoded from my remote
control in right way.
Thanks for your efforts,
Dietmar
|
Hello. I just realize I have Velux windows too. The IO-HOMECONTROL protocol is used by theses devices (I have the single-way remote control : no feedback from the window motor sent back to the remote). It gives me the following codes :
Up :
Down :
Note : the down signal is detected 1 times on 3 or 4 tries. The Command 1Byte you identified seems to be different, and also the messages have different length (224 for up and down, 208 for stop). I think the decoder is not accurate. |
Hello, In my opinion you have 27 bytes with Sync, Length, address, command, 7 bytes Rolling code and 2 bytes CRC-16 Kermit Polynom: 0x1021, Init 0x0000, Final XOR: 0x0000 at the end. And the bytes for up, down and stop:
` |
I tried psa's command and observed the following using my two Velux remotes (one code per button push):
I also got a rolling door using Somfy smoove io which produces roughly 10 codes per button push. E.g.
Does this help? |
@dwarning did a very thorough analysis, and found a/the structure including CRC. We can check with your data and turn this into a decoder -- but there is still the rolling code encryption or MAC. |
From the previous examples and the new packets I assume to following format.
It's interesting to note that at least the (presumed) destination, source, and payload field seem not included in the MAC (which is a security bug). |
Is there a firmware file of any io homecontrol device available (to extract the signature private key)? --> There is. PS: "RIGHT" and "LEFT" just refer to different sets of remote/window as well as "PSA" refers to psa's remote/window. |
It's a (truncated) CMAC, there is no indication of AES. And you really don't need it anyway. |
I've added support for Somfy io-homecontrol devices now. Please investigate all your devices and see if
|
This might not be the whole message. If I compare up/down from the same window:
Thus the actual command (up or down) seems to be part of the "MAC". And I'm interested in rebuilding the signature algorithm because I actually want to control the window (not receive commands). |
Yes, 6 bytes MAC does not feel right. It might be 2 or 4 byte data plus 4 or 2 byte actual MAC. Or it could just be encrypted bytes. But based on the whole scheme of this protcol I'd guess it's : fixed header + variable payload + checks (with checks being CMAC and CRC). |
Single button push usually increments counter by 2 thus I only had to push ~128 times ("down" btw). When counter was similar I produced a couple of same-counter-logs:
|
Great! You are right then, there is data in the encrypted field, not just a MAC over the counter.
|
Thus I'd need a log of 32k pushes (+2/push) of up, 32k pushes of down and 32k pushes of stop be able to control the blinds. And then again for the other window ;-) |
Hello again, |
Great find. AES is 128-bit-block based, so there is padding and truncation. The CRC-16 is not 0x8408 but the standard 0x1021 but with bit reflection -- note that (implied)top and bottom bit are always set for a proper CRC. |
At a closer look the linked docs are for a wired communication, not radio. And since we only have 6 bytes of encryption it's either just a truncated CMAC or some encryption scheme other than AES. It could be as simple as a 16-bit LFSR generating an XOR key. |
Should be best to record a sample file with the full conversation. |
Yeah, maybe we are missing one signal. The counter jumps 2 for some reason. Maybe we are missing a packet. |
I see some messages which we are not interested in. Anyway ... see logs attached. "Down" -> "Stop" -> "Up" |
Ok, this signal is pushing what the code is able to handle. The messages are repeated 3 or 4 times. It looks like we are missing one message indicated by the counter because there is a long preamble filling up the buffer. The framing code fails in some cases also but the repeats will most likely recover the message because of the repeats. |
Down results in 5 messages transmitted. Using the SNR values was a red herring. You need to set the gain fixed also. With dynamic gain things will be all over the place. The logs we have seen so far is missing the initial reply. |
Anyway I looked into the actual hardware for this protocol and they are using the SiLabs EFM32. Several devices implementing the protocol seems to have this chip. This is based on information found here: https://groups.google.com/g/openhab/c/AinJdyyDtG0 and here: https://community.openhab.org/t/io-homecontrol-velux-somethings-in-the-bush/11413 From the info there it seems like this protocol is fairly secured. The mcu has built storage and and hardware aes engine: All this together could make this system very secure because all the secrets could be handled inside the mcu. We most likely need this code to be able to figure out the protocol completely. So we need to replicate this: |
Regarding the signal I now think that the logic just simple make sure that both parties are sure of the command steps. If one party is not sending a reply the other party will probably repeat this signal. If one is bored this can be tested by switching of one of the motors and then trying to command it whilst recording the radio transmissions. |
@merbanan: Do you need a Hardware to get the master key or what is needed? |
Since it's possible to clone a remote, and it's possible to have multiple remotes per receiver, I'm thinking it's possible to sniff the AES key when this is done. |
I'm trying to figure out if it's possible to obtain the AES key in some way. I have used
I tried converting it into .sr and had a look at it in PulseView, doesn't mean much to me. There seems to be some modulation but it's not decoded by rtl_433. |
@paller well I assume the aes key is not transmitted in plain text. It could be XORed with a fixed key. And because we don't know the method how to derive it the least path of resistance is to look at the actual code. Looking at actual transmissions can be time of the universe hard. Looking through the code is a year hard. I don't exactly remember the logic but I still think my conclusion stands. Anyway this should work:
|
Hi, JSON received on the broker mqtt { { { Code from shell
time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 time : 2022-05-13 11:20:51 Congrat for your awesome great work |
I submitted #2258 to improve packet detection for both one- and two-way remotes at the parser level. Feedback from subscribers of this issue would be welcome. |
For what it's worth, there is an entire repository dedicated to decoding the protocol: https://github.com/Velocet/iown-homecontrol |
Does it maybe work if we have enough examples to use chatgpt to decode some connections in the code and to analyze the code, I'm really interesting in this because I have 6 shutters and I don't want to by 2 boxes to have this working with homatoc 🤔 |
The Link layer seems to be encoded already: https://github.com/Aldohrs/iown-homecontrol/blob/main/LinkLayer.md. Does this include the missing information here? |
Yes it looks fairly complete. We could add aes support and key input via command line. Then we could decode messages for real. |
We should establish some kind of default post-processor to do these things in a flexible way. It should be transparent but enrich with decoded and aggregated data and possibly de-duplicate. But there are things like https://github.com/kokke/tiny-AES-c and OpenSSL could be employed also. |
That would be great :-) |
Where are we on this issue? Is there a path to adding support to rtl_433 at least in part? Even if a flex decoder with a comment linking to the other project. I would like to see us capture information from issues into the code base and close the issues. |
I guess it's pretty complete since #2258 was merged. Of course it would be possible to make the output more verbose, if that's wanted. Commands get transmitted without being encrypted. AES would only be needed to verify signatures. |
Do you mean "this issue should be closed"? That's how I interpret your comments. |
Wasn’t the question how to figure out the right encryption key a main topic in this discussion? As far as I understand the situation, this information is available now, but there is no implementation using it. Am I wrong? |
Issues are not supposed to be questions :-) I am trying to ask the question: Given that a PR was merged, of the desired functionality, what is missing, and is anyone actually working on it. Right now we have an issue that cannot be absorbed in 30s and I don't know which way is up. |
Is this now working? |
We still need someone to figure out what's done, what's next, and do it. This issue is too hard to understand. |
Recently I asked for differences in decoding Velux remote controller KI 313 signals with RTL_433 in flex decoder mode compared to manual decoding by the Pulseview tool, see https://groups.google.com/forum/#!topic/rtl_433/HxjH97Tkgys.
Attached is a zipped .cu8 file. Please look in the region from 540ms to 620ms for the four 7ms chunks. The second attachement is a screenshot from Pulseview with one data sequence decoded by the UART decoder 38.4k, 8N1 lsb first bitorder. In discussion with Karl Lohner the outcome was that there are some uncertainties regarding the start bit configuration in Pulseview and the capabilities of the built-in flex Decoder.
g001_868.91M_1024k.zip
The third attachement shows the decoding result for the Velux Controller in different operating modes like up, down and stop. by issuing the command two times to observe crc and rolling Code.
This is inline with a former work http://redd.it/cz8trb by z_rrr who sniffing the SPI between uC and RFIC in a Somfy remote which is also part of the io-homecontrol alliance.
I would like to ask for a new FSK_PCM Decoder, name it FSK_UART like Christian has suggested with the capability of specifing all needed decoding parameters, like Baudrate, protocol and start/stop bit configuration.
Don't hesitate to ask for more informations you need for implementation and testing.
Thank you,
Dietmar
The text was updated successfully, but these errors were encountered: