Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force update on media session sensor when a session is in progress #3652

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

dshokouhi
Copy link
Member

Summary

Fixes: #3648 by forcing updates of the sensor when a media session is in progress. I chose to go by Unavailable state as that particular state should only get 1 update.

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@jpelgrom
Copy link
Member

This works, but will cause unnecessary updates if you paused media but the app still has an active media session (which is quite likely if the app is still open in the background). Would it be possible to compare the attributes instead to decide if an update is needed?

@dshokouhi
Copy link
Member Author

This works, but will cause unnecessary updates if you paused media but the app still has an active media session (which is quite likely if the app is still open in the background). Would it be possible to compare the attributes instead to decide if an update is needed?

thats a good point, I wonder which attribute would be best to go. Possibly title ? That seems to be the most unique I think.

@dshokouhi
Copy link
Member Author

actually maybe we need to make it more direct and only on Playing state? the other states I dont see updating too much. Maybe Fast forward and Rewind playback position but thats a very trivial attribute.

@dshokouhi
Copy link
Member Author

Switched the logic as I think it makes the most sense....all other states I would not expect the attributes to update that much if at all.

@jpelgrom
Copy link
Member

Maybe Fast forward and Rewind playback position but thats a very trivial attribute.

The app's sensors also don't really update frequently enough for it to be useful, playing only should be good enough to support the issue's use case.

@JBassett JBassett merged commit 23c35af into home-assistant:master Jul 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Media Session attributes not updating
3 participants