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

Media Session attributes not updating #3648

Closed
Erelen-Laiquendi opened this issue Jul 9, 2023 · 3 comments · Fixed by #3652
Closed

Media Session attributes not updating #3648

Erelen-Laiquendi opened this issue Jul 9, 2023 · 3 comments · Fixed by #3652
Labels
bug Something isn't working sensor-tracking

Comments

@Erelen-Laiquendi
Copy link

Home Assistant Android app version(s): 2023.6.0-full

Android version(s): 9, 10, 11

Device model(s): Samsung Note 9, S9, Lenovo P10, Sony X1

Home Assistant version: 2023.6.3

Last working Home Assistant release (if known): -

Description of problem, include YAML if issue is related to notifications:
sensor.<>_media_session updates only if state change (play -> pause, etc). There is no way to receive new attributes (title_*, playback_position_* etc) - neither in 15 minutes updates, nor using command_update_sensors.
So, after several hours non-stop playing music on phone, in HA I still see first track info.

Companion App Logs:


Screenshot or video of problem:

Additional information:

@Erelen-Laiquendi Erelen-Laiquendi added the bug Something isn't working label Jul 9, 2023
@dshokouhi
Copy link
Member

did you make sure to add your media player app to the allow list for the notification sensors?

its part of the recommendations in the docs

https://companion.home-assistant.io/docs/core/sensors#media-session-sensor

@Erelen-Laiquendi
Copy link
Author

did you make sure to add your media player app to the allow list for the notification sensors?

I don't use "Last notification" sensor at all.
"Media session" sensor - is ok for my task, if I can get actual info when I need it by sending command_update_sensors.

forceUpdate = primaryPlaybackState == "Playing"

Hm...
I pause player, when it playing "Song A". In next sensor update (every 15 minutes or by command) I receive in Media Session sensor. After that I switch player to "Song B" and pause it again. As I understand, in this case I never can receive "Song B" to HA sensor.

@dshokouhi
Copy link
Member

"Media session" sensor - is ok for my task, if I can get actual info when I need it by sending command_update_sensors.

in the case of media players they must post a notification with media data, by using the last notification sensor you will get updates immediately upon changes. We mention that in the docs linked.

I pause player, when it playing "Song A". In next sensor update (every 15 minutes or by command) I receive in Media Session sensor. After that I switch player to "Song B" and pause it again. As I understand, in this case I never can receive "Song B" to HA sensor.

When something is paused the likelihood of it changing is very low. We need to be mindful of the amount of updates we send out. Next time you go to play the item it will update. The likelihood of the same item being paused for hours sending the same update is a lot higher than something being paused with attributes changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sensor-tracking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants