SOLUTION: Link Doorbird app relay button to OpenHAB

Tags: #<Tag:0x00007f61705b4798> #<Tag:0x00007f61705b46a8>

I have owned a Doorbird video doorbell for a while, and have been very happy with it!

One thing that bothered me, however, was that I could not [figure out how to] use the ‘Unlock’ button in the Doorbird app to unlock my ZWave door lock - I finally got it working, with a lot of help from this thread and thought I would post the solution - it’s actually remarkably simple!

The Doorbird binding uses the UDP packets sent by Doorbird, and since these don’t contain the relay state, the binding cannot trigger an event based on the relay button press in the Doorbird app. In fact, you don’t need to have the Doorbird binding installed to get the ‘Unlock’ button to trigger an action in OpenHAB, but it’s a great binding for other tasks, so you should go ahead and install it anyway!

In order to get OpenHAB to react to the unlock button press in the app, we will set up Doorbird to send an HTTPS GET request when the relay is triggered. The full setup can be done with CURL from a PC in the same network as Doorbird, but Doorbird now offer a web admin page (in Beta, but works fine for this), which is far easier. If your Doorbird does not have access to the internet in general, you can still achieve the same thing using CURL, configuring the requests as per the Doorbird API. Regrettably, the Doorbird cannot do POST requests, only GET, so we have to use a non-official method of manipulating item states, which makes a GET request to a special ‘link’ in the UI.

Pre-requisites:

  • A functional Doorbird installation, with the app set up on at least one phone / device
  • Functional OpenHAB install with either Classic UI or Basic UI installed
  • Basic familiarity with .items and .rules files

Steps:

  1. Add an item that will be updated when the Doorbird relay is triggered. Let’s call it “Doorbird Relay Callback”. You can add it to an existing .items file or create a new one.
Switch Doorbird_Relay_Callback "Doorbird Relay Callback"
  1. Add a rule to do whatever it is that you want when this item is set to a given state. For me, I want to unlock (turn OFF) a ZWave lock, so my rule looks like the below:
rule "Doorbird door relay"
when
	Item Doorbird_Relay_Callback received update
then
	if (Doorbird_Relay_Callback.state == ON) {
		logInfo("Doorbird", "Relay triggered from DoorBird app") //log to show where the call came from
		zwave_lock_door.sendCommand(OFF) //Unlock the zwave lock - change to what you need to do instead
		Doorbird_Relay_Callback.postUpdate(OFF) //sets the callback to OFF again once run
	}
end

NB: You’ll see that you COULD have Doorbird update whichever item you want to manipulate directly. For transparency and troubleshooting purposes (as well as to make it easier to change in the future), I suggest this approach, where Doorbird manipulates a ‘dummy’ item, and a rule updates the real item based on that.

  1. Head to https://webadmin.doorbird.com/login, and log in, using the administrator details that you received in your Doorbird box (or get them from your app).
    Click on ‘Favourites’ > ‘HTTP(S) Calls’. Click on ‘Add’. Name the call whatever you like, I went with ‘OpenHAB Relay’. The URL should be as below, using your values (NB: can be an HTTP call, in which case you’d use port 8080, but I’m assuming you’ll use HTTPS since Doorbird supports it). Click save.
https://[your_openHAB_ip]:8443/basicui/CMD?/Doorbird_Relay_Callback=ON

NB: If you are using the Classic UI (only), then swap ‘basicui’ for ‘classicui’ above.

  1. Click on ‘Expert Settings’ > ‘Relays’ > ‘Schedule for follow up actions’. Select the favourite you just made, and then click the box near the top right of the window to make it active at all times (or alternatively, enable it only at certain times, if you prefer). Click save.

  2. Try it out! Open a log viewer (http://[your_openHAB_ip]:9001), and pull up the Doorbird app on your phone. Press the unlock button, and you should see log entries showing your dummy item is updated, and that your rule has fired! Your door (or whatever) should now be unlocked! You could also do something like turn on the porch / vestibule / hallway lights in the rule if you like. If it’s all working, you can logout from the Doorbird webadmin page.

That’s it! I hope this is helpful for someone - I really like the Doorbird, and knowing about the webadmin site and how to manipulate OpenHAB from Doorbird only makes it better!

1 Like

I do the same but I use the RFID bound to each person so when they use their tag it turns on the lights and unlocks the Zwave front door. It also then plays a greeting using Alexa based on the tag :slight_smile: