Create "Smart App" that can switch inputSource on my Samsung soundbar (HW-N950/N960)

My Harmony hub has to input cycle to pick inputs on my older TV. One of my gripes is if the power goes off to the Harmony then it loses it’s place and we have to manually set the TV input the first time we use it again. Not too much trouble for me, but the wife struggles with it.

1 Like

The soundbar difinately supports direct switching. If I use the iOS app called “SmartThings”. The remote that is included with the soundbar looks like this:

As you can see it only has one source button, and when I press it I do not get a menu on my TV. It cycles.

Yeah, I would like to contact Logitech about this, but not until I have absolutely a clear mental image of what is possible and what needs to be done.

I do not have one of those unfortunately. I would like to try solve this with what I have before I start spending on stuff :slight_smile:

Plus… speaking with my soundbar is not what I had in mind. In the end I want to add functionality to the Harmony. So I need to be able to create a script on my computer that does it (or ask Logitech to solve it).

Yeah. It is unacceptable to me. This has to work for the entire family without being a soup of anxiety.

Ok @atrus, At first I couldn’t believe this was still a thing with modern gear… so I first actually ‘added’ your device to my Harmony setup and then looked up your device - and - WOW. (Had this been my setup - this thing would go back to the store, but it’s not, so…)

You’re no the only person complaining about this issue. Both this and the K950 do the same thing. A lot of people were waiting for a firmware from Samsung they hoped would expose those commands, alas, no.

There IS hope though. Go read this thread on the Harmony forums in its entirety:

Near the end of the thread there are two potential workarounds that should get you reliable device switching. It requires considerable readjustment of the input commands and timings for that device in Harmony - but it should get your activities to become ‘reliable.’

Once you have reliable activities, you can start using those in ST.

Good luck!

1 Like

There is no issue with the speaker as it supports that out of the box via Rest API. The only mess is that smartthings/samsung does not fully support their own products, but Sonos and Bose. With the Multiroom apps you can control Samsung soundbars and Samsung multiroom speaker completely.



For openhab there some guy trying to create a binding

