Closed PablaV closed 5 days ago
You'll need to uncomment the lines you want active by removing the //
in front of them. You can set your topic to anything you want. I keep it simple, just the name of the shairport instance. For example, my topic is "officeshairport" for the instance in my office.
Here is my mqtt section:
mqtt = { enabled = "yes"; // set this to yes to enable the mqtt-metadata-service hostname = "10.0.1.50"; // Hostname of the MQTT Broker port = 1883; // Port on the MQTT Broker to connect to username = "[WICKEDUNIQUEUSERNAME]"; //set this to a string to your username in order to ena> password = "[SUPERSECRETPASSWORD]"; //set this to a string you your password in order to ena> // capath = NULL; //set this to the folder with the CA-Certificates to be accept> // cafile = NULL; //this may be used as an (exclusive) alternative to capath wit> // certfile = NULL; //set this to a string to a user certificate to enable MQTT > // keyfile = NULL; //private key for MQTT Client authentication topic = "officeshairport"; //MQTT topic where this instance of shairport-sync> publish_raw = "no"; //whether to publish all available metadata under the cod> publish_parsed = "yes"; //whether to publish a small (but useful) subset of m> empty_payload_substitute = "--"; // MQTT messages with empty payloads often a> // To avoid empty payload problems, the string here is used instead of any empty p> // Currently published topics:artist,album,title,genre,format,songalbum,volume,c> // Additionally, messages at the topics play_start,play_end,play_flush,play_resu> publish_cover = "yes"; //whether to publish the cover over mqtt in binary for> enable_remote = "yes"; //whether to remote control via MQTT. RC is available > // Available commands are "command", "beginff", "beginrew", "mutetoggle", "nexti> };
I've deployed a broker and configured both HA and Shairport sync:
mqtt =
{
enabled = "yes"; // set this to yes to enable the mqtt-metadata-service
hostname = "broker"; // Hostname of the MQTT Broker
port = 1883; // Port on the MQTT Broker to connect to
topic = "shairport"; //MQTT topic where this instance of shairport-sync should publish. If not set, the general.name value is used.
publish_parsed = "yes"; //whether to publish a small (but useful) subset of metadata under human-understandable topics
publish_cover = "yes"; //whether to publish the cover over mqtt in binary form. This may lead to a bit of load on the broker
enable_remote = "yes"; //whether to remote control via MQTT. RC is available under `topic`/remote.
};
I've configured the component:
If I play something over AirPlay, this what the player shows:
Can you download MQTT explorer and confirm that you can connect to your broker?
No, topics must not have a leading slash.
https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/
MQTT Best practices Never use a leading forward slash A leading forward slash is permitted in MQTT. For example, /myhome/groundfloor/livingroom. However, the leading forward slash introduces an unnecessary topic level with a zero character at the front. The zero does not provide any benefit and often leads to confusion.
Thanks, I was able to get this working. Apologies for deleting my comments though.
New to the world of MQTT, and am stuck on what I should set me topic for on the custom component and
shairport-sync.conf
file. Here is what I have so far for my config but when I try listening to theshairport/connection/test
topic on HA nothing is being published. I made sure to rebuild my shairport-sync to include the MQTT config flags and I have the broker addon and integration on HA, so I am fairly sure I am just getting the topic incorrect.