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)