Hello ST developers,
maybe you can help me here,
I am trying to write a Device handler to send REST commands to Rompr.
The commands are sent using POST, and am trying to find how to process the response.
My initial code uses the, new physicalgraph.device.HubAction method , with a callback , hoping to catch the response:
but in the callback, I get no print for the response, so I guess this is not called.
2. I tried to use the def parse(response) , but even there the response is not printed out. see code above.
So how to get the response from my POST call?
3. some code has: log.debug “name”. Other log.debug(“name”) are they both legal?
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
2
What do you mean by register my DNI?
With the new handler, my parse() is still not invoked.
what to do?
Thanks,
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
7
If the callback is working, I’d say stick to that. It’s difficult to get both to work at the same time. There are more advantages to using callbacks, I believe that ST may eventually do away with DNI
Sorry, what is DNI?
is that the parse method?
and another issue:
in my callback I print the object I get, it is not the POST response and the json is missing.
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
9
DNI is the device network id, if you’re using callbacks you don’t need to worry about it. Make sure you dont set device.deviceNetworkId and you pass null for the dni in HubAction.
Refer to my previous post link for a list of available methods for a callback. If’s possible that POST may not return any data unless there’s an error
Here is my current try with a simple GET to / which should respond with a HTML.
but the callback is not ran.
What should be the value of the deviceNetworkId when I first setup the device in my IDE ? the wesite wont allow me to leave it empty, so I tried to put NULL…
Must my code remove value in device.deviceNetworkId ?
And why am I getting no log line with this test