Closed fusionstream closed 10 months ago
I made a simple mqtt plugin for musicbee. However It's very quick and dirty which is why I havent released that plugin.
I probably won't release it as I don't really have the time to fix it up to make it OK for releasing it for others to use. Sorry about that :(
Ah. That's a shame.
If you ever get around to changing your mind though, maybe release it anyway as open source; like this one. That way someone could come along and fix it up.
Cheers
I would also be interested in said plugin since MusicBee is my go-to player on PC and would be nice to have it incorporated to HASS for automations (door bell ring etc). Best, io
Any chance this seeing the light of day? No one else seems to have a way to connect MusicBee to Home assistant and this sounds like the best shot we have...
If you're interested in a one-way link (Musicbee -> Home Assistant) I have MusicBee populating a "now playing" type of card in Home Assistant using the Now Playing to External Files plugin. It is not for the faint of heart. Once you've got the data into Home Assistant you can do anything you want with it, like publishing to MQTT.
Overview of my workflow:
MusicBee side (via the plugin):
Home Assistant side:
End result is below/attached:
Hey, I know you probably spent a lot of time with this setup, but I just uploaded the code of what I've been using these past few years over on this repo https://github.com/TroyFernandes/Musicbee-MQTT
I lost the code for the project a long time ago but found a backup recently, but the MQTT package for C# changed a little over the years so I just spent some time updating the code.
If you decide to try the plugin, let me know how (and if) it works for you.
Thanks
This is awesome @TroyFernandes - thank you for coming out of deep retirement to make this available! I am most of the way there but am a tiny bit stuck and hoping you can kick me the rest of the way to completion. Documenting what I've done here for you and anyone else reading this thread:
Working/Done:
Not working:
By what mechanism does the track info & artwork get populated into the HA media player? Do I need to create some sensors manually?
Yes, you'd have to create sensors.
Ill just show you how I have mine setup.
I have a media_player entity in my configuration.yaml with the following:
- platform: mqtt-mediaplayer
name: "Musicbee"
topic:
song_title: "{{ states('sensor.musicbee_song_title') }}"
song_artist: "{{ states('sensor.musicbee_song_artist') }}"
song_album: "{{ states('sensor.musicbee_song_album') }}"
song_volume: "{{ states('sensor.musicbee_player_volume') }}"
player_status: "{{ states('sensor.musicbee_player_status') }}"
album_art: "musicbee/song/albumart"
volume:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\":\"volume_set\", \"args\":{\"volume\":\"{{volume}}\"}}"
status_keyword: "true"
next:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"next\"}"
previous:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"previous\"}"
play:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"play\"}"
pause:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"pause\"}"
and then I have a sensor entity as well with the following:
sensor:
- state_topic: "musicbee/song/title"
name: "Musicbee_Song_Title"
- state_topic: "musicbee/song/artist"
name: "Musicbee_Song_Artist"
- state_topic: "musicbee/song/album"
name: "Musicbee_Song_Album"
- state_topic: "musicbee/player/volume"
name: "Musicbee_Player_Volume"
icon: "mdi:volume-medium"
- state_topic: "musicbee/player/playing"
name: "Musicbee_Player_Status"
icon: "mdi:volume-medium"
I was just missing the sensors - 100% working now! And for anyone else setting this up, they go under your MQTT integration key.
Tomorrow I will take a long look at the hacky solution I documented above, maybe archive it, and then rip it out. : )
Glad its working for you now!
Thanks for this very much appreciated :) Only one hiccup for me here, what kind of sensor do I need for album art? Neither one of these work: mqtt: sensor:
and mqtt: image:
shows artwork fine but not sure how to use it on the mediaplayer entity declaration to show up.
Many thanks again :)
Unlike the text tags, you do not need to create a sensor for the artwork. It is encoded in base64 into an MQTT topic: ...which the mqtt-mediaplayer entity definition in your configuration.yaml can reference directly. In @TroyFernandes's post above, it's this line:
album_art: "musicbee/song/albumart"
Hmm ok I tried setting it up like that as well but still no go. Are you using HAs built in media player entity to display to your dashboard? Maybe I'm missing something GUI wise...
I just verified that yes indeed HA's built-in media player entity is picking up the artwork for me. I personally use mini-media-player which is also picking it up.
Have you tried using MQTT Explorer or something of that nature to verify your MQTT artwork topic is being populated by Musicbee? You may also need to play the next track in musicbee to trigger a publish.
Ah I think I found the issue on the console log, I'm getting error 500 from the nginx proxy addon probably, will have to debug it now..thanks for the help :)
Sorry if this is an ignorant question or indeed if this could be construed as a support question.
But, how does one publish musicbee to MQTT in the first place?