DoorBird Binding?

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.

Doorbird seems only to work with get commands.
I tried to use the solution http://server:8080/classicui/CMD mentioned by watou.
If i open the url in browser, i can change the state of the switch.

What I don’t really get is the registration part. From my understanding we create those registration switches to enter the openhab data url for the notification into the doorbird system. So when an action get triggert, the doorbird will open the entered openhab url and so the switch gets triggered.
The only difference from code in wiki is to add the classicui path?
so the url in items file reads:
http://xxxx:8080/classicui/CMD%%3FDoorBird_MotionSensor%%3DON&user=&password=&event=motionsensor&subscribe=1]

When I use the updated code from the wiki and than run http:///bha-api/notification.cgi

i get
{“BHA”: { “RETURNCODE”: “1”, “NOTIFICATIONS”: [{“event”: “motionsensor”,“subscribe”: “1”,“url”: “http://xxxxxx:8080/classicui/CMD„FDoorBird_MotionSensor„DON","user”: “”,“password”: “”,“relaxation”: “10”},

Should the URL be formatted like this? with „DON"? I also tried to enter the url
http://xxxxx:8080/classicui/CMD?DoorBird_MotionSensor=ON&user=&password=&event=motionsensor&subscribe=1
directly and at least it than get displayed correctly via notification.cgi as:
{“event”: “doorbell”,“subscribe”: “1”,“url”: “http://XXXXXX:8080/classicui/CMD?DoorBird_DoorBell=ON","user”: “”,“password”: “”,“relaxation”: “10”},

The URL http://XXXXXX:8080/classicui/CMD?DoorBird_DoorBell=ON works and triggers the button, but when I ring the bell or do motion detection, I dont get any response from the bell. (The Doorbird App reacts on my phone)
I think I just missing something fundamental here

Could anyone post how the url should look like, when notification.cgi returns it? Or how to update the url for OH2?

Also it would be great to capture multiple images when motion was detected, which should be possible via rules.
I’m quite new to openhab but i’m starting to love it :slight_smile:

Hi Sven,

the format %%DON is actually the URL encoded “=” (i.e. “%D”) escaped with the extra % sign plus the “ON” state passed to the OH item. The escape % seems to be required by the HTTP binding to not interpret this as a dynamic parameter (cf. https://github.com/openhab/openhab1-addons/wiki/Http-Binding).

In any case the second result with the proper URL should be OK.

I’ve played around a little with a docker image of OH2 but it seems to be a bigger task to migrate my current OH1 installation to OH2. In any case, I’v not yet succeeded to get DoorBird working.
I’m not really sure why; I can reproduce what you mentioned (i.e. manual registration and manual change of the item which should be triggered with the callback) but also failed in getting the HTTP binding to do anything.
I might have overlooked something in the port forwarding since my DoorBird is sitting in a DMZ, but is does work in OH1…

If I find out something I’ll share it with you.

I entered the registration URL directly into the webbrowser to give Doorbird the correct url.

If you open the notification.cgi
it should read:
{“BHA”: { “RETURNCODE”: “1”, “NOTIFICATIONS”: [{“event”: “motionsensor”,“subscribe”: “1”,“url”: “http://openhab:8080/classicui/CMD?DoorBird_MotionSensor=ON","user”: “”,“password”: “”,“relaxation”: “10”},

and now I get the response to OH when something has moved or bell was ringed.
It seems as you can´t create to many connections at the same time, when I connect to livestream via phone, I often don´t a response. Or when OH has been connected, I cant connect via phone app to Doorbird.

I have not investigate this further

Would it be possible to stream video.cgi directy into an mp4 containter or do I need to capture jpgs and convert them via ffmpeg afterwards?

The Idea is, that I get short videos instead of just pictures when someone rings.

On the website of Doorbird, they also mention to have HD Support cloud recording but why is the LAN signal so low in quality?

Finally I’ve migrated to OH2. There are still some issues when starting the server and the BasicUI isn’t behaving ideally but my house is running on OH2 now since a day and seems to work mostly fine.

So I could also tackle the DoorBird issue which is still open and have to say I didn’t get it to work with the HTTP binding. Maybe my patience was running thin but the behaviour is not making sense to me.

But, fortunately the rules still work fine, so I’ve just rid the item declarations of the binding and added some rules:

val String DOORBIRD_EVENT_MOTIONSENSOR = 'motionsensor'
val String DOORBIRD_EVENT_DOORBELL = 'doorbell'
val String DOORBIRD_EVENT_DOOROPEN = 'dooropen'

val Functions$Function3 handleDoorBirdRegistration = [
	String itemName,
	boolean on,
	String event |
		var String url = 'http://XXX:XXX@XXX.XXX.XXX.XXX/bha-api/notification.cgi?'
		
		url = url + 'url=http://XXX.XXX.XXX.XXX:XXX/classicui/CMD'
		url = url + '%3F' + itemName + '%3D'
		if (on) {
			url = url + 'ON'
		} else {
			url = url + 'OFF'
		}
		
		url = url + '&event=' + event
		
		url = url + '&subscribe='
		if (on) {
			url = url + '1'
		} else {
			url = url + '0'
		}
		
		sendHttpGetRequest(url)
]

rule "DoorBird Registrierung - Bewegungsmelder"
	when
		Item DoorBird_MotionSensor_Register received command
	then
		handleDoorBirdRegistration.apply('DoorBird_MotionSensor', DoorBird_MotionSensor_Register.state == ON, DOORBIRD_EVENT_MOTIONSENSOR)
end

rule "DoorBird Registrierung - Klingel"
	when
		Item DoorBird_DoorBell_Register received command
	then
		handleDoorBirdRegistration.apply('DoorBird_DoorBell', DoorBird_DoorBell_Register.state == ON, DOORBIRD_EVENT_DOORBELL)
end

rule "DoorBird Registrierung - Türöffner"
	when
		Item DoorBird_DoorOpen_Register received command
	then
		handleDoorBirdRegistration.apply('DoorBird_DoorOpen', DoorBird_DoorOpen_Register.state == ON, DOORBIRD_EVENT_DOOROPEN)
end

This works like a charm for me… Hope this helps.

1 Like

That’s definately a big step ahead of all the other competitors. I have ring, which works OK as is, but doesn’t offer any API and I have no way of integrating it in openHAB. If I only did found out about DoorBird earlier! :wink:
also the “openDoor twowire”-solution sounds great for me - so you could just open the door via the App or even in the openHAB-frontend.
http://www.doorbird.com/comparison

Hello @bern77,

I also migrated to OH2 and tried to adapt your rule to my setup. So I replaced
http://XXX:XXX@XXX.XXX.XXX.XXX/bha-api/notification.cgi? with my DoorBird URL and
http://XXX.XXX.XXX.XXX:XXX/classicui/CMD with my openHAB ip and port but it doesn’t work.

I must confess, that I don’t understand what happens in this rule. Any help would be appreciated…

This are the items I use without any binding configuration.
Switch DoorBird_MotionSensor_Register
Switch DoorBird_DoorBell_Register
Switch DoorBird_MotionSensor
Switch DoorBird_DoorBell

Thx in advandce

Good morning @Knightshift,

in the rules I’m using a simple function to avoid multiplying the code for creating the URL to register/deregister the different events with DoorBird (cf. http://www.doorbird.com/downloads/api_lan.pdf?rev=0.16). So I’m using my DoorBird’s basic URL (please ensure you also use your DoorBird username and password: e.g. http://myuser:mypassword@192.168.XXX.XXX) and add the parameters for the callback URL (i.e. the CMD servlet with the item and the state), the event to register/deregister) and the subscription state.

My guess where to look in order to make this work would be the authentication part in the DoorBird URL and ensuring that Classic UI is installed.

Hope that helps!

Best regards,
Bernhard

Good morning @bern77,

I don’t know what happened over night, but now it seems to work (although I didn’t change anything) O.o.

What I observe now is that the status of the items “DoorBird_MotionSensor” and “DoorBird_DoorBell” don’t reset to OFF automatically after receiving the ON command. Shouldn’t they go back to OFF after the given “relaxation” value?

Thx

Hi @Knightshift,

you are right - it would be more consistent if the switch items would return to state OFF. But I don’t think that DoorBird will do that for you since it will only call the callback URL once in case of an event with the ON command. So you would have to reset the switch item in a rule.
However, it also depends on what you want to do with the DoorBird event - if you have a rule triggered by received command ON then it shouldn’t make a difference.

Best regards,
Bernhard

The Doorbird looks very nice but a bit expensive for me. So I may order a KDOOR-6 WiFi Camera Video Door Bell.

It runs on the following protocols:

PPPOE,HTTP,SMTP,FTP,DHCP,TCP,IP,ICMP

Maybe it could be used with the HTTP binding as it is an IP camera?

It has POE which is a big plus too :slight_smile:

Doorbird D202 is the best smart doorbell on the market. While most buyers talk about Ring vs Skybell comparison, they do forget about Doorbird.

It might be pricier but it’s definitely worth it. Skybell and Ring also support OpenHAB integration but I still prefer the Doorbird D202. It looks better, works better and seems to be more reliable and secure.