Hi all, I know there has been a few posts on this but im trying to traverse the minefield of HubAction. I understand there has been a many issues surround the use of it but I dont know if they are still relevant. There have been number of consistent people helping out but im still unable to piece together the jigsaw.
Essentially I have a bit of code and im struggling to get the response from it.
def result = new physicalgraph.device.HubAction("""${method} ${uri} HTTP/1.1\r\nHOST: ${settings.ip}:${settings.port}\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}")
log.debug "Result: ${results}"
The log.debug is returning āResult: NULLā where im expecting a response from my API Server. Iām a bit unsure on where to go from here and if I can go anywhereā¦
This gave me ā0a5154b7:1f40ā=10.81.84.183:800 - my api server. I have manually set when adding the device but im still not getting anything back. I read somewhere there was a bug with 10.x IPās is this still the case?
and the typical response is in json eg:
{
āSENSOR_SELECTIONā: āBUILT_IN_AIR_SENSORā,
āENABLE_ZONEā: false,
āCRADLE_PAIRED_TO_STATā: false,
āLOCKā: false,
āENABLE_VALVEā: false,
ā¦
I Finally got it working using the IP:Port in HEX. I tried the MAC method and noticed my device was no longer turning on/off. This was due to me testing loads of different methods of HubAction.
The one that worked for me was: sendHubCommand(new physicalgraph.device.HubAction("""${method} ${uri} HTTP/1.1\r\nHOST: ${settings.ip}:${settings.port}\r\n\r\n""",physicalgraph.device.Protocol.LAN,"${deviceNetworkId}"))
This is what i had it set as previously, which didnt work: results = new physicalgraph.device.HubAction("""${method} ${uri} HTTP/1.1\r\nHOST: ${settings.ip}:${settings.port}\r\n\r\n""",physicalgraph.device.Protocol.LAN,"${deviceNetworkId}")
One final question - I plan to have many devices talking to this api server, I doubt I can set them all to have the same DNI. Is there a work around for this? I can only think of having my API server listen on many ports so the DNI can be unique, but that seems a bitā¦
@kevintierney I wonder if you can help I downloaded your code for the wemo crockpot off git hub and added it as a smart app and it finds the device but when I select it and hit done it gives me an error java.lang.NullPointerException: Cannot get property āvalueā on null object @ line 176 which is
log.debug "Creating WeMo Crockpot with dni: ${selectedCrockpot.value.mac}"
Iām not even close to a program so Iām not sure what Iām missing. Do I need a device type handler as well. Thank you
I readded both files and now I get in the smartthings logs
error physicalgraph.app.exception.UnknownDeviceTypeException: Device type āWemo Crockpotā in namespace āwemoā not found. @ line 178