I dived into the code and, it seems like it’s polling the doorbird on: /bha-api/monitor.cgi?check=doorbell. The url is responding with doorbell=0, when pressing the button the url is responding with doorbell=1. But, ONLY WHEN PRESSING the button, there seems no latching/relaxation…
This means that during the press (<1 sec.) Home Assistant needs to poll the doorbird. So you need to poll the doorbird al lot to see the event. In the code I see a update interval variable of 250ms., I’m not quite sure how this works. It sounds like you almost have to DoS your doorbird?
To test my finding I pressed the doorbird button for a longer time (30 sec.), than the event is eventually received by Home Assistant.
I personally don’t like the polling mechanism, a lot unnecessary network traffic. The documentation indicates that there is also a stream available under: /bha-api/monitor.cgi?ring=doorbell. Or, like the proxy is doing, use the notification (push) method.
You’re going to hammer the API if you attempt to do anything more than 1 req. / second. Even DoorBird recommend against this. It ends up forcing a restart (a lot), happened to me more than I wanted. The monitor?check endpoint probably wasn’t devised for this … ever polling it is bad news. The ?ring endpoint is also next to pointless, it doesn’t always give you want or expected on doorbell events, also too flaky. The only stable one to use is the notification API. Pushing to the client works extremely well, its also how they setup cloud to cloud with vendor products e.g. Zipatile. DoorBird mentioned they will probably remove the ?monitor endpoint sometime.
When I get time, I was going to set up HA to host endpoints for various state changes, then configure the DoorBird device to call them when the doorbell rings.
I just haven’t had a chance to get my dev environment reset (I’m on Windows, so it’s not easy) and figure out how to host API endpoints in a component.
I just pushed new code that registers HA with the device, which then creates an event when the doorbell rings. I’m not sure how to make this useful in the frontend, but any changes needed there should be minimal.
At the moment the Axis component uses RTSP protocol to receive subscribed events. There is work by another community member to add a web endpoint to give support mainly to older devices that doesn’t support the RTSP events.
What I understand from the code is that when doorbell_events are activated, Home Assistant is opening a API endpoint for the DoorBird and will configure the DoorBird API (on startup) with notifications to call the Home Assistant API.
I will leave some feedback when it’s working, but I still need to upgrade Home Assistant.
While I haven’t moved over to this API’s ring notification (still using the proxy version), I have tied this into TTS using Bluetooth speakers with my RPi. I have my Pi connect to my Echos, and they will let me know when someone is ringing the door. There are a few known issues connecting to some Echo devices using RPis, but my Echo dot seems to consistently work. Other ideas may be to flash some lights, send some push notifications, etc.
Here’s my automation converted to use the trigger (but untested). Probably doesn’t make sense to put it in the documentation as I’m using multiple unofficial components to do this.
- id: NotifyDoorbell
alias: 'Notify of ringing doorbell'
initial_state: 'on'
trigger:
platform: event
event_type: doorbird_doorbell
action:
service: tts.google_say
data:
entity_id: media_player.tts_bluetooth_speaker
message: 'Ding Dong! Someone is at the front door!'