WIP warning!: this is a work in progress! I think I can bring this to a good end but I already faced quite some battles on both hard-and software side. Code and more will be posted once I get to a beta version…
Summary
In the quest to find a smart doorbell that integrates with HomeAssistant, I finally developed DoorDroid. What is it? It is an old Android smartphone I had lying around which I will use (off course without the screen) as my smart doorbell. It provides free 2-way audio calling and a video feed.
This project is inspired by DoorPi but will hopefully have better call quality.
Requirements
Old Android Phone supporting SIP running DoorDroid
Asterisk SIP server with correct configuration
One of:
an always on tablet showing HomeAssistant with the DoorDroid custom card
a smart phone supporting SIP calling
How does it work
I run my HomeAssistant setup within Docker via docker-compose and I now added Asterisk, a SIP server which supports two way audio calling.
In a 3D printed/laser cut box, the Android smartphone will be placed outside at the door. The smartphone has one app running on it all the time, DoorDroid. The app has the following features:
it runs an embedded HTTP server which can stream the phone’s camera
it can call a default SIP number or any SIP number registered in Asterisk server
Next to the smartphone is an ESP8266/32 with one or more physical hardware buttons attached to it.
If someone pushes the doorbell button, a script is launched in homeassistant:
using @thomasloven excellent browser-commander, my wall-attached Android Panel showing HomeAssistant all the time, switches to the Doorbell tab
a Sonos TTS message is played
the DoorDroid app receives an HTTP call to initiate a SIP call to my always-on tablet (if I’m away to my smartphone)
On my tablet, I can accept the call and start chatting. The DoorDroid custom card also shows the videofeed of whom is at my door. Off course, I can also reject the call
Screenshot love
P.s. no comments on the pics please
Wow sounds amazing! I am definetly following this! Wondering if it’s possible to connect the phone to a dumb doorbell and have it inside my flat (I live in an apartment so I can’t install a phone outside of the front door) and get only a “normal” voice call when I’m not home to open the door for the post delivery or the cleaning lady.
Maybe your idea should get integrated in theAndroid (alpha) app of Home Assistant
Thumbs up for this project!
Thanks man! I have this expensive 2N SIP intercom attached to a Control4 system and I want to integrate it with HASS as it works just fine (mic levels and all). So if I can substitute DoorDroid with the 2N it might just work.
Hello,
I am more or less in @jiiins situation. I have a built-in SIP doorbell (GDS3710 grandstream). I am therefore interested on the client side. Can you detail what you have installed on the tablet to receive the call? I assume you are using what is there https://github.com/rdehuyss/DoorDroid but I don’t understand what to do.
It seems you are using the jssip library. So, in theory, it should be in the browser of the android phone? Am I correct?
Thanks for the hints and sharing your project.
GV
So, my indoor station (an in-wall Android Tablet) is running standard Lovelace in Chrome (= browser of the Android phone in your words). I created a custom lovelace component which was called by the DoorDroid application (in your case the GDS3710 grandstream). It indeed used jssip and asterisk.
Have you taken a look at the wiki? Everything is described there…
I did!! But " * Download and install the Android app from the releases page of this repository" from the wiki is not clear to me.
What do you need to install on the android phone? I need (somehow?) to build an apk?
In my understanding with the sipjs library everything was in the browser from the client side. So, in theory, nothing to install on the phone/tablet… Or at least that was my understanding. Hence, my confusion
Thanks
GV
Missed that… Sorry! Nevertheless, the question on sipjs remains. In theory, it should be possible to run everything in the browser, and not requiring an apk.
We had an exchange on this page https://community.home-assistant.io/t/sip-client/60964.
GV
Hello,
Some report on my progress so far. I have installed doordroid and jssip on my HA box. I have created the extension on my asterisk serevr to register by able to register the “card” of doordroid.
Up to that point all good.
When I open lovelace and go to the view with the webrtc phone I can see the phone registering on asterisk.
When I call the webrtc extension, the two additional buttons are displayed. However when I click on “accept call” buttons I have an error message in the developper console. See below.
Loading SIPPhone doordroid-card.js?v=0.0.1:80
initialized camera view doordroid-card.js?v=0.0.1:151:
SIPPhone registered with SIP Server doordroid-card.js?v=0.0.1:100:
jssip-3.3.6.min.js:9 Uncaught INVALID_STATE_ERROR: Invalid status: 5
at t.value (http://192.168.0.150:8123/local/plugins/jssip-3.3.6.min.js:9:117457)
at HTMLElement.<anonymous> (http://192.168.0.150:8123/local/plugins/doordroid-card.js?v=0.0.1:131:71)
r @ jssip-3.3.6.min.js:9
t @ jssip-3.3.6.min.js:9
value @ jssip-3.3.6.min.js:9
(anonymous) @ doordroid-card.js?v=0.0.1:131
doordroid-card.js?v=0.0.1:121
And I am stuck!! Any suggestion where to look at and what to try?
Hello,
Thanks for your answer.
In fact, my “SSL” setup (for hassio, asterisk,…) was not correct and webrtc seems to be very picky when it comes to connection over unsecured channel. So, once HTTPS, WSS was ok, it when well.
In your doordroid-card.js I have added:
JsSIP.debug.enable('JsSIP:*');
which helped greatly!
I believe that my configuration is OK (SIP extensions, asterisk,…) the only missing bit is incoming audio from the SIP contact. And I believe, I understand why, even if I can’t see what to do…
In my setup the SIP extensions calls the webrtc endpoint. I can accept the call and it can be seen in the debug console:
However, looking at the code, the next event should be:
session.on("addstream", (e) => {
the event addstream AFAIK doesn’t exist any more in the JSSIP 3. It was part of the API in 2.X.
With my (extremely) limited understanding of JS and JSSIP, I can’t figure out what should be the final (?) step to “link” the RTP audio (seen in the wireshark capture) with the audio of my PC.