samuelspagl / ha_samsung_soundbar

YASSI (Yet another Samsung Soundbar integration) is a HomeAssistant integration for Samsung Soundbars.
https://ha-samsung-soundbar.vercel.app
MIT License
42 stars 2 forks source link

[BUG]: media_player not showing source and sound mode #11

Closed Headkillah closed 8 months ago

Headkillah commented 9 months ago

If i look in the soundbar integration i can see wich source and wich sound mode are active.

But if i click at the control elements on the external device (the media_player) it doesn´t show me the source / sound mode in the popup. Please look at the screenshot what i mean (outlined in red).

And further the calculation of the volume level in this view is not correct. (outlined in yellow) yassi_errors

samuelspagl commented 9 months ago

I'll take a look at it this evening.

How is the current volume level in this view not correct? :)

Headkillah commented 9 months ago

It's not correct because the level is at 6 and max vol is 30 ;) The volume sensor is showing correct value :)

samuelspagl commented 9 months ago

Did you set a max volume ?

Headkillah commented 9 months ago

Yes trough Setup, 30 max.

samuelspagl commented 9 months ago

Sorry the late response, for some reason I didn't get a notification.

So yeah that explains the issue. What you're describing is basically a scaling issue:

The slider of the media_player is defined as a float between 0 and 1 and displayed from 0 to 100. As the maxVolume is 30, this slider is scaled from 0 to 30. (1 being 30). Therefore the value of the slider is different than what the sensor is showing (the real value).

The only solution for that would be to set maxVolume to 100.

Headkillah commented 9 months ago

Okay, thx for the informations. Will test it. Did you have found a solution for the problem with the source/ sound mode?

samuelspagl commented 9 months ago

So I ran some tests on my end, and didn't have the same findings as you regarding those two.

On my system it is displayed correctly. Right after starting the soundbar it takes some time until its mapped correctly, but like I mentioned for me it picked it up correctly.

Has it ever displayed it correctly?

Headkillah commented 9 months ago

hmmm....

Has it ever displayed correctly?

On my system only the entities "input_preset" and "sound_mode_preset" are showing the correct values, but NOT the "media_player.name_of_soundbar" entity itself. It's not really bad but would be nice if it was displayed there :)

samuelspagl commented 9 months ago

Okay, at last I understood what you meant. The new commit in the PR should fix it. I checked it on my local instance and it seemed to work.

samuelspagl commented 9 months ago

@Headkillah do you want to check it out? :)

One note to the "input source" part. If you are playing something with Spotify directly on the Soundbar, it will not list anything in the input_source as the API returns null there

Headkillah commented 9 months ago

@Headkillah do you want to check it out? :)

One note to the "input source" part. If you are playing something with Spotify directly on the Soundbar, it will not list anything in the input_source as the API returns null there

Thx for that info :)

In my example the source is HDMI 1 (playing Disney+) so it should be have to show the input source, right?

And the sound mode is adaptive sound, so I should see it there? :)

samuelspagl commented 9 months ago
Bildschirmfoto 2024-01-15 um 14 44 21

It looks like this now on my local instance.

You should see the correct sound_mode as well as the input source.

Headkillah commented 9 months ago

Looks good on screenshot :) Upload the changes and i will test it asap.

samuelspagl commented 9 months ago

@Headkillah the changes are already uploaded to the existing branch :)

Headkillah commented 9 months ago

@Headkillah the changes are already uploaded to the existing branch :)

I'm working in a quality assurance department and test software, but maybe im dumb today. I've downloaded again the files from the main-branch, copied everything to the right places, changed the sensor thingy. BUT it looks like in my first screenshot. I see the right values only on the integration entry, look following screenshot.

soundbar_scrsht

samuelspagl commented 9 months ago

@Headkillah Now I'm probably a bit dumb today. I don't know what the issue is in your image 😅 😂

samuelspagl commented 9 months ago

This is the change that should make it work: media_player.py

Headkillah commented 9 months ago

