Doorbird video doorbell binding

Hi there,
I would like to cancel the doorbird sip call when the frontdoor is open (fibaro door sensor). so would it be possible to rekognize if a sip call is running before sending a sip hangup?

thx!

oliver

Thereā€™s a SIP status call in the API spec. Can you post the JSON returned in the following two situations:

  • thereā€™s no SIP call in progress
  • a SIP call is in progress

From the API specā€¦

sip-status

Assuming this indicates a call is in progress, I can implement a thing action to check if a call is in progress. It likely would be called isSipCallInProgress() and would return a boolean.

no call in progress:

{"BHA": { "RETURNCODE": "1", "SIP": [{"ENABLE": "1","PRIORITIZE_APP": "1","REGISTER_URL": "192.168.178.1","REGISTER_USER": "xxx","REGISTER_PASSWORD": "xxx","AUTOCALL_MOTIONSENSOR_URL": "","AUTOCALL_DOORBELL_URL": "","SPK_VOLUME": "70","MIC_VOLUME": "33","DTMF": "1","relais:1": "0","relais:2": "","LIGHT_PASSCODE": "","INCOMING_CALL_ENABLE": "0","INCOMING_CALL_USER": "","ANC": "1","LASTERRORCODE": "200","LASTERRORTEXT": "OK","RING_TIME_LIMIT": "60","CALL_TIME_LIMIT": "180"}]}}

call in progress:

{"BHA": { "RETURNCODE": "1", "SIP": [{"ENABLE": "1","PRIORITIZE_APP": "1","REGISTER_URL": "192.168.178.1","REGISTER_USER": "xxx","REGISTER_PASSWORD": "xxx","AUTOCALL_MOTIONSENSOR_URL": "","AUTOCALL_DOORBELL_URL": "","SPK_VOLUME": "70","MIC_VOLUME": "33","DTMF": "1","relais:1": "0","relais:2": "","LIGHT_PASSCODE": "","INCOMING_CALL_ENABLE": "0","INCOMING_CALL_USER": "","ANC": "1","LASTERRORCODE": "183","LASTERRORTEXT": "Session Progress","RING_TIME_LIMIT": "60","CALL_TIME_LIMIT": "180"}]}}

Thanks.

This is the only difference I see. Iā€™m not sure how to interpret this w.r.t. call or no call.

No Call

"LASTERRORCODE": "200","LASTERRORTEXT": "OK"

Call

