@pstuart @NWTony - Hoping one of you can point me on the right direction based on your other posts.
I 've been watching and reading just about every thread there is on HubAction. Most if not all have been very informative. In fact, that has led me to creating my own based on the examples.
I’m trying to accomplish what I believe is an easy task but its turning into a nightmare.
I have a Hayward pool “device” that runs/acts a web server. You can interact with it pretty easy. I’d like to pull this and make my own device type. For now, i’d be content with just reading the data and showing the status of the pool on the buttons.
The web server appears to be basic. A htm page that has a few buttons on a table. Push the button and it turns on/off something. I’m not a developer/web guy but there isn’t any xml or json available and the page does not use any commands via the url. You basically push a button and on push it does something.
My main problem right now is the strange behavior I’ve had with parsing the response. I can’t tell if its a bug in ST or if something else is going that I’m not aware of.
I’ve used any examples and randomly they seem to work for a period of time before breaking.
I’ve used many variations of this method below. At times it works and at other times it doesn’t. What I mean is that the parse function doesn’t seem to be getting data. I’ve been deleting and creating new devices to see if that would help. Sometimes it does… sometimes it doesn’t.
My main problem though is consistency… I can’t seem to get a response all time in live logging with this code. Right now, no parsing/response from the device is taking place.
Anyone have an idea what is going on here? BTW - the webpage is working the entire time without any issues.
Also, I’m wondering (when I poll for index.htm) if the body of the site has somehow hung up things enough that it isn’t flushed or something?? The message response is so large that it does truncate the message. I’ve rebooted the hub many times… no success.
If I should be polling the web server a different way… please let me know. My goal is to pull the page into smartthings and interact via the app rather than the vendor provided webpage for my pool.
def refresh(){
log.debug "Refresh"
def host = CameraIP
def hosthex = convertIPtoHex(host)
def porthex = convertPortToHex(CameraPort)
device.deviceNetworkId = "$hosthex:$porthex"
log.debug "The device id configured is: $device.deviceNetworkId"
def headers = [:]
headers.put("HOST", "$host:$CameraPort")
log.debug "The Header is $headers"
def hubAction = new physicalgraph.device.HubAction(
method: "GET",
path: "http://192.168.1.49/WNewSt.htm",
headers: headers
)
log.debug hubAction
return hubAction
}
Below is the latest response based on the request above
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug GET http://192.168.1.49/WNewSt.htm HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.1.49:80
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug The Header is [HOST:192.168.1.49:80]
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug The device id configured is: c0a80131:0050
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug 0050
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug IP address entered is 192.168.1.49 and the converted hex code is c0a80131
dcfdbe48-d659-423e-b72a-24e464e817af 9:19:25 AM: debug Refresh