Windows > Third Party Plug-ins, Programs, and Skins
Home Assistant integration for jriver
bob:
--- Quote from: bob on October 01, 2024, 09:47:09 am ---20007,0 should just close the UI if media server is running. I can take a look at that. I know that media server is somewhat different on linux than windows.
--- End quote ---
There isn't a real "server" mode on MC for linux as there is on mac and windows. The mode that best approximates that is when MC is started with the /mediaserver switch. With linux you should probably just minimize the UI instead.
sjhilton:
I've now developed a playlist display for my Home Assistant configuration. The coding is a bit messy as it depends upon creating a sensor for each track (a separate rest call to the MCWS playlist function on my server) and then a further sensor to determine if the sensors should display based on the total number of tracks. I've chosen an arbitrary limt of 20 tracks (as most of my albums wouldn't have more than this). I'm happy to share the code if anyone is interested. Picture attached.
mattkhan:
why do you need a sensor for each track?
Matt:
If there are MCWS functions we could add to make this easier for you, please let us know the details. Thanks.
sjhilton:
Thanks mattkhan and Matt
Let me further explain how I've done this. I'm sure there is likely to be a better way. I do want to emphasise that the approach I've taken is mostly to work around limitations in Home Assistant rather than any issue with MCWS.
I'm calling http://[myserverip]:52199/MCWS/v1/Playback/Playlist?Zone=0&Action=JSON by rest and then creating sensors for each track and then attributes from each of the fields in my database (at the moment this is all of them, but I'll probably cut this back to the ones I actually need as it will fill the home assistant database). This refreshes every 30 seconds.
Each track is a tile card in home assistant. I tried to use the entities card initially, but I couldn't work out how to make this work. I wanted the play icons to be dynamic so that the currently playing track icon would change each time data was called via MCWS and there had been a track change.
I created a further set of sensors as template sensors so that I could determine if each of the track sensors should be displayed or not eg if total tracks in the album is less than or equal to track number the track sensor woud display and if not the relevant track sensor would be hidden.
Edit: I should also have mentioned that I'm using config-template-card add in to code the playlist cards (basically allows for JavaScript to be used in the card).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version