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

Perhaps try a HTTPS link?

Are you connected to HA locally with http or https?

I am connected locally with https

Perhaps try a HTTPS link?

I have tried with a https link, but I hope that is not the case or I will be limited to https link url for radio streaming.

Hello, I have the same connection scheme, tell me, do you observe crackling at the beginning of playback ??? Especially noticeable with TTS

Yes, I do hear it as well.

1 Like

Do you mean a stutter? That’s what I get when playing TTS through a M5 stack speaker unit (the ones they had in the release party a while back).

Yes, it is stuttering (sometimes crackling) in the first seconds of playback. Then it sounds clean.

edit: is there a way to increase the volume ?

You can get 10 pieces of amplifier board for US $6.99 on Amazon, see - https://www.amazon.com/gp/product/B09YP2Y59K/

i am using the max98357 but i found it still a bit to low.

Hello. This is for anyone else who have setup the native 12c audio as well. I am assuming your setup still works?? I was able to setup a few months ago and got it working. Now, playing mp3 files does not work anymore. No audio coming out of the speaker. However, if I create a tts message, it plays through the speaker. Just not mp3 file. No errors in log either. The url that is shown in the log for the mp3 file will play via a browser. I am stump on how to troubleshoot further.

This is my current config I have posted as a new topic. Using latest version of Esphome v2023.2.2.

hello,

you are right, something changed…

i have one mono and another one stereo and seems the mono has now a low level volume and a poor quality of sound…

the stereo one seems not concerned and still work.

here is the 2 config :

mono:

media_player: 
  - platform: i2s_audio
    name: audionotifier Media Player
    dac_type: external
    i2s_lrclk_pin: GPIO33 
    i2s_dout_pin: GPIO22 
    i2s_bclk_pin: GPIO19
    mode: mono

stereo:

media_player: 
  - platform: i2s_audio
    name: audionotifier stereo Media Player
    entity_category: diagnostic
    dac_type: external
    i2s_lrclk_pin: GPIO33 
    i2s_dout_pin: GPIO22 
    i2s_bclk_pin: GPIO19
    mode: stereo

the stereo version has an external 2x15W amplifier, so maybe the problem is the same but the amplifier do his job…

i think the volume is not so loud than before. Seems something has changed on the level side.

Which kind of speaker do you use @duceduc ? 3Ohms 3W or 4 Ohms 4W or 5 Ohms 5 W?

mine is 3Ohms 3W with the MAX98357a for mono version.

EDIT : the only difference between my 2 config was :

esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

but it doesnt change anything.

there is really a level difference with the new EspHome and same problem with TTS.

We are not alone lol :
https://github.com/esphome/issues/issues/4106

Hey there. I am using this speaker.

Regarding the mono feature. I remembered switching back and forth between stereo and mono and both sounded the same for me when it was working.

I think something changed with this esphome version 2022.12.1.

yep!

perhaps need to make a new ISSUE on github for this?

After some kind of update, TTS stopped stuttering and started working cleanly. Very good for TTS. !!! The radio works the same. But the mp3 stopped working and causes the esp to restart.

Any idea how to connect it to internet radio? :wink:

I get almost everything work. The voice don’t sound good so I’m going to use MP3 files instead.
Where to put them on the server?
I have a own server for Node Read and the Mqtt server. I use raspberry pi with Debian. I can access it from Wan, (I get allot of different data from my locals around in Östergötland :slight_smile: ).

@OlaA

Hello OlaA, congratulation on your fist post.

I put them in www/mk

  • note that mk is folder!!!

then i call the mp3 with:
http://192.168.0.252:8123/local/mk.mp3/name_of_the_file.mp3

this is example of my button that plays one file:

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: mqtt.publish
  data:
    payload: http://192.168.0.252:8123/local/mk/Крушево_абер_пристигна.mp3
    topic: /speaker_lab/play
  target: {}
entity: person.mqtt_user
icon: mdi:play
name: play

[EDIT]
You can check if your path is ok if you paste the payload into the browser. You should get the player (i use chrome browser)

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?