Skip to content

Integrating an RF Doorbell into Home Assistant using ESP8266, Tasmota, and MQTT

This guide will help you integrate an RF doorbell into Home Assistant using an ESP8266 with Tasmota and an RF receiver.

Requirements

  • ESP8266 flashed with Tasmota-Sensors firmware
  • RF receiver module
  • MQTT broker (Mosquitto) set up in Home Assistant: MQTT integration

Hardware Setup

  1. Connect the RF receiver to the ESP8266:
  2. Data PinD2 (GPIO4)
  3. Power (VCC)3.3V
  4. Ground (GND)GND
  5. Power on the ESP8266 and verify that it boots correctly by checking the serial monitor or accessing the Tasmota web UI.

Configure Tasmota

Step 1: Set Up Tasmota Module

  1. Open the Tasmota web UI.
  2. Go to Configuration → Configure Module.
  3. Set Module Type to Sonoff RF (2).
  4. Set GPIO4 to RFrecv.
  5. Save and restart.
  6. After rebooting, check the Console to confirm that the RF receiver initializes correctly by monitoring any messages.

Test: Open the console and press the doorbell. If the RF receiver is working, you should see log messages showing RF signal detection.

Step 2: Configure MQTT

  1. Go to Configuration → Configure MQTT.
  2. Set up MQTT parameters (Broker, Username, Password, Topic Prefixes) to match your Home Assistant setup.
  3. Save and restart.
  4. Open the Console and enter Status 10 to confirm MQTT connection. Look for a response confirming that MQTT is connected.

Test: Use an MQTT client (like MQTT Explorer) to subscribe to your device’s topic and check if it’s publishing messages.

Capture RF Signal

  1. Open the Tasmota Console.
  2. Press the doorbell button and check the console output.
  3. Verify that the RF receiver detects a signal and displays an RfReceived Data value.
  4. Example output:
    17:48:32.556 MQT: tele/tasmota/RESULT = {"Time":"2025-03-24T17:48:32","RfReceived":{"Data":"0x000000000035F6E2","Bits":24,"Protocol":1,"Pulse":285}}
    
  5. If no signal is detected, double-check the wiring of the RF receiver and try pressing the doorbell again.
  6. Use the Data value (e.g., 0x000000000035F6E2) in the next step.

Test: Repeat pressing the doorbell and verify that the RfReceived Data value is consistent every time.

Set Up Tasmota Rule

This rule will setup two actions:

On System Boot
- ON system#boot DO Publish homeassistant/event/tasmota/config {...} ENDON
- When the Tasmota device starts, it publishes a configuration message to Home Assistant over MQTT.
- The payload tells Home Assistant that this device is a doorbell sensor with the ability to detect pressed events.
- It also defines the MQTT topic (home/doorbell/state) where doorbell events will be published.

On RF Signal Received
- ON RfReceived#Data=0x000000000035F6E2 DO Publish home/doorbell/state {"event_type":"pressed"} ENDON
- If the Tasmota device (likely an RF bridge) detects an RF signal with the code 0x000000000035F6E2, it publishes an MQTT message to home/doorbell/state.
- The payload {"event_type":"pressed"} tells Home Assistant that the doorbell button was pressed.

Set it up:

  1. Go to Console and enter the following rule:
    Rule1
    ON system#boot DO Publish homeassistant/event/tasmota/config {"name":"Doorbell","device_class":"doorbell","event_types":["pressed"], "unique_id": "mqtt_doorbell", "state_topic": "home/doorbell/state"} ENDON
    ON RfReceived#Data=0x000000000035F6E2 DO Publish home/doorbell/state {"event_type":"pressed"} ENDON
    
  2. Replace 0x000000000035F6E2 with your own RfReceived Data value.
  3. Enable the rule:
    Rule1 1
    
  4. Restart the ESP8266.
  5. Test the rule by pressing the doorbell and monitoring the Tasmota Console for the expected MQTT messages.

Test: Each time the doorbell is pressed, check that the DOORBELL topic changes to "ON" and then "OFF" after 30 seconds.

Verify in Home Assistant

  1. Open Home Assistant and navigate to Developer Tools → States.
  2. Check if a new event entity "Doorbell" appears in Home Assistant.
  3. Press the doorbell and verify that an event with type doorbell_press is triggered.
  4. If the event does not trigger, check the MQTT settings and ensure the rule is correctly configured.

Test: Use the MQTT integration in Home Assistant to subscribe to stat/tasmota/DOORBELL and check if the expected messages are received.

Automate in Home Assistant

  1. Create an automation to trigger actions when the doorbell is pressed:
    alias: Doorbell Notification
    trigger:
      platform: event
      event_type: doorbell_pressed
    action:
      service: notify.mobile_app_your_device
      data:
        message: "Someone rang the doorbell!"
    
  2. Save and reload automations.
  3. Test the automation by pressing the doorbell and confirming the notification is received.

Enjoy Your RF Doorbell Integration!

Your RF doorbell is now fully integrated with Home Assistant. You can set up additional automations such as playing a chime, turning on lights, or triggering a camera recording when the doorbell is pressed.

Final Test: Restart all devices (ESP8266, MQTT broker, Home Assistant) to ensure the integration works consistently after reboots.