How to change the sound mode on a samsung soundbar : Solution

Hello,
I have a Samsung HW-Q930B soundbar.
I could easily install a media player with

Unfortunately this component does not seem to install the service
Media player: Select sound mode

I would like to know how I can command the change of sound mode with home assistant (and possibly read the active mode.)

Thank you for any help

1 Like

This fork seems to have added that feature GitHub - mimale/Home-Assistant-custom-components-SmartThings-Soundbar: Samsung Smarthings API for controlling Soundbar

Hi @nickrout, Thank you for your interest
I replaced the original with the fork.
This added the sound mode line in the attributes

but the sound mode is still “standard” even if I change it with the remote.
and the “Media player: Select sound mode” service does not works

Pergaps post an issue on the fork’s github.

unfortunately the issue tab does not exist on this fork.

This fork only modify custom_components/smartthings_soundbar/media_player.py but not api.py
I would have to find the API command to change the mode.

COMMAND_SELECT_SOUND_MODE= "{'commands':[{'component': 'main','capability': '????????','command': '????????'}]}"

Does anyone know where I can find this command?

Unfortunately, I think it’s not possible to use the API to change sound mode because the response to api device status is:

{
   "main":{
      "mndt":{
         "value":"2022-01-01"
      },
      "mnfv":{
         "value":"HW-Q930BWWB-1010.0"
      },
      "role":{
         "value":"None"
      },
      "mnhw":{
         "value":""
      },
      "detailName":{
         "value":"External Device"
      },
      "data":{
         "value":"None"
      },
      "di":{
         "value":"da93855b-45cd-6ca0-86d6-XXXXXXXXXX" // I masked the device id
      },
      "supportedPlaybackCommands":{
         "value":"[\"play\",\"pause\",\"stop\"]"
      },
      "supportedInputSources":{
         "value":"[\"digital\",\"HDMI1\",\"bluetooth\",\"wifi\"]"
      },
      "channel":{
         "value":"None"
      },
      "mnsl":{
         "value":"None"
      },
      "dmv":{
         "value":"res.1.1.0,sh.1.1.0"
      },
      "switch":{
         "value":"on"
      },
      "mode":{
         "value":"10"
      },
      "vid":{
         "value":"VD-NetworkAudio-002S"
      },
      "mnpv":{
         "value":"6.5"
      },
      "icv":{
         "value":"core.1.1.0"
      },
      "st":{
         "value":"1970-01-01T00:00:29Z"
      },
      "totalTime":{
         "value":"0"
      },
      "playbackStatus":{
         "value":"stopped"
      },
      "mute":{
         "value":"unmuted"
      },
      "n":{
         "value":"Samsung Soundbar Q930B"
      },
      "volume":{
         "value":"17",
         "unit":"%"
      },
      "mnmo":{
         "value":"HW-Q930B"
      },
      "mnmn":{
         "value":"Samsung Electronics"
      },
      "mnml":{
         "value":"None"
      },
      "mnos":{
         "value":"Tizen"
      },
      "pi":{
         "value":"da93855b-45cd-6ca0-86d6-XXXXXXXXXX" // I masked the device id
      },
      "inputSource":{
         "value":"digital"
      },
      "masterName":{
         "value":"None"
      },
      "status":{
         "value":"None"
      },
      "audioTrackData":{
         "value":"{\"title\":\"\",\"artist\":\"\",\"album\":\"\"}"
      },
      "elapsedTime":{
         "value":"0"
      }
   }
}

There is apparently nothing about the sound mode

If we interrogate a 8 serie Samsung TV, we find

                ...
                "soundMode": {
                    "value": "Standard",
                    "timestamp": "2021-05-16T13:16:33.246Z"
                },
 

But nothing here

This is what should have worked

        elif cmdtype == "selectsoundmode":  # changes sound mode
            API_COMMAND_DATA = "{'commands':[{'component': 'main','capability': 'SoundMode','command': 'setSoundMode', 'arguments': "
            API_COMMAND_ARG = "['{}']}}]}}".format(argument)
            API_FULL = API_COMMAND_DATA + API_COMMAND_ARG
            cmdurl = requests.post(API_COMMAND, data=API_FULL, headers=REQUEST_HEADERS)

this forum post found an answer to do it:

{
   "commands":[
      {
         "component":"main",
         "capability":"execute",
         "command":"execute",
         "arguments":[
            "/sec/networkaudio/soundmode",
            {
               "x.com.samsung.networkaudio.soundmode":"standard"
            }
         ]
      }
   ]
}

i checked my app and these should work for mine (QW950T)

    "x.com.samsung.networkaudio.soundmode":"surround"
    "x.com.samsung.networkaudio.soundmode":"game"
    "x.com.samsung.networkaudio.soundmode":"adaptive sound"

@jeroen.nijssen
Thanks to you, I forked mimale repository.
This works with my Q930B soundbar

I checked with the Media player service: Select sound mode

I also added sound_mode and sound_mode_ list attributes

2 Likes

I added control of Night mode, Bass boost and Voice amplifier

image

1 Like

This is excellent thank you! I previoulsy spent hours (months) trying to get it to work with the HTTP GET API.

just one thing this link on the repo sends you to the orginal GIT not your fork, that gave me a headache for a little while

Manual

To install this integration manually you have to download smartthings_soundbar.zip and extract its contents to config/custom_components/smartthings_soundbar directory:

EDIT:
Confirmed working with the Q900A

@mitchell
thank you for your remark I modified the link in the README.md

Hi,
I improved and simplified the creation of a soundbar device. Now creating a new device, will automatically create a media player and 3 switches
The link is post 7
entities_card

Hi Theirry,

I am very new to HA having switched from ST after my hub died. I found your fork when looking for a way to control my HW-S60T sound bar

I have added the repo through HACS and downloaded it.

When I try yo add the integration I get the message about adding the device manually

I have tried adding the code in the readme to my config.yaml using the token I created and the device ID I found on my.smartthings.com in Advanced Users, but the devices is not appearing after. restart. What might I be doing wrong?

Thanks

Not posting your logs is wrong :slight_smile:

That’s helpful. As my first ever post here said “i am very new to HA’ so please forgive my ignorance for not being an expert within the first week…

Just post the logs. You ask for help, you get told how we might be able to help.

I hope this explains further. How to help us help you - or How to ask a good question

Ok maybe I missed the humour in your reply. Thanks for the link I will have a read and go in search of the logs.

Just to make sure I hadn’t done something stupid I removed the integration completely and started over. Followed the instructions again with the same result - no device gets created.

I downloaded and searched my logs and the only mention of the integration was:

2023-08-03 21:11:54.392 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration samsung_soundbar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

However, I noticed the links in the instructions were to the old token and Smartthings backend which have now been deprecated but it appears the API calls are still the same so probably irrelevant

Thanks for the link. I read section 13 on logs and have a question if I may? When it says custom components can only be seen in the logs on disk am I right to assume that means the file you get when clicking “download full log”? These are the ones I am referring to in the post above

The log named /config/home-assistant.log