Can anyone share this code?
What exactly are you looking to send? (get, post, put, etc.)
Hi Scott thank you for getting back to me. Sorry Iām still trying to understand the commands not sure if it is get or post. I want to be able to send an http packet from Smarthings to Eventghost. I have a macro I want to trigger with a packet in eventghost. I donāt know how to put the code together like you did with ham bridge where you can input the ip address and port from within the app. Ultimately, I would like to make several virtual buttons sending out different packets like (on) or (off) etc etc. I donāt necessary need feedback from Eventghost that would be a bonus.
Packet is not the right word here. When making a GET call over HTTP, the data is sent in one or more āparametersā passed in the url. The following will send an http get from a SmartApp:
def HTTP(theCOM) {
def ip = "serversIP:serversPort"
sendHubCommand(new physicalgraph.device.HubAction("""GET /?$theCOM HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN))
}
Where ātheCOMā is the parameter you want to send (āonā, āoffā, whatever).
I have no experience with eventGhost, but am assuming it is running on a computer that resides on your LAN.
Perfect thatās exactly what I needed I knew you had the answer!
I added my ip address and port. What else do I need to modify on the code to get to get to work?
Thank you for all your help. Iām very new to all this.
Here is a scaled down version of a SmartApp I use to send server commands from some non-load controlling switches I have installed. Just point it to your virtual switch and enter your server info.
It worked! How do I get the virtual button to show up in ios? It worked on the website.
All working. Thanks again Scott.
@scottinpollock The link is dead but I found your smart things code on the HAM Bridge examples (http://solutionsetcetera.com/stuff/STApps/HAMBridgeCommandWhen.groovy)
Iām using it to try and run scenes on a vera on the LAN. Via OS X cli (quotes required) I can use curl http://10.0.1.153:3480/ādata_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=44ā
Via My sensor Tags tag manager private URL calling I can use http://10.0.1.153:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=44
So in the prefs for the app I set the IP and port and then for the command to send Iāve tried different iterations of ādata_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=44ā
Simulator logs show:
8:30:07 PM PST: debug Executing GET /?ādata_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=44ā HTTP/1.1
HOST: 10.0.1.153:3480
on Home via sendHubCommand
Unfortunately the scene is not running and Iām sure Iām missing something obvious in my syntax. Do you have any suggestions on what Iām doing wrong?