[PORT] - Send Events to EventGhost

What os are you using? Perhaps try running in compatibility mode?

I'm using WIndows 10. See my edit above -- solve the File/Options problem -- it's a known issue on github. Was able to use a workaround. But I still can't see HE events in the EG log.

Were you able to get the webserver setup in the eventghost software? I noticed mine was set to port 100 so had to change that in the eventghost app.

This is correct if everythingn is setup you should be seeing the switch events in the eventghost log

image

And you are correct there are many references to ST. Maybe one day ill fix it up to reference HE.

Right click autostart and choose add plugin

image

All the way at the bottom of the window that pops up choose webserver

image

You may need to restart eventghost after configutation.

Thanks but I think this is beyond my ability. I don’t understand how to configure a eventghost web server to receive events from HE. No worries, I’m going to use TriggerCMD. While I don’t love its cloud dependency, at least it’s simpler for users like me. Thanks for your patience and support just the same. I surrender :upside_down_face: Cheers.

I have the Webserver plugin working, I know it's working because it's not configured and I keep getting 404s on 127.0.0.1, localhost, and my computers IP address.

Can't find any documentation for the Webserver plugin.

What I want to do is run C:/apcupsd/etc/apcupsd/mytest.vbs from Hubitat for a device's Refresh command. No problem getting to the eventchost webserver from the hub.

What I need some info on how to set up the EventGost webserver and what to send as a command from the hub.

Update: changed the webserver's HTML document root to apcupsd/etc/apcupsd then entered 127.0.0.1/mytest.vbs into the broswer URL. It downloaded the file rather than run it so I'm getting close. Somehow have to add a cscript before the file name, and add some security.

You are trying to get eventghost to react to a command from the hub to cause the scripts to run on your windows machine correct?

All needs to be done is setup a switch in evenghost app on hubitat. Eventghost on your pc will react this and run your script directly. You just need to look at the various plugins available in eventghost. One of the things it can do is execute something from the command line. The webserver is setup to simply listen to the events sent over by the eventghost app.

these are instructions I used when figuring out eventghost.

Thank you for the write up link.

Unfortunately EventGhost is failing in step 1, File-->Options. However, it does start when the system boots. Moving on to next steps

Yes someone a few posts up mentioned this. Said there was a known issue on github with a possible fix.

The fix for the options error is posted below. I had to run Textpad editor in administrator mode to save the change.

Correct, but I'm losing it around steps 5 and 6 of the instructions. For the record I'm not using IFTTT

  • I have an EG macro witn an action to executing C:/apcupsd/etc/apcupsd/mytext.vbs

  • I can send a URL request to the EG Server from my browser or HE smartUPS device's Refresh command.

  • I see an EventGhost task start when I send the URL or enter it in the browser.

  • I cant figure out how to trigger my EG action from EG's received URL event that was sent, or what the URL should be after the IP address

UPDATE 1. A bit of progress, Dragging the task.activated Vivaldi to my smartUPS macro with the command action, triggered the action he next time I did something in Vivaldi. Now I somehow want to only trigger the action when the webserver received the correct URL, but I'm not seeing any webserver events to use as triggers.
PS Vivaldi is my browser.

I have only ever sent commands from my hub using the app in the op.

It looks like this is the relevant bit of code --

def eventHandlerBinary(evt) {
	def egHost = "${settings.egServer}:${settings.egPort}"
	def egRawCommand = "${settings.egPrefix}.${evt.displayName}.${evt.name}.${evt.value}"
	def egRestCommand = java.net.URLEncoder.encode(egRawCommand)
	log.debug "processed binary event ${evt.name} from device ${evt.displayName} with value ${evt.value} and data ${evt.data}"
	log.debug "egRestCommand:  $egRestCommand"
	sendHubCommand(new hubitat.device.HubAction("""GET /?$egRestCommand HTTP/1.1\r\nHOST: $egHost\r\n\r\n""", hubitat.device.Protocol.LAN))
}

event ghost is likely looking for a certain format to create a trigger.

The iftt is a bit confusing - it is really just triggering a curl command from the windows command prompt.

Sadly I wont be much help with sending a trigger for elsewhere. You likely know more about how to match the above command from elsewhere than I would.

Edit. Just tried from browser - this format seems to work well enough to create events that can be responded to in eventghost.

http://10.0.0.253:100/?HE.eventghost.switch.off

That's it, thank you! I was sending URLs without parameters.

So using your IP as an example
http://10.0.0.253:100/?HE.eventghost.switch.off
http://10.0.0.253:100/test.bat?HE.eventghost.switch.off
both show an EG HTTP event with HE.eventghost.switch.off

http://10.0.0.253:100/test.bat
never shows up in my EG logs!

Using the unique parameter allows for multiple actions based upon the HTTP trigger parameter.

1 Like

This is now working for me.

Instructions to create then run a local Windows command from HE follow. YMMV

  1. Install EventGhost

  2. Activate the Webserver plugin

    • Unless you know what you are doing leave it at port 80
    • In the HTML document root: field enter C:/www
    • Do not change: Event Prefix: HTML Realm: EventGhost
    • Click OK
    • The www directory name is inconsequential as long as it matches what is entered into the webserver's document root field
  3. Create directory C:/www

    • Create file index.html with the following
    • <HTML><BODY></BODY></HTML>
  4. Highlight the computer name at the top of Configuration column

  5. Click on Create a folder: give it a name

  6. highlight the folder then Add a Macro in the newly created folder

    • Expand System, select Run Command
    • enter the windows command, click Test
    • when it works, click OK
    • This is now a Macro, with an Action
  7. From a web browser enter 127.0.0.1?whatever

    • If you get a 404, not found, see step 2 and 3 above
  8. In the EG event log you should see event HTTP .whatever[]

  9. Drag the HTTP event to the newly created Macro. It may look like it's not going, but once you stop dragging it will show up in the macro. That is the trigger

  10. Reenter the trigger URL from the browser to test

  11. Create the HubAction or RM to send the URL and test

6 Likes

Thats great!! I was starting to fear I had led you down the wrong rabbit hole. Glad you got it going.

1 Like

This was more like a prairie dog burrow: multiple entrances, some rooms, and multiple exits.

Thank you for your time and assistance.

While testing the EventGhost webserver, it returned a 404, Not Found, error on every message sent from the Hub along with correctly running the command. The 404 response was eliminated by adding an index.html file in a newly created C:/www directory.

Updated the instructions in my prior post. The directory name is inconsequential as long as it matches what is entered into the webserver's document root field.

@arnb, @cwwilson08,
I have followed @arnb instructions. Dispite my attempts to debug and reading I am stuck at step 8. I am not seeing the HTTP event in the logs.

Some pointers would be greatly appreciated.

Kindly post a screen shot of the Webserver settings. I just tried step 8 on my Win 10 system and it worked.

127.0.0.1:nnnnn?hello (in the browser address, created log entry. where nnnnn is port number. I'm using a port number other than 80)
12/4/2020 9:41:27 HTTP.hello []

Image of my EventGhost setup

Thanks for your response. It helped me figure out the problem :+1:
The problem I had is understanding what comes after
the question mark, 27.0.0.1:80?whatever
I couldn't figure out what whatever did. I didn't realize that it is the name of the event you want to use in the macro.
Thanks again.

1 Like