DF-Player mini - How to stop playback at end of folder

Hi,
I built a children audio playback device based on esphome and DF-player mini. Everything works fine, but I can not find a way to stop playback at the end of the folder (I have multiple audio books on the SD card). I can only loop the playback of one folder indefintely (which will be anoying) or play a single file from the folder.

Any ideas?

As I read the docs it should stop after playing the folder, unless you set loop to true.

At least in my experients this did not work out, since you need to specify a folder and a file. Then it plays the the single file and stops then. The alternative is to play a folder but then it loops the entire folder.
However, I found a solution by playing one song after the other by increasing the file number after each “Playback done” event until I get a Nack due to a non present file. Therefore I needed to fix the DFplayer code - MR is on its way: Added Handling for Nack "file not found" by croessi · Pull Request #5338 · esphome/esphome · GitHub
If anybody is interested I can share the esphome yaml as soon as the MR is in.

1 Like