Table of Contents

Rf Control

Flash and use the Sonoff RF Bridge R2 V1.0 to control RF devices

Setup

Using a serial-to-USB converter (FT232RL FTDI USB to TTL) and some dupont wires flash the R2 V1.0 RF bridge ESP with Tasmota, flash the RF chip with the custom Portisch firmware, then reflash the ESP with ESPHome.

Downloads

Prepare the RF Bridge

Flash ESP

Configure Tasmota

Flash RF firmware

Create and upload ESPHome firmware

Learn Codes

Update

Sources

Notes

ESPHome firmware definition to allow discovery of new RF codes:

substitutions:
  devicename: sonoff_rf_bridge
  upper_devicename: Sonoff RF Bridge
  device_platform: ESP8266
  device_board: esp01_1m
  device_ip: 10.0.0.108
 
# Enable Web Server (optional)
# web_server:
#   port: 80

<<: !include common/base.yaml

logger:
  baud_rate: 0

uart:
  tx_pin: 1
  rx_pin: 3
  baud_rate: 19200

api:
  services:
    - service: send_rf_code
      variables:
        sync: int
        low: int
        high: int
        code: int
      then:
        - rf_bridge.send_code:
            sync: !lambda 'return sync;'
            low: !lambda 'return low;'
            high: !lambda 'return high;'
            code: !lambda 'return code;'
    - service: learn
      then:
        - rf_bridge.learn
    - service: send_advanced_rf_code
      variables:
        length: int
        protocol: int
        code: string
      then:
        - rf_bridge.send_advanced_code:
            length: !lambda 'return length;'
            protocol: !lambda 'return protocol;'
            code: !lambda 'return code;'
    - service: start_advanced_sniffing
      then:
        - rf_bridge.start_advanced_sniffing
    - service: stop_advanced_sniffing
      then:
        - rf_bridge.stop_advanced_sniffing

rf_bridge:
  on_code_received:
    then:
      - homeassistant.event:
          event: esphome.rf_code_received
          data:
            sync: !lambda 'char buffer [10];return itoa(data.sync,buffer,16);'
            low: !lambda 'char buffer [10];return itoa(data.low,buffer,16);'
            high: !lambda 'char buffer [10];return itoa(data.high,buffer,16);'
            code: !lambda 'char buffer [10];return itoa(data.code,buffer,16);'

  on_advanced_code_received:
    then:
      - homeassistant.event:
          event: esphome.rf_advanced_code_received
          data:
            length: !lambda 'char buffer [10];return itoa(data.length,buffer,16);'
            protocol: !lambda 'char buffer [10];return itoa(data.protocol,buffer,16);'
            code: !lambda 'return data.code;'
 
# Turn the Wifi led on for 2 seconds when the button is pressed to show that it's working
output:
  - platform: gpio
    pin:
      number: GPIO13
      inverted: True
    id: output_wifi_led
light:
  - platform: binary
    id: wifi_led
    output: output_wifi_led
binary_sensor:
  - platform: gpio
    pin: GPIO00
    id: pairing_button
    on_press:
      then:
        - light.turn_on: wifi_led
        - delay: 2s
        - light.turn_off: wifi_led