Hubitat.device.HubSoapAction

I am trying to port over the wemo advanced connect smart app and devices. I have finally gotten the Smart App to work and now I am running into some issues w/ the device code. It uses device.HubSoapAction to send commands. Unfortunately I have not been able to find this method in Hubitat. Is it available or is there another way I should be doing this where I don’t have to generate the envelope?

private getSoapRequest(params) {
	def request = new physicalgraph.device.HubSoapAction(
        method: "POST",
    	path: params.path,
        urn: params.urn,
        action: params.action,
        body: params.body,
        headers: [Host: getHostAddress(), CONNECTION: "close"]
    )
    
    log.debug "SOAP Request ID: ${request.requestId} => ${getHostAddress()}${params.path}"
    return request
}

Did you try replacing physicalgraph.device.HubSoapAction() with hubitat.device.HubSoapAction()

1 Like

Yes - I tried that immediately.

startup failed: Script1.groovy: 387: unable to resolve class hubitat.device.HubSoapAction

We do not have that method implemented currently.

Thank you @mike.maxwell - that is what I suspected. Do you have any suggestions other than building out the envelopes and wrapping w/ text to use w/ a HubAction instead?

Nothing other than building it by scratch currently.

So I revisited this without much success…

Here is a simple example of an XML snippet as a multi-line string that when debugging or tracing strips out everything…

def body = '''<?xml version="1.0" encoding="utf-8"?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <s:Body>
            <u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">
					<BinaryState>1</BinaryState>
            </u:SetBinaryState>
        </s:Body>
    </s:Envelope>
	'''

log.trace("body: ${body}")

…and in the live log:

dev:1412018-03-03 20:18:18.055:tracebody: 1

Am I missing something silly? I’ve tried single line, using “”", line endings, concatenation, all w/ no luck.

Has anyone looked at this or been able to confirm? Maybe it is just that I am not experienced but I feel like I am flying blind w/ the very limited dev tools and documentation. Every port turns into a question of is it supported, is it different, is it me, etc. Any help or guidance?

The logging you are seeing is due to a bug with the logging page. The xml is not escaped properly so you won’t see it on the page. are the messages not being sent to device? I myself am using an old wemo driver. Here is the on command from that:

def on() {
log.debug "Executing 'on'"
def turnOn = new hubitat.device.HubAction("""POST /upnp/control/basicevent1 HTTP/1.1
SOAPAction: "urn:Belkin:service:basicevent:1#SetBinaryState"
Host: ${getHostAddress()}
Content-Type: text/xml
Content-Length: 333

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
 <m:SetBinaryState xmlns:m="urn:Belkin:service:basicevent:1">
<BinaryState>1</BinaryState>
 </m:SetBinaryState>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>""", hubitat.device.Protocol.LAN)
}

@chuck.schwer thank you. I have that code as well for the insight plugs and it appears to send the commands but the dimmer code which is slightly different isn’t working and I was hoping to avoid having to specify the xml inline of the hub action everywhere. Dropping in the same code does work properly w/ the dimmer commands. Thanks!