var URL = ""
switch Command {
	//Input mode
	case "setOptical" : URL = '/UIC?cmd=%3Cname%3ESetFunc%3C/name%3E%3Cp%20type=%22str%22%20name=%22function%22%20val=%22optical%22/%3E'
	case "setBluetooth" : URL = '/UIC?cmd=%3Cname%3ESetFunc%3C/name%3E%3Cp%20type=%22str%22%20name=%22function%22%20val=%22bt%22/%3E'
	case "setWifi" : URL = '/UIC?cmd=%3Cname%3ESetFunc%3C/name%3E%3Cp%20type=%22str%22%20name=%22function%22%20val=%22wifi%22/%3E'
	case "setHDMI" : URL = '/UIC?cmd=%3Cname%3ESetFunc%3C/name%3E%3Cp%20type=%22str%22%20name=%22function%22%20val=%22hdmi%22/%3E'
	case "setAux" : URL = '/UIC?cmd=%3Cname%3ESetFunc%3C/name%3E%3Cp%20type=%22str%22%20name=%22function%22%20val=%22aux%22/%3E'
	case "setRadio1On" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=0/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%221%22/%3E'
	case "setRadio1Off" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=0/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%220%22/%3E'
	case "setRadio2On" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=1/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%221%22/%3E'
	case "setRadio2Off" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=1/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%220%22/%3E'
	case "setRadio3On" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=2/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%221%22/%3E'
	case "setRadio3Off" : URL = '/CPM?cmd=%3Cname%3ESetPlayPreset%3C/name%3E%3Cp%20type=%22dec%22%20name=%22presetindex%22%20val=2/%3E%3Cp%20type=%22dec%22%20name=%22presettype%22%20val=%220%22/%3E'
	case "setAutoRadio" : URL = '/UIC?cmd=%3Cname%3ESetRadioAutoPlay%3C/name%3E%3Cp%20type=%22str%22%20name=%22cpname%22%20val=%22%s%22/%3E%3Cp%20type=%22dec%22%20name=%220%22%20val=%22%s%22/%3E'
	case "getMusic" : URL = '/CPM?cmd=%3Cname%3EGetRadioInfo%3C/name%3E'
	case "setNext" : URL = '/CPM?cmd=%3Cname%3ESetSkipCurrentTrack%3C/name%3E'
	case "setPrev" : URL = '/CPM?cmd=%3Cname%3ESetPreviousTrack%3C/name%3E'
	case "setPlay" : URL = '/CPM?cmd=%3Cname%3ESetPlaybackControl%3C/name%3E%3Cp%20type=%22str%22%20name=%22playbackcontrol%22%20val=%22play%22/%3E'
	case "setPause" : URL = '/CPM?cmd=%3Cname%3ESetPlaybackControl%3C/name%3E%3Cp%20type=%22str%22%20name=%22playbackcontrol%22%20val=%22pause%22/%3E'
	case "setReapeatOn" : URL = '/"UIC?cmd=%3Cname%3ESetRepeatMode%3C/name%3E%3Cp%20type=%22str%22%20name=%22repeatmode%22%20val=%22on%22/%3E%22'
	case "setReapeatOff" : URL = '/"UIC?cmd=%3Cname%3ESetRepeatMode%3C/name%3E%3Cp%20type=%22str%22%20name=%22repeatmode%22%20val=%22off%22/%3E%22'
	case "setShuffle" : URL = '/CPM?cmd=<name>SetToggleShuffle</name><p type=\"dec\" name=\"mode\" val=\"%s\"/>'

var Return = sendHttpGetRequest(URL)

Also here in the smartthings community there are some guys trying to bring more functionality in that is unfortunately not done by Samsung officially.

Unfortunately the HMI of the smartapp below also only has a source toggle implemented (maybe you can request this feature from the DEV):

BUT it is really disappointing Samsung does not make the most or even anything out of their product range and provides the best integration for own products.

1 Like

Bloody heck. I solved it. I am now able to set the source with a URL command. The OpenHAB post led me down the right track. It took a lot of hours because unfortunately the command I picked as a test was one which had an “error” in it (not really an error per se, just poorly described to be incomplete).

So now I know this is possible. The only thing that remains is to pick the least error prone and speediest way of talking to soundbar. At the moment I am building a shell script which I will have one my media center computer, which I then trigger from my Logitech Harmony. I have a Flirc USB stick ($20) attached to that computer, which means I can simply tell my Harmony to send a button press which triggers a keyboard shortcut I have designated in my OS (in my case Mac OS X). And that keyboard shortcut in turn triggers the shell script.

Can’t wait to get home and start doing this, I am soooo happy I will be able to work around the one huuuge drawback of this really well-sounding soundbar.

1 Like

@atrus were you able to hit your HW-N950 on port 55001? Or what port did you use? I’m pretty sure i’m hitting the correct address but am not getting a response from 55001 which was referenced on those OpenHAB posts. Thanks.

@atrus I’m confused about this as well.
How did you connect to the soundbar in order to control it via HTTP?

I found the following open ports on my device, but none of them seem to give me access to anything like REST:

7676/tcp open imqbrokerd
8080/tcp open http-proxy
8187/tcp open unknown
9197/tcp open unknown
15500/tcp open unknown
19999/tcp open dnp-sec
55000/tcp open unknown
56001/tcp open unknown

Use 56001 instead :slight_smile:

1 Like

Hit it with whatever you want. I use Siri (via Shortcuts) sometimes, but you can use a browser even. Something like this:<name>SetFunc</name><p%20type="str"%20name="function"%20val="hdmi2"/>

Just change the IP in the beginning. When you hit enter in your browser your N950 should switch to HDMI2. If you are on HDMI2 already, nothing will happen.

@atrus Thanks, I’ve got it working now.

I created a virtual switch but am having a hard time figuring out how to map the switch to HDMI 1 on the Soundbar. Any help is greatly appreciated!

Sorry, I do not know how virtual switches work in SmartThings.

Thanks for the reply. How did you get the manage to switch inputs via SmartThings?

I don’t. I trigger the URL from my Harmony remote. Or from a browser. Or from a script on my computer. Depends.

It’s been awhile, but I seem to recall “training” my Harmony One to recognize the discreet inputs for a “Source” button. Press the button once and aim at the remote for the first setting, cycle though back to the beginning, press the button once and then aim at remote for the second press, cycle through again to the beginning, do two button presses and then aim at remote for the third press and so on. I can’t guarantee it’ll work for you, but it’s worth a try.

Add your computer as a device to an activity. I added my Mac Mini. I choose one of the OSX shortcuts as button press trigger, and then in OSX I mapped that shortcut (CMD-X for example) to run a script which in turn triggers the URL.

I was able to get this working. Used the URLs and then used virtual buttons to launch each of the urls. I then authorized the devices through the Harmony/Smarthings connect. Through a button press, I can switch to the correct input and I can add them into the activities. It now works perfectly.

For anyone wanting to use the virtual buttons here is the link:


Do you need a SmartThings hub for this to work with an internal IP?