schmurtzm / RFLink32-For-Sonoff-RF-Bridge

RFLink32 For Sonoff RF Bridge
Other
76 stars 23 forks source link

RFLink32 for Sonoff RF Bridge

This is a customized version of RFlink32 for Sonoff RF Bridge. This powerful firmware supports to transmit decrypted RF frames with following protocols :

It is entierely based on RFlink32, I have only configured the firmware to work out of the box with the Sonoff RF bridge and removed functionnalities to be able to run it on the ESP8285 of the Sonoff (only 1MB of memory). Removed functionnalities are : OTA, Online update, possibility to configure other RF receivers. The Original RFlink32 UI has been modified to remove these unvaible settings. Here the modified UI repo.

How to install :

Hardware mod : "Direct Hack"

This firmware require a hardware hack called "direct hack" to work correctly. The idea is to bypass the chip which decrypt signal on the sonoff and connect directly the RF chip to the ESP8285.

Here the tutorial for the 2021 Sonoff RF Bridge (R2 v2.2). Credits mateine from Home Assistant Forum who give the solder points for the R2 V2.2 of the Sonoff RF Bridge.

(For older boards (R1 V1.0 and BOARD R1 V2.0) I recommend this excellent documentation from ESPurna / Tinkerman !)

At the front, cut the trace between the RF receiver and the en/decoder chip.

Connect the receiver : USBRXD → pin 5 of the 8 legged chip near the LEDs (near the buzzer in the image)

Connect the transmitter : USBTXD → pin 4 of the 6-legged chip (bottom right pin in the image)

(As Tinkerman from espurna said : " resistor : anything in the range 180-680 ohms, 1/4 or 1/8 W will do. The advantage of using a resistor is that if you inadvertently solder the wrong pins, the resistor will prevent any damage to the semiconductors.")

At the back, we cut these 3 traces : Exactly as in the original mod for older versions, the 2 traces (at bottom of the image) connect USB data with GPIOs, we’ll use to connect the receiver and transmitter directly to the ESP8285. If left connected, usb chargers may bridge them and nothing will work (or worse). The last cut is (at the top) to isolate the en/decoder chip from the RF emitter.

Flash :

To put in flashing mode, press the ‘pairing button’ while inserting the FTDI in USB.
Then run the script tools\Flash_Sonoff_RF.bat . It will :

  • ask you to disconnect and reconnect the sonoff in "flashing mode" for eatch step
  • make a backup of the original firmware of your sonoff
  • full erase of the esp8266
  • flash the RFlink32 firmware

Then go on your mobile phone and find the wifi access point called "RFLink-AP", connect to it and naviguate to adress : http://192.168.4.1 then you will be able to configure your own Wifi.
Alternatively you can configure the wifi by sending a command on serial port (with a software like termite) :
10;config;set;{"wifi":{"client_enabled":true,"client_dhcp_enabled":true,"client_ssid":"MySSID","client_password":"MyPassword"}}
The new IP adress will be displayed on serial monitoring. You can compile this code with platformio or you can download a compiled firmware and use the script on Windows) :

Configure :

Once your own wifi activated, you can now disable the Access point (AP). You can also :

  • activate MQTT
  • activate Ser2net
  • configure some Signals settings

If you are familiar with ESPhome Flasher, Tasmotizer or NodeMCU PYFlasher, you can use it too but I would recommand to make a complete erase of your ESP8285 before.

Some informations about this firmware :

Why I would prefer this firmware compared to ESPHome, Tasmota or ESPurna ?

====================================================

API :

/api/status : display the current status of the gateway (uptime, wifi state, MQTT state, ser2net state, number of RF message received…)

/api/config : allow to configure your device, for exemple you can run this POST command : http://192.168.0.xxx/api/config {"wifi":{"client_enabled":true,"client_dhcp_enabled":true,"client_ssid":"MySSID","client_password":"MyPassword","client_ip":"192.168.0.200","client_mask":"255.255.255.0","client_gateway":"192.168.0.1","client_dns":"192.168.0.1","client_hostname":"RFLink32","ap_enabled":false,"ap_ssid":"RFLink-AP","ap_password":"","ap_ip":"192.168.4.1","ap_network":"192.168.4.0","ap_mask":"255.255.255.0"},"mqtt":{"enabled":true,"server":"192.168.0.250","port":1883,"id":"ESP8266-RFLink_xxx","user":"xxx","password":"xxx","topic_in":"/ESP00/cmd","topic_out":"/ESP00/msg","lwt_enabled":true,"topic_lwt":"/ESP00/lwt","ssl_enabled":false,"ssl_insecure":true,"ca_cert":""},"portal":{"enabled":true}}

API over serial (if you still have your usb FTDI connected to the Sonoff Rfbrige), example :
10;config;set;{"wifi":{"client_enabled":true,"client_dhcp_enabled":true,"client_ssid":"MySSID","client_password":"MyPassword"}}
10;REBOOT;
10;rfdebug=<on|off>
10;reboot;
10;config;dump;
10;config;reset;

Full API Documentation Here

Know issues :

Original RFlink32 Documentation


Special Thanks to Couin3, Erau and many others for their awesome work on RFlink version which works on arduino, ESP8266 and ESP32 !

Come to talk with us about RFlink-ESP and RFlink32 on discord !