|

RF315/RF433MHz KeyFob or Wall Switch. ESPHome/HASS settings and RF communication Guide

RF315/433MHz module. Hardware connection instruction

ESP32R4 control has an inner socket for connecting an RF315/433MHz receiver or transmitter. The module itself is not included, you can purchase it on the website or from any other seller. The module connector is standard, and it will not be difficult to install it. This allows you to receive and transmit RF315/433MHz signals like those used by wireless wall switches, wireless keyfobs, TV remote controls, or many home security/alarm devices and sensors. In this guide, we will show, how to connect a wireless wall switch to an ESP32R4 controller and automate relay switching. First, need to sniff the RF-code from the switch. So that the controller can respond to its dedicated signal.

YAML
remote_receiver:
  pin: GPIO27
  dump: rc_switch
  # Settings to optimize recognition of RF devices
  tolerance: 50%
  filter: 50us
  idle: 4ms
  buffer_size: 2kb

Now we can start sniffing RF codes. Open ESPhome log console. Trigger an RF code for your device by pressing a button or activating your devices works and in the logs, you will get something like this:

[16:38:14][D][remote.rc_switch:261]: Received RCSwitch Raw: protocol=1 data= "011100100110101000001000"

There is the information we need to take note of, the “data” and the protocol. The data is the unique code that the sensor or device is transmitting, in binary form.

Repeat this process for each device you want to integrate with.

Using this information, we can add sensors to ESPHome.

Adding binary sensors to ESPHome

With the sniffed codes obtained above, we can add them as binary sensors to ESPHome, the following to your existing configuration.

In this example, we have 6 switches:

  • 4 switches dedicated to 4 relays
  • 1 switch do ON all relays
  • 1 switch do OFF all relays
YAML
  - platform: remote_receiver
    name: "Button ALL ON"
    device_class: motion
    rc_switch_raw:
      code: "000001000111010100000001"
      protocol: 1
    on_press:
      then:
        - switch.turn_on: relay1
        - switch.turn_on: relay2        
        - switch.turn_on: relay3        
        - switch.turn_on: relay4                

  - platform: remote_receiver
    name: "Button ALL OFF"
    device_class: motion
    rc_switch_raw:
      code: "000001000111010100000010"
      protocol: 1
    on_press:
      then:
        - switch.turn_off: relay1
        - switch.turn_off: relay2        
        - switch.turn_off: relay3        
        - switch.turn_off: relay4  

Documentation from ESPHome: Setting up RF device

Similar Posts