[OH4] Cheap RF 433MHz doorbell button

Foreword

These RF 433MHz door/window contact sensors have a push button on the front. This means they can easily be used as a cheap, efficient, slim, battery-powered, wireless doorbell button.

Prerequisites

This tutorial assumes:

  • openHAB 4 installed
  • MQTT Binding
  • Running MQTT broker, with Broker Thing configured in openHAB
  • MQTT Explorer available during setup
  • rtl_433 running, and
    • Publishing to the MQTT broker
    • The EV1527 conf file loaded

My rtl_433 startup line looks as follows - adjust URL and paths to suite:

rtl_433 -F mqtt://192.168.1.151:1883 -c ~/rtl_433/conf/EV1527-DDS-Sgooway.conf

Things

Adjust the reference to your MQTT Broker Thing to suite your installation.

mqtt.rtl433.doorbell.things

Thing mqtt:topic:doorbell "Doorbell" (mqtt:broker:MosquittoMqttBroker) {
	Channels:
		Type string : data "Data" [ 
			stateTopic="rtl_433/rtl433/devices/EV1527-DDS/data"
		]
}

Items

Basic example.

rtl433.doorbell.items

String strDoorbellData "Doorbell data" {channel="mqtt:topic:doorbell:data"}

Rules

The data that is sent by your button will be unique to your button (at least in your local area, hopefully!). To find out what data is sent, use MQTT Explorer. The image below shows the value of the data field being d7f429 after my button is pressed.

However, if you check the history for this field you will note that the device sends many frames in rapid succession (10+). As the button is pressed, the value of the data field is actually d7f4298 for all the frames except for the last one, as shown in the image below. As a result, a rule can be triggered on a change from the known penultimate value to the last value.

doorbell rule

In my rule, when the button is a pressed an Item called strSiren2Mode is commanded with the string DOOR_BELL (which then triggers another rule to make a noise on a Zigbee siren). Of course, change to suite your situation!

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: strDoorbellData
      previousState: d9ea898
      state: d9ea89
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: strSiren2Mode
      command: DOOR_BELL
    type: core.ItemCommandAction

Whilst you have MQTT Explorer open leave it running for a bit and see what else is broadcasting at 433MHz in your local area! Around me someone has a weatherstation, a motorised gate, a number of car tyres are broadcasting their pressure data (TPMS), and a few security systems are also broadcasting data over 433MHz!

2 Likes

A ‘better’ configuration is shared below, thought it depends on your point of view.

This configuration converts the incoming MQTT data into a Switch Thing, to which a Switch Item is linked, and the rule then triggers on the Switch Item. This way, all device-related configuration remains within the Thing definition, whereas previously the data code had to be specified in the Rule configuration.

This configuration requires the REGEX Transformation Service be installed.

Things

Adjust the reference to the MQTT Broker Thing so that it fits for your installation, and enter the data codes to suite.

I have it setup so that the repeated codes are ON, and the final code is OFF. This way, I can trigger the rule as soon as the switch turns ON, rather than wait for the final code.

Note that the REGEX Transformation Service is used as a filter, and it contains the shortest (last) code. This means that only data codes which contain d7f429 will be passed on to either on or off. This is a nice-to-have, otherwise your logs will fill with warnings as other local EV1527-based devices will also be caught by this Thing.

mqtt.rtl433.doorbell.things

Thing mqtt:topic:doorbell "Doorbell" (mqtt:broker:MosquittoMqttBroker) {
	Channels:
		Type switch : switch "Switch" [ 
			stateTopic="rtl_433/rtl433/devices/EV1527-DDS/data",
			transformationPattern="REGEX:(.*d7f429.*)",
			off="d7f429",
			on="d7f4298"
		]
}

Items

Basic example.

rtl433.doorbell.items

Switch swDoorbell "Doorbell" {channel="mqtt:topic:doorbell:switch"}

Rules

The trigger now means that the rule will run after the first frame is received, rather than the last. I’ve saved milliseconds…!

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: swDoorbell
      state: ON
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: strSiren2Mode
      command: DOOR_BELL
    type: core.ItemCommandAction