Samsung Speakers

Does anyone have Samsung speakers working with Hubitat? I see in the Rule Machine documents under the Custom Commands section it uses an example of a playTrackandResume for a Samsung Speaker, but i can’t see how to discover these devices. Anyone have a driver or can explain what i am missing? Thanks…

We don’t support them at this time.

Stay tuned. I am planning on porting my Service Manager / Device Handler from SmartThings. (It is actually more powerful than the "official" LAN SamsungAudio integration (provides input control and the ability to create presets and group speakers.) Number 2 on my list (next is a test to see if I can control the TP-Link devices directly rather than through a node.js hub).

I say this because I may need some help. I just installed my Hubitat on Tuesday. My experience is porting over my TP-Link plug, switch, and bulb integration (which now works).

There are two communications commands. I will probably need most help porting over the SOAP command (used on the MS-series soundbars (HW-MS650). It will take quite a while. Over 2K lines of groovy.


I'm actually interested to see if this could be included in Hubitat nativly, can you share a link to your integration?, I would like to have a look at it.

Yes. My SmartThings code is located at: GitHub - DaveGut/Samsung-WiFi-Soundbar-Speaker-with-SmartThings-Integration: Control of a group or single Samsung Multiroom Speakers in SmartThings

It is actually very complex since I wanted to actually control the speakers and soundbars w/o having to open the multi-room app. It incorporates preset player channels, preset group and ungroup, as well as text-to-speech and audio notification. It can be readily simplified to delete the preset functions (channels and groups). However, will then have to refix the audio notification and tts to work properly with grouped speakers.

The Hubitat port is in-work. I actually have the installation app working great (related to page refresh) that has an acceptable work-around. I am sending commands to the speakers; however, the parse function in Hubitat for drivers works differently than SmartThings, something will have to change. Have to parse since I am highly dependent on parsing to get channel radio information.

When done, Hubitat may use the code as they see fit. Be aware that there are actually two versions of the Samsung firmware. Most commands are the same; however, some stark differences:

  1. The MS-series soundbar (SoundPlus) include the UPNP Media Renderer capability. Speakers and older soundbars do not.
  2. The older soundbars and speakers have a special command to play url audio. Not available on the MS-series.

These are embedded within my code.

1 Like

Update. Comms are working and most functions appear to work.

I have decided to create three versions of the driver:

Basic Music Player - Music player functions with abilities similar to Sonos player. Enhanced with the device controls (on/off, inputSource, equalizer preset, shuffle/repeat modes), audio notification, and text-to-speech.

Player Control - Basic Music Player plus Presets. Uses the Samsung Multiroom App as a set up assistant, then can play channels without going to Multiroom. (In SmartThings, I can get TuneIn, iHeartRadio stations, 8Tracks, Pandora music streams, and Amazon playlists.)

Group Speaker - Player Control plus Group Presets and controls.

1 Like

Mike, I need some help. I have the Speakers basic functions working well; including Audio Notification and TTS. The MS-Series soundbars are different. They use the UPNP AVTransport (the same as the Sonos) to implement the Audio Notificaiton (do not have the SetURLPlayback command). UPNP is kicking me hard.

To call the uri playback, i use the stream:

		def result = []
		result << sendUpnpCmd("SetAVTransportURI", [InstanceID: 0, CurrentURI: trackUri, CurrentURIMetaData: ""])
		result << sendUpnpCmd("Play")

But I can not get the other end to work. I have tried a lot of things, and the log of the sent command is identical to what I see on the platform that shall remain nameless.

If you can, would you provide us an example of the sendUpnpCmd equivalent from the Sonos integration. From that example, I should be able to finish the testing and get the first version out.


the long parameter version should be something like this:

def sendUpnpCmd(String action, String service, String path, Map body=[InstanceID:0, Speed:1]){
    def cmdPath = path ?: "/MediaRenderer/${service}/Control"
    def hubAction = new hubitat.device.HubSoapAction(path:"${cmdPath}", action:"${action}", urn:"urn:schemas-upnp-org:service:${service}:1", body:body, headers:[HOST:"${getHostAddress()}"])
    return hubAction
1 Like

Thanks, Mike. I modified for the speaker and tried. I did comms testing using my PC as a surrogate speaker and Wireshark. The results may indicate a problem with the hubSoapAction implementation.


a. Command would not fire comms from driver code,
b. Went to application. Command fired code to surrogate. Did not work on speaker (HTTP 500 error)
c. Checked SmartThings current code. Worked as expected.
d. Compared wireshark results for each. Aside from "Hubitat", only difference was the "\n" after header lines from Hubitat. It was "\r\n" from SmartThings.
e. Created manual "SOAP" (at bottom) in app, including the \r\n code. WORKED (Code below.
f. To confirm, I removed the "\r" from the manual code. DID NOT WORK.

Below is the test code I used in my Applicaion

def sendUpnpCmd(String action, Map body=[InstanceID:0, Speed:1]){
    def host = ""
//	host = ""
    def path = "/upnp/control/AVTransport1"
    def urn = "urn:schemas-upnp-org:service:AVTransport:1"
    def xmlBody ="""<InstanceID>0</InstanceID><Speed>1</Speed>"""
    if (action == "SetAVTransportURI") {
        xmlBody = """<InstanceID>0</InstanceID><CurrentURI>${body.CurrentURI}</CurrentURI>""" +
    def content = """<?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="" s:encodingStyle="">""" +
        """<s:Body><u:${action} xmlns:u="${urn}">${xmlBody}</u:${action}></s:Body></s:Envelope>"""
    def contentLen = content.length()

    def hubCmd = new hubitat.device.HubAction("""POST ${path} HTTP/1.1\r\nAccept: */*\r\n""" +
                                              """Host: ${host}\r\nUser-Agent: Linux UPnP/1.0 Hubitat\r\n""" +
                                              """Connection: close\r\nSOAPAction: "${urn}#${action}"\r\n""" +
                                              """Content-Type: text/xml; charset="utf-8"\r\n""" +
                                              """Content-Length: ${contentLen}\r\n\r\n${content}""",
                                              hubitat.device.Protocol.LAN, "D8E0E1B5D2AF", [callback: special])

UPDATE: Transferred the above to the device driver. It worked, except (as expected) I had to remove the "sendHubCommand" and CALLBACK does not work (response goes to the "parse" method only.

Hi just wanted to chime in here. I experienced something similar. I do not know if it related. Figured I'd post it here.

I changed a momementary http switch driver slightly I believe to not use hubcommand.

Thank you, we've added an issue in our bug tracker for this.

Need some help.

On the Samsung Speakers, the GetMainInfo command returns 2 http messages. The first one is say the data was requested. The second one actually provides the data.

Problem: How do I capture the second message in Hubitat so that the data can be parsed?

Find something that exists in the data message that you need and ignore everything else.

I have completed an initial integration. Only one shortfall - Master Volume. I have to figure out how to id the speakers in the group to the master. I think it can be done; however, will take some research.

You are welcome to use or modify this code for any purpose.



This will be fixed in release 1.0.9

Checked it out and it works GREAT!. Thanks.