@Headkillah Now I'm probably a bit dumb today. I don't know what the issue is in your image 😅 😂

I have to answer faster :D (Vielleicht sollte ich es auf deutsch erklären ;o))

When I go to your soundbar integration, I can see under Controls that everything is displayed correctly (see screenshot 1 )

However, if I now call up the soundbar entity "media_player.barry" under Devices and Services, which is called "barry" in my case, then it is displayed as shown in this screenshot 2

samuelspagl commented 9 months ago

@Headkillah Maybe wäre das möglich :D, But true developers only talk in english xD

Okay let's leave the jokes aside. Could you go to Developer Tools and States and search for your media_player._______ entity and show me what its attributes are while the device is turned on :)

Headkillah commented 9 months ago

@samuelspagl

Hope that information is good enough because I have only access through the companion app...

Or do you need more infos?

Screenshot_20240118-100813_Home Assistant.jpg

samuelspagl commented 9 months ago

I need the whole list for this entity :) sorry.

sound_mode and source should be there two times.

Dont forget to blurry the device ID and other personal information when sharing the whole state.

Headkillah commented 9 months ago

I forgot to mention something important: I have a Fire TV Stick in the HDMI 1 port in the soundbar, everything runs via this.

source_list:
  - digital
  - HDMI1
  - bluetooth
  - wifi
  - HDMI2
sound_mode_list:
  - standard
  - surround
  - game
  - adaptive sound
status: "on"
device_information:
  model: HW-Q995B
  manufacture: Samsung Electronics
  firmware_version: HW-Q995BWWB-1010.0
  device_id: xxxxxxxxxxxxxxxxxxxx
volume:
  level: 0.16666666666666666
  muted: false
woofer:
  level: 6
  connection: "on"
source:
  active_source: HDMI1
  supported_sources:
    - digital
    - HDMI1
    - bluetooth
    - wifi
    - HDMI2
sound_mode:
  active_sound_mode: adaptive sound
  supported_sound_modes:
    - standard
    - surround
    - game
    - adaptive sound
advanced_audio:
  night_mode: false
  bass_mode: true
  voice_amplifier: true
equalizer:
  active_preset: NONE
  supported_presets:
    - NONE
    - POP
    - JAZZ
    - CLASSIC
  action: setEQmode
  bands:
    - "0"
    - "0"
    - "0"
    - "0"
    - "0"
    - "0"
    - "0"
media:
  media_title: ""
  media_artist: ""
  media_cover_url: ""
  media_duration: 0
  media_position: 0
device_class: speaker
friendly_name: Barry
supported_features: 89485
volume_level: 0.16666666666666666
is_volume_muted: false
media_duration: 0
media_position: 0
media_title: ""
media_artist: ""
app_name: External Device
entity_picture: >-
  /api/media_player_proxy/media_player.barry?token=7006339a06bc508f0911dc935767cc156e9bd5a4ddd07ead99906edb3cb2545d&cache=e3b0c44298fc1c14
samuelspagl commented 9 months ago

Hmn interesting, it looks a bit different.

Can you try to comment this part in the media_player.py

    @property
    def extra_state_attributes(self) -> Mapping[str, Any] | None:
        return {"device_info": self.device.retrieve_data}

Then restart your instance and take a look at it again :)

Headkillah commented 9 months ago

@samuelspagl YEAH👍 now it looks right 🥳

Unbenannt

samuelspagl commented 9 months ago

@Headkillah Interesting... It works for me even tho these lines are not commented. Which Ha version are you using? :)

Headkillah commented 9 months ago

I'm running HA on Proxmox version is 2024.1.3.

samuelspagl commented 8 months ago

Hi @Headkillah I hope everything works fine on your end. JFYI, I'm gonna release the fix officially this week. If there's an issue still persisting just ping me :)

samuelspagl commented 8 months ago

Closed as #9 was merged.

Headkillah commented 8 months ago

Hi @samuelspagl

Yes, sorry for late answer. Everything works like a charm now. Thanks for your hard work :)