Extending my IoT Doorbell with Alexa features
In my post about how I got my doorbell smart, I thought... yes How can I extend it for now with some handy features?
So, in fact, the bell is loud, but what is it when I am in my garden and my door is closed and the delivery guy must hold a heavy package and try to ring the doorbell I do not open it because I didn't hear the bell. That's frustrating for everyone and may end up like this
So I must be get noticed when the doorbell rings, for this I can use one of my Alexas, especially the Alexa dot. In my Garden, there is one for playing music while I work in the garden.
Thankfully I got Homeassistant as support for my Homeserver and it's controlling my House to automatically the most daily routines. So why not the notification for the doorbell?
What is Homeassistant
For those that don't hear anything about Homeassistant let me introduce this to you.
Homeassistant is a nice and handy tool that will allow you to control absolutely everything in your home (not only there). It integrates with most provided devices and custom ones (like ESP easy and so on).
On Top, there it comes with a nice handy web frontend that will allow you to create nice fancy (mobile-friendly) dashboards.
On the other site, you can create your custom automation, depending on actors like wall switches or calculated measures like sundown time.
The best thing is, that it is so small, that you can install onto a raspberry pi, or you can install it via container into your Synology NAS.
But the downside of this is, that this will get a Hobby that will overwhelms you very quickly, so be careful full ;)
Adding the extension to communicate with the Alexa devices
Homeassistant has plenty of extensions available. So one of them is the Alexa media player. This will discover then all Alexa devices in your amazon account and will enlist them than in your Homeassistant.
First of all, add the integration into your Homeassistant
Next, it will require the log in credentials for your amazon account. It will then generate an SSO Token to get connected through your amazon account to send messages to your Alexa devices and also discover telemetry data from these.
Once installed, you will see in the integration section of Homeassistant a nice tile with the Alexa Media player and their discovered devices.
Also, it will enlist also a multiroom device. A Multi-room device is a group of devices that you can combine together. For example, you can create a multiroom called "everywhere" and add every Alexa you have to this multiroom. For my requirement, it will be perfect, because I want to get noticed everywhere, not only in the garden. Let's assume I am on the roof behind a closed door, there is no chance to hearing the doorbell, but there is an Alexa too, for playing music, while I iron my clothes (yes I do it myself ;)).
Our first try
First, try out that your connection is correct and you can make a Text to Speech message through your Alexa. For this go to your Homeasssistant under Development tools and then on Services. Switch now to the Yaml mode and paste in the following lines of YAML code.
Let me explain the first line. This will use the "notify"- action and address the destination after the first dot.
The template for this is always "notify.alexa_media_{device-/multiroomname}". So this case we send it to the multiroom device everywhere.
The rest is self-explained.
So when you hit the button execute service, you will get noticed by your Alexa.
Let's integrate
After our first test will be successful we can integrate them into our Homeassistant for now. Instead of creating awful hacky scripts, I will use simple automation for this.
So go to Settings and then Automations and create a new one. As a trigger, you can use anything you have available. My doorbell sends a message to the MQTT on a specific topic. So I will listen to it. Here's my trigger definition
The YAML definition is here
After we have a trigger, there must execute our call, so go to the actions and add a new one. This will then execute Text to Speech action like above. So I modified the text for our announcement a little bit and it will look like this.
Please note, that I live in Germany, so my device name differs from the one above. The important part is the data part. Here I will tell Homeassistant to use the announcement and use the voice to announce (with speech). So the yaml for this action looks like this:
Now you can save them and hit execute. After that, you will hear your Alexa telling you that someone is at your front door.
Final Words
So I now have my custom digitalized doorbell extended with the functionality to speak. So in that case I am in my garden or in a room, where I cannot hear the doorbell, I will get noticed through Alexa. After a little tryout with my homeassistant, I found this very helpful. Yes sure there are other ways too, but this was very seamless for me.
The other thing is, that I now have a use case to integrate my Alexa devices into my Homeassistant for now. Sure you can use these Alexa announcements for more than the doorbell notification. Maybe for presence detection, to let Alexa greet them when they come into the door. But for me, it is enough that Alexa will tell me that the package delivery guy (or another person) is at the front door.