Allow programmatic access to favourited library media items from Home Assistant #2989
jazzyisj
started this conversation in
Feature requests and ideas
Replies: 1 comment 3 replies
-
Recently an option to limit |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The Music Assistant UI is great, but for me the one thing that is currently lacking with Music Assistant is the ability to actually automate playing various media selections efficiently, which for me is kind of the whole point of Home Assistant. I've always had the ability to walk up to a radio, turn it on, and select the station I want to hear.
What I didn't have before HA is the media I want to hear that just automatically just starts playing when I want it to - for example whenever I arrive home. (With the exception of the old timey clock radio alarm in the morning I suppose). These days, when media starts playing in my home it just happens automatically most of the time. However, I would like to be able to (and allow others to ) change what media plays at these times on a fairly regular basis easily and without a hassle.
To accomplish this, in my HA config I have created a system of "media presets" (wake up, morning, sleep, arrive home, music for different scenes etc.) each with their own set of entities and a lovelace card to store the media selections and settings for the preset.
The main stumbling block to doing this efficiently is the inability to programmatically access the library data in MASS from HA. As a stop gap measure I have manually replicated the artist/album/track/playlist/radio items I would like use for my presets with templates. This is rather cumbersome process and must be manually done whenever the underlying data changes (such as adding or deleting a playlist ).
What would be very useful would be the capability to programmatically access the items that have been marked as favourites in the different media categories so these select templates could be automatically populated and kept in sync with the MASS library. I have suggested populating with just the favourite items instead of all library items as I think for many people selects containing the entire library contain a overwhelming quantity of entries. By using library favourites, the user can easily limit and control what items are available in HA media list selections.
This could be accomplished a couple of ways, with 1 probably being the easiest to implement and 2 being the easiest option for the end user.
Allowing access to the MASS library through a REST API to retrieve this data with a REST sensor in HA which can be used to automatically populate the media list templates. I tried doing this with SQL sensors but ran into issues with the database being locked.
Have MASS integration actually create the select entities containing the favourite media list items which would be updated as determined by MASS (e.g. whenever the mass library syncs, update the selects as well). This would eliminate the requirement for the end user to create their own select templates. The data in these entities would of course already be available in HA if the user happens to require it for further use eliminating the need for a separate API calls.
select.mass_artist
select.mass_album
select.mass_track
select.mass_playlist
select.mass_radio_station
*select.mass_media_players
*In addition to the library lists, a select provided by MASS integration that contains a list of the MASS media players would also be very useful as it would eliminate the necessity of the mass media player group and associated automation contained in this package and could be kept in sync by MASS instead of the automation.
And this is how this all can be used - a lovelace card that can select, store, and play selected media in the Home Assistant UI. In my own config, I have several similar cards for each preset which can be played either automatically or manually by clicking the button on the card. I can change the selections and settings for these presets on a whim from the Home Assistant UI. It would just be nice for it all to keep itself in sync with Music Assistant so I don't have to do it manually.
I have created a couple gists with all of the YAML for the lovelace card and package that will create all the entities required for it.
https://github.com/orgs/music-assistant/discussions/2990
BTW - I've noticed a few requests on here that are similar or related that may be at least partially resolved with this feature request.
Here's a couple of them.
https://github.com/orgs/music-assistant/discussions/415
https://github.com/orgs/music-assistant/discussions/834
https://github.com/orgs/music-assistant/discussions/1863
Beta Was this translation helpful? Give feedback.
All reactions