Turn an ESP8266 WemosD1Mini into an audio notifier for Home Assistant: Play MP3, TTS & RTTL

Can’t get it working. I have flashed Wemos D1 with custom firmware, filled topic with speaker01. I can hear melody from speaker that device successfully connected, however cant play any mp3 from www folder not from automation nor by button kindly posted by you.

button code is following:

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: mqtt.publish
  data:
    payload: https://192.168.1.20:8123/local/udp.mp3
    topic: /speaker01/play
  target: {}
icon: mdi:play
name: play

Another thing I notice my MQTT integration did not detect device don’t know if it should or not:
image

when I paste web address into browser it works, so I assume something is not right with MQTT connection.

Could you explain to me how to get it working with MP3 over HTTPS? Im using bat file and precompilled bin provided by you.

Hi, Is it possible to play mp3 from internet if we place that specific url?

Any solution on the MP3 issue?

I am using an ESP32 with an external DAC → UDA1334A

My wiring is as follows:

My ESPHOME code is:

esphome:

  name: audio-notifier-1

  friendly_name: audio_notifier_1

esp32:

  board: esp32dev

  framework:

    type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "zEBCe37EmV8ZPmTFlEaWd8BE4YkT45DUVMV0OksMbRU="

ota:

  password: "14a502f63520e30fc336ef966b401601"

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Audio-Notifier-1"

    password: "10zAAiH3qVA2"

captive_portal:

i2s_audio:

  i2s_lrclk_pin: GPIO33

  i2s_bclk_pin: GPIO19

media_player:

  - platform: i2s_audio

    name: ESPHome I2S Media Player

    dac_type: external

    i2s_dout_pin: GPIO22

    mode: stereo

I can play TTS without issues but if I play an mp3 file from my home assistant media, it only stutters.

Any solution to this issue? I can see that it was working prior to February of this 2023, and an update might have broken the capability to play mp3 files.

Has anyone found a solution???

1 Like

It plays from HTTP but not HTTPS, also pay attention to file name, should be simple latin without spacing, use underline. Also it does not play high bitrate music. Did you manage to get stereo mode working? Im using two MAX98357A boards, however they work in mono mode.

is that the MQTT setup? Any link to find info about the setup?

I am trying to play a 5 second audio located in the “Media” folder of my HA. I have set up my to Stereo mode and my TTL works fine. It also works in Mono mode.

I need to look into this. The wake up chime from Google nest minis makes me nuts (I only use them as tts announcers)

Just been wondering how long a nest mini takes to go to sleep.
I have a group of them that I only use for notification /announcements. (have a second set to use for voice commands etc)

I’ve been wondering how often you’d need to send just a “ping” of some sort (like a 1 second silent MP3 file) just to keep them “awake” so you don’t get the wake up chime…

Only issue with this is if you send a command to do a notification and then the “ping” happens to get sent right after it would kill the notification…

Yea, was wondering about my speaker as well. It goes to sleep after 5 minutes of inactivity. I was thinking of sending a silent mp3 file every so often, but my setup has quit working for quite sometimes and there are a handful users on the same boat.

Doesn’t look like it will be fix. I also been searching for a way to revert back to an older version with my esphome setup. Found one way, but not been tested.

Put a wait_template in your ping automation to only continue when the speaker is not ‘playing’.

1 Like

Another option is to create a script for anything sent to that device (using variables sent from the Automation) and then set the script run mode to ‘queued’.

I do this for my Google Home in my kitchen so that various messages that may be triggered to send to it when there is motion in the kitchen all get queued one after the other. You could queue your messages with the ‘ping’ audio clip in the one script.

Hi Friends,

I found this thread still open on a tab on my old server. I just wanted to say, I’m going on over two years of running these notifiers in my home. I have five of them, and I still love them.

I was curious if there has been any updates on this project. If I remember correctly, I’m running the Schmurz fork/flavor on mine. He had implemented some more features and whatnot from the original Mr DIY project code.

If anyone has the ability, I would like to add a feature request. When these boot up it plays a guitar sound. Maybe some sort of time check and if it’s later/after hours they don’t fire off that guitar sound in the event the Wifi reconnects. My biggest issue is having these in a bedroom and getting woken up in the night to that sound firing off…

Also, is there extra/enough storage space that we could put one more sound on it? I would like a doorbell please :slight_smile: I tried streaming a doorbell sound from a local server a few different ways and it’s choppy and terrible.

Here’s the fork I use

i got a box with the same fork i think, put it together for fun to see if it was in fact possible to do with a 8266 and it was, but since there is so many better options today i never really used it. consider the new esp32s3 if you plan to play with voice assistant, or esp32 wrover for music player, both of these have psram which is used for audio encode/decode, the wrover is a bit older but is supported by the esp project “squeezelite” that gives you all a sonos speaker would, including multiroom.

if anyone was to update this project i think they should do it for the esp32c3 (the new 8266) and/or esp32s3 (the new esp32) - both of these are available in “supermini” versions which are really tiny :slight_smile:

Great jobs! And it’s easy to add a Audio media player to Home-Assistant from ESPHome now.
This is a botched external component which I create for ESP32C3, it was developed from this article here, thank you to all the kind people.If anyone needs it:
winteris/ESPHome-singlecore-i2s-audio: ESPHome I²S Audio Media Player Component for ESP32 single-core chips (ESP32C3) (github.com)

Hi
I discover this project . Seems very good
What i really don’t understand is the wiring between wemosd1 and the amplifier PAM8403.
Is it possible to focus on that part ? Especially on the 3 pins of the audio input in the left bottom corner of the PAM. (R,T,L)
Thanks in advance

1 Like

seems more clear now,
don’t need an amplifier
only a speaker with a built-in amplifier
need also a jack with this wiring

D1Wemos RX to Left and Right jack
D1Wemos Gnd to ground jack

I will try that soon
Regards

Hi
I get it working but on a ESP8266. It is not working on Wemos D1 Mini
I succeed to do a tone, play a mp3
Unfortunatly i can’t play a icecast with that:

action: mqtt.publish
data:
  topic: /sound/stream
  payload:  http://streaming.radio.rtl2.fr:80/rtl2-1-44-64?listen=webCwsBCggNCQgLDQUGBAcGBg

Do you know why ?
I also try to upload the code on a ESP32 but when it booted it write “uncompatible board” wired !

Thanks for your support
regards

Hi all,
I have mqtt up and running with some device correctly connected.
My wemos d1 didn’t work: in mosquitto log i can read “New connection from 192.168.0.xxx:49737 on port 1883.” and “Client MrDIY Notifier disconnected, not authorised”.
Someone can help me?
Thank you