HubAction GET isn't returning anything

I’ve spent hours trying to get this working, and it’s very difficult because SmartThings doesn’t return any debugging data associated with a GET request. (My ultimate goal is to make a PUT request, but I can’t even get a basic GET request to work :confused: )

All I want to do is make a get request to a local server, which returns some JSON. This request is working fine using curl & the browser.

Here’s the code:

// parse events into attributes
def parse(String description) {
  log.debug "Parsing '${description}'"
  // TODO: handle 'lock' attribute


// handle commands
def lock() {
  log.debug "Executing 'lock'"
  sendRequest "true"

def unlock() {
  log.debug "Executing 'unlock'"
  sendRequest "false"

private sendRequest(String value) {

  def headers = [:]

  headers.put("HOST", "")

  def httpAction = new physicalgraph.device.HubAction(
    method: "GET",
    path: "/wemo/devices",
    headers: headers

  log.debug httpAction

  return httpAction

This is what shows in my log:

parse never gets called and data never comes back, and I have no idea if the request is even going out or not.

1 Like

I see you never got a response to this. This is my EXACT problem.


1 Like

@pauby I revisited this again today with:

new physicalgraph.device.HubAction(
  method: "PUT",
  path: "/august/locks/0",
  headers: [
    HOST: "",
  body: [
    locked: true

and it’s finally working. I needed to include the port in the host, for some reason. Unfortunately it’s still not calling the “parse” method, but debugging that is a whole other issue. :confused:

The dni must be either the Mac address for responding device or IP:port in hex. This allows the cloud to route hub replies to the appropriate device handler.

1 Like

Hi @pstuart The DNI is currently set to the Mac address (eg. C1:23:EB:EC:24:11). The documention recommends against using the IP:port:

For dni, we recommend using MAC address and not use IP and port numbers.

According to the documentation
, HubAction takes in a DNI as a paramater, and the default value is null. Maybe passing it in there will work, I’ll have to test this tomorrow.

You can either believe the docs, @jim or you can go with what works.

Remove the : from Mac or go to IP:port in hex and see if it responds.

I do have 3+ years of working with St LAN hubaction.

The reason the docs recommend Mac as dni is because IP addresses change but using Mac it will only parse port 80 responses.

1 Like