DoorBird Binding?

I’m using a DoorBird for door communication (www.doorbird.com).
Apparently there is an API which is currently only provided to organisations (http://www.doorbird.com/de/api).
Are there any plans to register openHAB UG with DoorBird?

Hi, the guys from Doorbird have published an API, see www.doorbird.com/api

Hi folks,

someone already tested DoorBird with OH?

Please share your experience.

Thanks

Andrea

I also bought one of this for my new house.
So, I’m also very interested in an binding for OH2.

Kind regards

I’ve now taken a closer look at the API spec - it seems to me all of this can be integrated either directly in a sitemap or via HTTP binding. I’ll play around with this and share if it get it to work.

Most of the (limited) possibilities the API supports can be used based on openHAB standard functionality:

Live Video
Integration directly in sitemap:

Video url="http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/video.cgi" encoding="mjpeg"

Open Door
Item definition using HTTP binding:

Switch DoorBird_DoorOpener "DoorBird Door Opener" (DoorBird)  { http=">[ON:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/open-door.cgi]"

Light On
Item definition using HTTP binding:

Switch DoorBird_DoorOpener "DoorBird Door Opener" (DoorBird)  { http=">[ON:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/light-on.cgi]"

History Images
Integration directly in sitemap (20x):

Image url="http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/history.cgi?index=1

Notifications
The outbound part is rather straightforward and can be implemented with an item definition using HTTP binding:

Switch DoorBird_MotionSensor_Register "DoorBird - Register Motion Sensor" (DoorBird) { http=">[ON:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/notification.cgi?url=http://<openhab-ip>:<openhab-port>/doorbird-callback/motion-sensor&user=<openhab-user>&password=<openhab-password>&event=motionsensor&subscribe=1] >[OFF:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/notification.cgi?url=http://<openhab-ip>:<openhab-port>/doorbird-callback/motion-sensor&user=<openhab-user>&password=<openhab-password>&event=motionsensor&subscribe=0]" }
Switch DoorBird_DoorBell_Register "DoorBird - Register Door Bell" (DoorBird) { http=">[ON:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/notification.cgi?url=http://<openhab-ip>:<openhab-port>/doorbird-callback/door-bell&user=<openhab-user>&password=<openhab-password>&event=doorbell&subscribe=1] >[OFF:GET:http://<doorbird-user>:<doorbird-password>@<doorbird-ip>/bha-api/notification.cgi?url=http://<openhab-ip>:<openhab-port>/doorbird-callback/door-bell&user=<openhab-user>&password=<openhab-password>&event=doorbell&subscribe=0]" }

However, as DoorBird can only send a GET request to a web ressource you have to provide in the registration, I didn’t find a way to utilise openHAB’s REST API directly. So I have implemented a simple “gateway” based on a servlet that accepts the GET request from the DoorBird and notifies the corresponding item in openHAB via REST.
The implementation and according documentation can be found here: https://github.com/bern77/DoorBird-Callback

This then also requires additional items to receive the notifications:

Switch DoorBird_MotionSensor "DoorBird Motion Sensor Triggered" (DoorBird)
Switch DoorBird_DoorBell "DoorBird Door Bell Triggered" (DoorBird)
4 Likes

This is great information, Bernhard! Would you consider adding a document to the openHAB wiki so this useful information is easier to find?

Thank you for sharing this elegant solution!

Instead of the servlet, could you register callback URLs to the existing openHAB CMD servlet, like

http://<openhab-ip>:<openhab-port>/CMD?DoorBird_MotionSensor=ON

It accepts GET requests and sends the named item the named command. I use this with some older Foscam cameras to trigger motion and it works great in that setting.

Thanks for the suggestion - I’ve added a page and a link in the sidebar (section Application Integration). I hope that’s the right place…

That sounds like a more elegant approach. Did you test that already?
I think as the servlet calls require URL parameters the ? and = might need to be URL encoded for the registration request to work and then I’m not sure if DoorBird will correctly decode for the callback.
I can test this tomorrow (my house is still in construction and I’m no longer on site…)

It works with my cameras, so as long as you can supply the correct URL to the DoorBird and the DoorBird sends a proper HTTP GET, it should work.

You are quite right that the callback URL should be URL-encoded. For my Foscam, I have something like this:

http%3A%2F%2F<openhab-ip>%3A<openhab-port>%2FCMD%3FDoorBird_MotionSensor%3DON

I can confirm it works. I’ve only URL encoded the ? and = and this works nicely.
Thanks again for the input! I wasn’t aware of the CMD servlet…

Thank you very much for putting up the wiki page (I think it’s in the right place in the sidebar), and I’m glad the CMD servlet simplifies things a bit.

I have a question about the URLs for registering the callback URLs. I don’t know if it’s right or wrong, but your wiki page lists the <openhab-user> and <openhab-password> as user= and password= params to DoorBird, which seems strange that DoorBird would want those values:

Switch ... :http://...<doorbird-ip>/bha-api/notification.cgi? ... &user=<openhab-user>&password=<openhab-password>...http://...<doorbird-ip>/bha-api/notification.cgi? ... &user=<openhab-user>&password=<openhab-password>...
Switch  ... http://...<doorbird-ip>/bha-api/notification.cgi? ... &user=<openhab-user>&password=<openhab-password>...http://...<doorbird-ip>/bha-api/notification.cgi? ... &user=<openhab-user>&password=<openhab-password>...

Thanks again for sharing!

That is based on the DoorBird API spec (cf. http://doorbird.com/downloads/api_lan.pdf?5, p.6).

Thanks for the reference. The doc says “Basic authentication user for the HTTP URL, leave blank if not mandatory”, and in the case where the openHAB server is not configured to require basic authentication, does passing user= and password= still work? And what would the user pass in when no openHAB user is defined?

You might consider adding a note to your wiki page that instructs to only add user= and password= parts to the notification.cgi URLs when the openHAB CMD servlet requires basic authentication.

Thank you, Bernhard.

Yes, providing a user and password while openHAB doesn’t require authentication works nicely.

Sorry, I’m not sure I understand the question?

I’ve added a note that it’s not mandatory.

1 Like

I don’t use authentication on my local openHAB instance, so I don’t use <openhab-user> or <openhab-password>. So, for other DoorBird owners who also don’t authenticate to their local openHAB server, that part of the wiki would have been confusing and unnecessary. I hope to buy a DoorBird this year, and your how-to will be valuable. Thanks!

I’ve also tried to implement my doorbird in OpenHAB. It works good so far, except the CMD? registration url’s are not called by my OpenHAB server. I found out that this has to be some problem with the url encoded values. As soon as I remove all percent chars from the url, OpenHAB tries to call the url. With the percent chars simply nothing happens. (no log, nothing is called) I will try to debug using the test project of the http binding.

I found a solution for the problem.

The % chars have to be replaced with double %% chars because else the string format fails. I’ve updated the wiki page.

1 Like

Hello, I have problems getting the motion sensor an the door bell to work with openhab.

I created the 4 items as described above/in the WIKI but it just doesn’t work.
Here are my items:


Switch DoorBird_MotionSensor_Register "DoorBird - Register Motion Sensor" (doorbird) { http=">[ON:GET:http://DBuser:DBpassword@192.168.178.XX/bha-api/notification.cgi?url=http://192.168.178.YY:8080/CMD%%3FDoorBird_MotionSensor%%3DON&user=&password=&event=motionsensor&subscribe=1] >[OFF:GET:http://DBuser:DBpassword@192.168.178.XX/bha-api/notification.cgi?url=http://192.168.178.YY:8080/CMD%%3FDoorBird_MotionSensor%%3DON&user=&password=&event=motionsensor&subscribe=0]" }

Switch DoorBird_DoorBell_Register "DoorBird - Register Door Bell" (doorbird) { http=">[ON:GET:http://DBuser:DBpassword@192.168.178.XX/bha-api/notification.cgi?url=http://192.168.178.YY:8080/CMD%%3FDoorBird_DoorBell%%3DON&user=&password=&event=doorbell&subscribe=1] >[OFF:GET:http://DBuser:DBpassword@192.168.178.XX/bha-api/notification.cgi?url=http://192.168.178.YY:8080/CMD%%3FDoorBird_DoorBell%%3DON&user=&password=&event=doorbell&subscribe=0]" }

Switch DoorBird_MotionSensor "DoorBird Motion Sensor Triggered" (doorbird)

Switch DoorBird_DoorBell "DoorBird Door Bell Triggered" (doorbird)


where “DBuser” and “DBpassword” is username and password for dooorbird, “XX” is the ip of doorbird and “YY” is the ip of openhab. Since I don’t use authentication in openhab, I don’t provide a user or password.

Any ideas what I do wrong?