[PORT] - Send Events to EventGhost

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

@arnb, I'm hoping to you can save me one more time. I have everything working right to running the EG command from the browser ( http://192.168.xxx.xxx:ppp?Dimmer) . I have attempted a RM command to initiate the command but it seems i can't. Could you help with the syntax?

  • Set the windows computer to a fixed IP address in your router

  • Assuming the windows machine IP address is 192.168.1.100, and the Event Ghost port is 9999, that command from the Hub would be 192.168.0.100:9999?Dimmer
    Change the IP address and port to match your setup

The following Groovy sample code is taken from my SmartUps module, routine def rebootWindows(). Never tried this in RM.

def rebootWindows()
	{
	log.warn "SmartUPS rebootWindows command entered"
	def egCommand = java.net.URLEncoder.encode("HE.rebootWindows")
	def egHost = "${settings.ip}:${settings.port}" 
	sendHubCommand(new hubitat.device.HubAction("""GET /?$egCommand HTTP/1.1\r\nHOST: $egHost\r\n\r\n""", hubitat.device.Protocol.LAN))
}
1 Like

Great it's working. Your pointers got me going. Thank you.
The RM rule turned out to be simple;

Send GET to: http://192.168.xxx.xxx:pp?Dimmer

1 Like

Hi Guys!

Is there a noob-friendly guide "how to send Eventghost triggers TO the hubitat" ??

Have you tried my post 33 above?

Update: and post 42 above

Perhaps I misunderstood, are you wanting to receive data in HE?

Yes, i do.

I have a HTPC, which i control with the PS3 DVD Remote.

The 1 to 7 buttons on top switch my most important lights
with eventghost, which triggers a fs20 usb wireless transmitter.

Now, iยดm switching from fs20 to zigbee/Hubitat i need an alternative way to trigger the lights.

having read through this post, I feel I understand most of it and should be able to grasp it as i go.

but the question I want to ask before I go too deep into this is, will I in some way be able to alter and control the master volume of my pc from my hubitat dashboard? would be great if it could be with an actual volume controller but would be acceptable if its from just vol Up and Vol Down buttons,

It should be possible by:

  • creating a "virtual audioVolume" device

  • add the device's volume setting to the dashboard, generating a volume slider

  • Find a EG plugin or Windows command that adjusts the PC's volume

  • Create an RM or groovy module that monitors the virtual device's volume setting, then sends an http get command (of your design with the volume percent) to EG when it changes.

  • Create an EG macro that monitors for your command, then adjusts the volume

Lots of moving parts, enjoy the challenge.

1 Like