DIY Smart Doorbell with Android notifications

Hi again.

BTW, as I have mentioned I have created a readme file which will be a copy/paste setup instructions. I handled the SSL with certbot (let’s encrypt). Very simple and it works.
The last thing that needs fixing is the doorpi-card.js. The custom card throws an error probably due to changes in the custom card rules as per the following post:
https://developers.home-assistant.io/blog/2020/02/18/106-custom-card-changes/#helper-functions”.
The card can’t be detected so the doorbell does not work under HA.

1 Like

Does anyone have a working setup with HA 0.107.x or above. The doorpi-card.js is causing errors on this HA version and above. It looks like it is not loaded properly or at all.

Hi my doorbell works fine in ha 110.4 hassio. only issue is it does not work in iOS. Post your card code I’ll take a look compare. My doorbell works great on a pc and android.

1 Like

2 Likes

Hello,

I’m planning to build this doorbell but I’m also planning to integrate it in a lovelace pannel with an “Open door” button (opening the door is managed with another integration).

As I’m on iOS, I was wondering if the iOS app is using the latest webkit and so is able to do WebRTC ?

My dream scenario is the following :

  • Someone ring at the door
  • iPhones get a notification
  • iPhone user click on the notification which fires the Home Assistant iOS App showing the lovelace pannel with the doorbell video and an Open Door button

Question is… would the iOS user be able to talk and listen to the person ringing at the door ?

V.
p.s. I’m planning to have a Pi for the doorbell while another one is running Home Assistant inside the house and managing all other aspects of home automation.

First of all, I would like to thank @rdehuyss for this amazing project but I’m struggling with it for the last few days and I cannot make it fully working.

My problems are as follows:

  1. When I press the physical Doorbell button, the mjpeg streaming works fine and all three buttons appears in the Lovelace card : OPEN DOOR, ACCEPT and REJECT

  2. If I press REJECT ,everything is fine, the buttons are restored to initial state and only OPEN DOOR remain on the card.

  3. If I press ACCEPT in the Web Console, I got the error “getUserMedia not supported” so I modified, in the file doorpi-card.js, the makecall() “navigator.getUserMedia” with “navigator.mediaDevices.getUserMedia”. WIth this, the error is gone and now I receive a popup from the browser to allow permission to use the microphone, the microphone icon is blinking, as it is in use, but I cannot hear any sound from the doorbell mic.

  4. When I press the END button, I get another error “Uncaught TypeError: this.signalObj.hangup is not a function” and the session remains open and END button stays on the card. The END button dissapears only when the automation executes (service: input_boolean.turn_off
    entity_id: input_boolean.doorbell). This problem I could not figure out how to solve it.

Did any of you, using this project, have similar problems, or there are any recent updates of the .js source files?

I’m currently use HA 0.112.4 + Firefox 78.0.2 (and Safari 13.1.1)

Thanks.

Did you already test chrome? I never tested it in firefox/safari.

Exact stacktraces from the console also help for debugging.

Hey mate
Are you trying to use ha through your iPhone
I can’t get it to work. Works fine on a pc and android phone for me.The .js files need a rework because iOS is picky about how everything is worded but if it is changed it may not function on android. Or that what I have read.chrome and Firefox are just a front on an iPhone so it doesn’t make a difference. https://webrtchacks.com/guide-to-safari-webrtc/
Maybe you can make sense of this.

I have returned to the unfinished project after dealing with other projects.
Actually I have embedded the system into an old Urmet Synthsis system that broke down.
It is working but not fully and as it should.
I am using latest HA as of today and Rpi 3.
The problems are:
The doorpi card no longer generates an error but the screen is empty. Nothing on it.
I have changed the buttons names, I have set the url as the one I use (https).
What I have seen in the doorpi-card.js file a line of code that opens the stream using wss://. Trying to use this on my browser shows an error (wss://my host:9090/stream/webrtc) while the https one woks on the browser. None works on HA.
What am I doing wrong. Could someone send a uv4l config file to compare with.

@rdehuyss, thanks for the project, I cant figure out how you open the door with this? Thanks Manne

Hello,

you need to edit the file doorpi-card.js like that (just copy/paste):

initEventListeners(hass) {
        console.log('Loading WebRTC');
        this.signalObj = {};

        this.buttons = this.getElementById('buttons');
        let doorBtn = this.removeEventListeners(this.getElementById('btn-open-door'));
        let acceptCallBtn = this.removeEventListeners(this.getElementById('btn-accept-call'));
        let rejectCallBtn = this.removeEventListeners(this.getElementById('btn-reject-call'));
        let endCallBtn = this.removeEventListeners(this.getElementById('btn-end-call'));

        doorBtn.addEventListener('click',  () => {this.doorOpen(hass);});
        acceptCallBtn.addEventListener('click', () => this.makeCall());
        rejectCallBtn.addEventListener('click',  () => {this.cleanup(hass);});
        endCallBtn.addEventListener('click', () => {
            this.terminateCall();
            this.cleanup(hass);
        });
    }

    doorOpen(hass) {
        setTimeout(() => hass.callService('input_boolean', 'turn_on', { entity_id: 'input_boolean.dooropen' }), 1000);
    }

And you need to add this to configuration.yaml:

input_boolean:
  dooropen:
    name: Door
    initial: off

When you click the button the variable ‘input_boolean.dooropen’ will change the state to On!

Best regards!
Gonçalo Almeida

1 Like

Hi,

Did you manage to finish the project successfully? I’m having some issues…
I tried to contact Ronald Dehuysser @rdehuyss without success.

Best regards
Gonçalo Almeida

I gave it up. I have now Hikvision system connected to my HA.

Some models lack sum features due to a bug which was supposed to be solved by now.

As far as I know it was not solved till now.

Hi,
Mine already works on the test page, but in Home Assistant it gives a connection error… I think it’s in the code of the Home Assistant files!

I’ll try to compare both files…

Hello,

Do you still have your doorbell working?

Best regards!

Hey man,

finally my doorbell is working! If you need help just send me a message .

Best regards
Gonçalo Almeida

Hi
Is working in HA (or “just” in the “test page”)?
Regards

Hi,

In HA! :slight_smile:

Best regards

It’s nice the hear that, but in that case don’t you want to share with us what was the problem that innitially was causing the problem?
Regards ( Abraço :wink: )

I have everything set up and it works with the test page (https://EXAMPLE.COM:8888) using the url EXAMPLE.COM:9090/stream/webrtc (connects with the server, audio and video)! In Home Assistant, when trying to connect to the address, it says that it can’t connect…
Home Assistant:

Test Page:

Best regards
Gonçalo Almeida