Virtual Button to send out http to Eventghost


(Rob) #1

Can anyone share this code?

(Convinced ST will never be unbroken…) #2

What exactly are you looking to send? (get, post, put, etc.)

(Rob) #3

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.

(Convinced ST will never be unbroken…) #4

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.

(Rob) #5

Perfect that’s exactly what I needed I knew you had the answer! :smile:
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.

(Convinced ST will never be unbroken…) #8

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.

(Rob) #9

It worked! How do I get the virtual button to show up in ios? It worked on the website.

(Rob) #10

All working. Thanks again Scott.

(Dan) #11

@scottinpollock The link is dead but I found your smart things code on the HAM Bridge examples (

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“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

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

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?