"LASTERRORCODE": "183","LASTERRORTEXT": "Session Progress"```

I just had a look to the sip response codes: seems ā€œ183, session in progressā€ means ringing.
During my test I saw that a connected call is shown as ā€œ200, OKā€ followed by ā€œ200, Normal call clearingā€, when the call gets disconnected.
So, I think you can use ā€œLASTERRORCODEā€ : ā€œ183ā€ to consider a call is in progress. Ideally a connected call will not be interrupted, because the ā€œLASTERRORCODEā€ changes to ā€œ200ā€ after a successful connection.

Would it be possible to call method isSipCallInProgress() in the rules?

Thank you for your help!

Oliver

My idea was that I donā€™t want to have a api call to the doorbird every time the door was opened. If I understand your planned method isSipCallInProgress() right, there would also be an api call every time. So in a nutshell it doesenā€™t matter if I send isSipCallInProgress() or sipHangup().
Would it be possible to set a switch to on if the doorbell was pressed and set it back to off if the ā€œRING_TIME_LIMITā€ from the above json was reached?

@mhilbush what do you think?

Thank you!

When using the rawbutton-switch-on-off profile on the doorbell channelā€™s item definition, the current functionality is very similar to this. You would just need to set the thing config parameter doorbellOffDelay to the value of RING_TIME_LIMIT. I suppose I could have a thing config parameter to tell the binding to use RING_TIME_LIMIT instead of the config parameter, but Iā€™m not sure thatā€™s necessary based on what youā€™re trying to do.

Hi Mark,
works great, thank you!
I use a timer variable in the rules instead of a proxy item, because rawbutton-on-off-switch is not avaiable in M3.
Oh yes, that would be great, if I could use RING_TIME_LIMIT in the rules. Maybe you can also implement a method with gets the result of LASTERRORCODE?

Thank you for your great help!

Oliver

Yep, thatā€™ll work too.

I can create two new thing actions, getRingTimeLimit() and getLastErrorCode().

That would be awesome!

Hi Guys

Wondering if anyone sees regular issues with the Doorbell_Pressed switch. My log shows the PressedImage updating, as a result of someone pressing the button but nothing for Doorbell_Pressed and as a result, no visitor notification.

Any thoughts? Ive not debugged yet but will.

Hi Mark,

See attached debug log

:35.613 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Received and successfully decrypted a Doorbird event!!
21:32:35.614 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Event is eventId='motion', intercomId='ghbhaj', timestamp=1572517954
21:32:35.614 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Handler: Update MOTION channels for thing doorbird:d210x:c56c3dc0
21:32:35.615 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Download image and update channel 'motionImage' using url: http://192.168.0.141/bha-api/image.cgi
21:32:35.659 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Scheduling MOTION montage update to run in 5 seconds
21:32:39.403 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'FrontDoorMotion' received command OFF
21:32:39.405 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoorMotion changed from ON to OFF
21:32:39.455 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Received and successfully decrypted a Doorbird event!!
21:32:39.456 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Event is eventId='1', intercomId='ghbhaj', timestamp=1572517954
21:32:39.456 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Handler: Update DOORBELL channels for thing doorbird:d210x:c56c3dc0
21:32:39.457 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Download image and update channel 'doorbellImage' using url: http://192.168.0.141/bha-api/image.cgi
21:32:39.518 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Scheduling DOORBELL montage update to run in 5 seconds
21:32:39.522 [INFO ] [smarthome.event.ItemStateChangedEvent] - Doorbell_PressedImage changed from raw type (image/jpeg): 52545 bytes to raw type (image/jpeg): 52111 bytes
21:32:40.660 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Update 'motionsensor' montage for channel 'motionMontage'
21:32:40.661 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 1
21:32:42.279 [INFO ] [smarthome.event.ThingUpdatedEvent    ] - Thing 'zwave:device:4296a94a:node20' has been updated.
21:32:44.519 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Update 'doorbell' montage for channel 'doorbellMontage'
21:32:44.520 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 1
21:32:46.662 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - TimeoutException: Call to Doorbird API timed out
21:32:46.663 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 2
21:32:49.687 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
21:32:49.688 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 3
21:32:50.251 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 2

21:32:52.553 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
21:32:52.554 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 4
21:32:53.775 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 3
21:32:55.431 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
21:32:55.431 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Some images could not be downloaded: wanted=4, actual=0
21:32:55.431 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Updating channel 'motionMontage' with NULL image montage

21:32:57.201 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 4

21:33:00.609 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Dimensions of final montage image: w=640, h=120
21:33:00.610 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Concatenating images array into single image
21:33:00.610 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Rendering image to byte array and converting to RawType state
21:33:00.623 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Got a 'doorbell' montage. Updating channel 'doorbellMontage' with image montage

Iā€™m seeing some timeouts. Images are updating fine, but the Doorbell_Pressed doesnt get updated to ON. Any thoughts? Ive restarted the binding and openhab2 along with the Doorbird.

Hi Mark,
did you already find time to implement this?

Thank you!

Oliver

I did. Unfortunately I was in the middle of some other changes when I came down with the flu. Been in bed for the last 24 hoursā€¦ :frowning:

I need to finish up these other changes before I can post the version with the new actions. Hopefully I can get back to this in the next couple days.

It doesnā€™t look like itā€™s able to download the images ā€“ timing out and getting 404ā€™s from the doorbird. Iā€™m not sure what would cause that.

Odd, because its totally contactable. Same VLAN, no routing etc. PoE connection. Hmmm Ill throw on wirehshark and see

Have you tried that basic troubleshooting option of turning it off and on?

Hey Mark!
Thanks for the info.
Hope you get well soon!

Best wishes,

Oliver

Yes I have, the image channels show in the logs but nothing for the Pressed channel.

Ive rebooted everything and still the channel is not updating, @mhilbush any suggestions on how to troubleshoot this?

ive verified the Doorbird has 0 errors on its Cisco connected switch. Ive rebooted the binding, OH2, recreated the channel etc


06:51:14.065 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Received and successfully decrypted a Doorbird event!!
06:51:14.066 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Event is eventId='1', intercomId='ghbhaj', timestamp=1572810670
06:51:14.066 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Handler: Update DOORBELL channels for thing doorbird:d210x:c56c3dc0
06:51:14.067 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Download image and update channel 'doorbellImage' using url: http://192.168.0.141/bha-api/image.cgi
06:51:14.121 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Scheduling DOORBELL montage update to run in 5 seconds
06:51:14.123 [INFO ] [smarthome.event.ItemStateChangedEvent] - Doorbell_PressedImage changed from raw type (image/jpeg): 50224 bytes to raw type (image/jpeg): 48167 bytes
06:51:14.422 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Received and successfully decrypted a Doorbird event!!
06:51:14.423 [DEBUG] [nding.doorbird.internal.DoorbirdEvent] - Event is eventId='motion', intercomId='ghbhaj', timestamp=1572810670
06:51:14.424 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Handler: Update MOTION channels for thing doorbird:d210x:c56c3dc0
06:51:14.424 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Download image and update channel 'motionImage' using url: http://192.168.0.141/bha-api/image.cgi
06:51:14.463 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Scheduling MOTION montage update to run in 5 seconds
06:51:15.576 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'FrontDoorMotion' received command OFF
06:51:15.577 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoorMotion changed from ON to OFF
06:51:19.122 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Update 'doorbell' montage for channel 'doorbellMontage'
06:51:19.122 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 1
06:51:19.463 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Update 'motionsensor' montage for channel 'motionMontage'
06:51:19.464 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 1
06:51:22.507 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
06:51:22.508 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 2
06:51:22.619 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 2
06:51:22.859 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontRoomMotion changed from OFF to ON
06:51:24.852 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'FrontDoorMotion' received command ON
06:51:24.853 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoorMotion changed from OFF to ON
06:51:25.579 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
06:51:25.580 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 3
06:51:26.071 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 3
06:51:28.275 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
06:51:28.275 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 4
06:51:29.393 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'doorbell' montage image 4
06:51:30.086 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoor_status changed from OPEN to CLOSED
06:51:30.087 [INFO ] [home.event.GroupItemStateChangedEvent] - gDoorSensors changed from OPEN to CLOSED through FrontDoor_status
06:51:30.088 [INFO ] [se.smarthome.model.script.Door Sensor] - The Front Door was closed
06:51:30.088 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoor_status_LastUpdate changed from 2019-11-04T06:50:57.115+1100 to 2019-11-04T06:51:30.087+1100
06:51:30.089 [INFO ] [smarthome.event.ItemStateChangedEvent] - FrontDoor_status_Timer changed from ON to OFF
06:51:30.089 [INFO ] [home.event.GroupItemStateChangedEvent] - gDoorsTimers changed from ON to OFF through FrontDoor_status_Timer
06:51:30.090 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Echo_LivingRoom_TTS' received command The Front Door was closed
06:51:30.090 [INFO ] [arthome.event.ItemStatePredictedEvent] - Echo_LivingRoom_TTS predicted to become The Front Door was closed
06:51:30.090 [INFO ] [smarthome.event.ItemStateChangedEvent] - Echo_LivingRoom_TTS changed from  to The Front Door was closed
06:51:30.734 [INFO ] [smarthome.event.ItemStateChangedEvent] - Kris_MobileLastSeen changed from 2019-11-04T06:50:46.000+1100 to 2019-11-04T06:51:14.000+1100
06:51:30.992 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found
06:51:30.993 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Some images could not be downloaded: wanted=4, actual=0
06:51:30.993 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Updating channel 'motionMontage' with NULL image montage
06:51:31.861 [INFO ] [smarthome.event.ItemStateChangedEvent] - Echo_LivingRoom_TTS changed from The Front Door was closed to
06:51:32.781 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Dimensions of final montage image: w=640, h=120
06:51:32.782 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Concatenating images array into single image
06:51:32.782 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Rendering image to byte array and converting to RawType state
06:51:32.794 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Got a 'doorbell' montage. Updating channel 'doorbellMontage' with image montage
06:51:32.803 [INFO ] [smarthome.event.ItemStateChangedEvent] - Doorbell_MontageImage changed from raw type (image/png): 91956 bytes to raw type (i

Unless the state changes, you wonā€™t see an entry in the log. Are you sure the channel is being set to OFF before the doorbell event occurs?

06:51:19.464 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - Downloading 'motionsensor' montage image 1
06:51:22.507 [DEBUG] [ing.doorbird.internal.DoorbirdHandler] - HTTP GET failed: 404, Not Found

This is failing when it tries to pull the history image. Ib the case of history images, the request goes to the Doorbird, but the Doorbird then pulls the image from the cloud (i.e. the Doorbird doesnā€™t maintain any local historical images).

If this was working at one point, something had to have changed. Possibly Doorbird firmware, something on the Doorbird backend, history permission in the app, etc. You could try to pull the history image using your browser using this URL.

http://<userid>:<password@<ipaddress>/bha-api/history.cgi?event=doorbell&index=1