DoorBird Binding?

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?

It’s interesting that the URL-encoding that @bern77 used worked for him, but not for you @TheNetStriker. Did you ever figure out why there was this discrepancy? I’m virtually certain that @bern77 didn’t mistype his origin wiki page.

@Knightshift, any chance you could try it the way @bern77 wrote the wiki, and see if it helps?

Hello watou,
thanks for your fast reply.

I tried the version of @bern77 and it didn’t work either. If I’m right, the only difference is using “%” instead of “%%” in the URL. Now switching back to my original version (as I posted above) it seems to work fine! I really don’t know why it didn’t work the first time.

Summarizing I can confirm that the changes @TheNetStriker made in the WIKI are correct.

1 Like

I didn’t really put the DoorBird configuration in openHAB to any particular use so far and didn’t notice that apparently with a change of the firmware the previous configuration no longer worked. Sorry the information in the Wiki page was wrong.

Also in my case I had to now change to the notation documented by @TheNetStriker in the Wiki page - now everything works fine again.

Anyway, DoorBird has updated the API a bit and I have updated the Wiki page accordingly.

With the new image request feature it’s actually possible to turn your DoorBird into a surveillance camera (i.e. you are not limited to 20 images because you can store them locally). Please see my rule example for details.

1 Like

My Doorbird works pretty good and I’ve tested it with OH and works good!

1 Like

After testing 2 hours I now found out that the code does not work for OH2 …
I used the code from the wiki but it does not work since OH2 dont use CMD anymore.

Is there any way to make doorbird work with OH2?
Im not familiar with the rest api yet

Thanks

I’ve not yet migrated to OH2 myself but plan to do so in the next weeks. Once I have a working configuration I’ll update the wiki accordingly.

The CMD servlet is part of the Classic UI. If you install Classic UI you should be able to use http://server:8080/classicui/CMD? …

This is still the simplest option I’m aware of if your device can only perform HTTP GET requests when you want to send a command to an item. However, if your device is able to use POST instead of GET, the REST API would be a superior path.