ESPHome as doorbell? (AKA storing sound files on the esp)

Hi,

I’ve seen a bunch of “How to make your dumb doorbell smart” projects, but…

My dumb doorbell sucks at being a dumb doorbell. It mostly works if the batteries are fresh, but quickly becomes erratic. How about using an ESP to make a better dumb doorbell, and making it smart at the same time?

The media player component looks like it could do the job, but I’ve only seen examples of using it to play things on the internet. The doorbell should work even if my Internet goes down. I bet most ESP:s have enough flash mem to store a wav file. How do I make the media player thing play that wav file, and how do I store it there? ESPHome seems to do something like that for images and fonts, can that be used?

If that works I assume that the rest is just a case of making the ESP respond to events, and figure out how to get the ding-dong sound out to a loudspeaker. Which I believe I should be able to figure out.

You could use a dfplayer and store sounds on there. A bit overkill perhaps.

Probably not more expensive than a dac and an amp, but I’m not that enthusiastic about that solution. I’d like to be able to update the sound OTA and as I understand it, updating sounds in a dfplayer requires fiddling with a microSD card.

Just a query or two:

Just one sound, or a number of them?

Local control with a self contained esp doorbell is all very well, but how does ha automate this?

I have a reed switch that I could use to detect when someone opens the door, so I could possibly have a separate sound for that event, but apart from that I don’t really see the need for a bunch of different sounds.

And I don’t know how HA would automate it. If all I needed was a light it would be easy: just configure the esp to power one GPIO pin whenever some other pin gets shorted to GND. But getting the esp to output a sound file when a GPIO gets shorted is another thing, since I don’t know how to store the sound file in the esp.

What I know is that the display component does something simiilar, it seems to use pillow to store images and fonts in the esp. And if there is enough storage for that, there should be enough storage for a sound file or two.

At the moment that would be only half the work I guess. From what I see the media player components can’t handle play back from local files (yet) - so some more code is obligatory on this side too. :musical_note:

As another “idea”. If you need simple monophonic sounds you can store them on the esp already :wink: