First I apologize for not knowing English and having to use the Google translator.
I have added an mp3 player to a nodemcu with tasmota to send sound messages in my hassio, but since I am new to everything: hassio, programming, mqtt. I got stuck and I do not know how to configure it, to reproduce the sound in the nodmcu I have to send the topic: cmnd / music / MP3Play and to stop it cmnd / music / MP3Stop, then I have configured the following mqtt switch in my configuration.yaml
and it works, if through the browser I connect and in the console I send the MP3Play command the nodemcu plays the sound, but I do not know how to send it through the home assistant
I haven’t tried the momentary parameter yet, I just recently discovered it in another thread.
This should give you one momentary switch to turn on the player and another to turn it off. The parameter for momentary is in ms.
I just tried this with a NodeMCU running Tasmota. The state_topic is required to make a switch on the front-end. It works. I have two buttons, NodeMCU Light ON and OFF. If I click on the ON switch, the light on the NodeMCU turns on, and 0.3 seconds later, the switch turns itself off, but the light stays on.
You should see the cmnd lines with every press of the switch.
You really need an MQTT tool, like the MQTTbox I mentioned before. It will show you what messages are being published. You can also find an MQTT app for your phone. I use MyMqtt for my android.
I am going offline for a few hours, but I would isolate where the problem is. Use MQTTBox to publish the MP3Play and MP3Stop messages. Once you have that working, you will then know exactly what the switch command_topic should be.
Also, some versions of Tasmota (at least here) are case sensitive whether the command topic is ‘power’ or ‘POWER’.
You said that you were able to send play and stop from the console? Monitor # on MQTTBox and see what the topic and message are. (# is the MQTT wild card. # will show you every message going through your broker).