Any ESPHome libs to encrypt 433MHz signals?

I just got some super cheap 433MHz receivers and transmitters from China and I am trying them out. I’d like to be able to send wireless messages (I don’t know of what yet) but I don’t like the idea of them being easily snoop-able and repeatable to spoof my system.

Is there a way to encrypt the transmissions that ESPHome generates across two devices? I’m thinking of “rolling codes” that garage doors and car key fobs use but I don’t know exactly what that means in terms of implementation… plus it’d be nice if something like that existed already in the ESPHome kit.

1 Like

Encryption and 433 Mhz, it does not match. Rolling codes work, because sender and receiver have a common algorithm to determine the next expected code. Nothing more, nothing less.

Thanks @francisp, that’s what I’m talking about. Designing two ESPHome devices with the same encryption algorithm on both. One sends the 433MHz encoded transmission and the other receives it and decodes it based on the algo. I’m not sure why you’re saying that encryption and 433MHz don’t match… 433MHz is just a carrier frequency, right?

Anyone can sniff 433 MHz traffic and repeat it. It is insecure by design.

Hi! Are you sure that you doesn’t mix “encryption” and “encoding”? I know one library. that decodes a lot of standart swith codes formats. It’s https://github.com/sui77/rc-switch, I think that it’s rather possible to make rf433 -> mqtt gate using esp8266 or esp32, but it will not be esphome firmware. Also I’ve worked with cheap rf433 transmitters and recievers and stability it not enough. The best way is using usb rtl-sdr dongle with external anthenna, but signal quality will also depend on house size and wall matherials.

Also if you are looking for handling devices over rf433 like a relays, you can use for it such devices as Broadlink RM2 Pro, Orvibo Allone Pro RF hub and so on.

True, that’s why I’d want to encode my own traffic on 433MHz band.

Maybe I am. I just wanted to see if I could make something that could send an encoded transmission that could be decoded by a receiver and the encoding would be pre-defined on both ends so someone sniffing/capturing the message and trying to resend it wouldn’t get anywhere because the receiver and transmitter would be onto a different encoding seed. I’m pretty sure this is how rolling codes work when you train a remote to a car or garage door you’re effectively syncing the seed value and the equations are aligned so every new encoding value is synced up.

I do have an RTL-USB and I’ve been playing with it. I can see the 433MHz transmissions and they seem very simple but I like the idea of making it more robust using my own custom algorithms on top of the transmission… It should be possible but I’m guessing no one has done that with ESPHome. :frowning:

1 Like

I’m also interested in encryption for 433MHz transmissions. Did you ever figure something out?

I posted about some ideas here: Problems with WiFi range and connection speed for presence detection using ESP32 / ESP8622 boards

I had an idea for a protocol that might work to authenticate messages for presence detection:

The car ESP32 (C) would send an initial message with its unique ID. The garage ESP32 (G) would calculate a random nonce and store it in memory for this ID, and then transmit ID + nonce. C would compute the SHA256 hash of ID + nonce + 32 byte pre-shared key, and then transmit ID + hash. G receives the message and checks if it’s valid. If so, then it clears the nonce from memory, and then updates the HA sensor to “connected”. (Would also add a lot of error-correction and send everything multiple times so it’s very reliable.) Then it would keep repeating this once per second until the car is turned off. If it doesn’t receive any messages for a few seconds, then it updates the sensor to “disconnected.”

Not sure if there’s already a library for HMAC, sending / receiving nonces, etc.


UPDATE: The RadioHead library looks very good. Has support for encryption and sending messages reliably

nope, I moved on to other things and haven’t gotten back to it yet. I will some day and I’ll have to check out the RadioHead lib you shared. It seems promising based on what I read from your link. Thanks for the follow-up!

1 Like