Interestingly the media last position updated time/date seems to update on some players even when they havenât been used, not sure if it could have been to do with a software update though, havenât put music on in the master bed for weeks.
Here are all my media players - majority I used yesterday,
media_player.master_bed (seporate) - not used for weeks
state: paused
volume_level: 0.17
is_volume_muted: false media_content_type: music media_duration: 0 media_position: 0
media_position_updated_at: 2018-10-28T10:10:06.552717+00:00
media_title:
media_artist:
deck (separate) used yesterday afternoon
state: paused
volume_level: 0.49
is_volume_muted: false
media_content_type: music
media_duration: 129
media_position: 0
media_position_updated_at: 2018-10-28T06:22:10.630788+00:100:
I added an option to âconsider the player offâ after x amount of time since media_position_updated_at.
I could only try this out with my Chromecasts and mock-up data but it seems to work.
However I saw that media_position_updated_at sometimes wouldnât update frequently even during playback. However this shouldnât be an issue if âx amount of timeâ is set to at least 5 minutes or something.
And then thereâs the disadvantage of not being able to resume the playback from the card again if itâs considered off.
Sorry if this was confusing
Would be great if you could try this out with your Sonos for a few days.
You can grab the updated mini-media-player.js code here. replace your existing
Change your card reference to something like this (make sure the url path is correct)
@kalkih@Stewface
I have made some changes to the css part of the js file so the player looks like this when state is paused.
The only button that works in this case is the Play button.
Just suggesting this as an option
This way you also know which music is going to start playing when you hit the Play button
Iâm not sure if Iâm doing something wrong, or if this is an unintended use case, but this card doesnât play nice with the entity-filter card. Iâm trying to only show the card when something is actually playing, as I have several media players and things get cluttered quickly.
I think though @gerard33 is really onto something - my next wishlist for improvements would be for when its goes into off mode:
include play icon so you can restart it (move next to down arrow to show sources if at all possible) or replace the icon with a play button
show the previous track that was playing in a softer grey - highlight further its ânot activeâ
hide volume control and track buttons
Working thus far Getting more closer and closer to moving away from the sonos app - the next challange is how to group / ungroup rooms in the hass front end.
Although the power button doesnât seem to function for a sonos, we might need an option to just swap that for a play icon. Then just add the current track name underneath the media player name and it would be perfect!
Sensational work on this update! Now my front end wont be flooded with all my media players!
@kalkih Home Assistant Core needs a new Media Player. Have you though about contributing this to the core? You did a hella nice job on the sensor card. Like to see more of your work on the core features
@kalkih - actually, turns out the power button does work for one of my players. not sure why it doesnât work for another one. (bathroom didnât work, but family room did)
I am guessing if we just add the power button to the view when you have multiple players grouped that would avoid having to change it to much as it just expands from thereâŠ
@gerard33 Nice solution, I think we could end up with something great if we combine our ideas.
@Stewface Thanks for the feedback. I love the points in your wishlist and they are certainly possible to implement, Iâll take a stab at it when I got time!
I wonât push betas to the tracker, the code there is really just for testing, and might not work as expected. If you want to try it youâll have to update the card manually.
Thank you sm for your kind words. Possibly in the future, if people would like that, I still have some things I want to get done first though!