TUTORIAL: Using EventGhost for Scheduling

Continuing the discussion from Time based events failing?:


Great stuff… thanks!!!

This example triggers Events (Endpoints) in SmartThings (served by a web services endpoint SmartApp).

But what about the other way around?
i.e., How do you configure EventGhost to receive events from the SmartApp you shared?
(This SmartApp will send selected events to an EventGhost server running the Webserver plugin.)


The cloud interface app can be used to generate the endpoints: http://thingsthataresmart.wiki/index.php?title=Alexa_Helper#Cloud_Interface_Smart_App_Setup

1 Like

I’m thinking that since you are really just invoking a Python script to do the work, any source of scheduled execution should work. I think I’ll hook this up to a cron on my 24x7 UNIX host.

1 Like

So between the event ghost notifier and the endpoints, EG can do RM’s job with real scheduling?

I’ve used EG before for Harmony/Insteon/Alexa integration, it’s not too hard to learn either.

1 Like

Except for scheduling and the “user interface” of EventGhost, Rule Machine is better because it is entirely a native SmartThings SmartApp. Much more efficient and no web endpoint exposure.

1 Like

You’re absolutely right, cron can achieve exactly the same effect by executing scripts with the python commands.

Not quite - Rule Machine allows interaction with any SmartThings device, real or virtual. The Endpoint Example app only allows interaction with Buttons/Switches and Locks, and the Cloud Interface SmartApp only allows interactions with Buttons and Switches.

I would say Rule Machine is still an absolutely integral part of this whole scheme. I am fully satisfied just using EventGhost as a scheduler.

Hey, thanks for that! I’ve used Alexa Helper but never tried the Cloud Interface app. It looks and works great, but I couldn’t copy the endpoint links from my iPhone :frowning:

The thing I love most about EventGhost is that it is DEAD SIMPLE to use. Most everything can be done with drag-and-drop, and there is a large community of people hacking at plugins for device control.

The major downside is that it’s stuck on Python 2.7 and a major re-write would be required to get up to 3.x The result is that a lot of the 2.7 Windows libraries are starting to break in unexpected ways with no resolution in sight.

I’ve been using EG for over a decade at this point. A fair amount of the automation in my environment ties directly to it, where ST is essentially acting as a dumb hub for device communication with the logic happening in EG.

1 Like

There is no way to long press on the links, select all, and copy?

The normal iOS copy dialog would not pop up. Do you know for certain it’s supposed to work on iOS? I am jailbroken, which could (though probably wouldn’t) be causing the popup to fail. I would be happy to help you test a version that did allow the copy dialog to function, if you’d like me to.

I will see if I can change it to accommodate more OSs (I have an android and this works well).

Great topic and conversation…

But I’m feeling really dense and confused about one thing I asked earlier:

How do you configure EventGhost to receive events from the SmartApp you shared?

i.e., the Tutorial makes perfect sense on how to use the EG scheduler and a couple Python commands to trigger SmartThings Endpoints. Easy.

But how do you configure the Web Server module in EG to receive Events from SmartThings? Am I missing some sample code, or are you assuming it’s easy to write, or is it built-in, …?


It’s really easy! When you add the Webserver plugin you configure the “HTML documents root” to point to a folder. In that folder place an empty index.html (or put an actual website there if you like). Then send a GET for your webserver with the URI looking something like this: http://webserver.local/?This.Is.A.Test

In your event log you’ll see an event has been triggered that looks like this

You can drag that event onto a macro, and now that macro will be fired whenever something does a GET for http://webserver.local/?This.Is.A.Test

With the EG SmartApp you select the devices in ST and point it at your new EG webserver. Every time an ST event appears from one of your selected devices, it’ll send a GET command to http://webserver.local/?ST.Your.Device.Name.action_value. You can then drag that event to a macro to respond to that specific device event.

Some events are considered “binary” for things like switches that go on/off, contact sensors that go open/closed, motion sensors active/inactive etc. They look like this in EG:

Some have a “payload” that can be picked up and used with a Python command. They look like this:

(it’s cold here!)

For an example: before @MichaelS published his awesome Alexa Helper I was using EventGhost to control volume on my TV via Amazon Echo, a virtual dimmer, my EG SmartApp, and EG’s own Sonos control capability (far more reliable and functional than Sonos control from ST, written by the also-awesome technoguy).

I created a dimmer device and configured Alexa to see it as “TV”, and set it up in my EG SmartApp. I’d say “Alexa, set the TV to 50%”. The Echo would set the dimmer, that would trigger an event, the EG SmartApp would pick it up and send it to EG as HTTP.ST.TV[50]. The following Python code inside EG would grab that value and send it over to the EG Sonos plugin:

volume = int(eg.event.payload[0])
if volume < 100:
    eg.plugins.Sonos.VolumeSet(u'RINCON_<my_sonos_id>', str(volume))
    print "Setting TV Volume to ", volume

Check here and here for more details on using Python within EG to control plugins. The native Python integration and interpreter is the major source of power in EG.


If you’re using the Send Events to EventGhost app, it’s simple. You configure EventGhost’s Webserver plugin, then configure ‘Send Events to EventGhost’ to use that server. Then from ‘Send Events to EventGhost’ you can configure what devices will send events to EventGhost. After you configure something (say, a switch), press the switch and you should see an action in EventGhost pop up in the left pane. Then copy that action into a macro and pair it with an event, and you’re in business!

Yah… That’s the part I assumed was complicated, but probably isn’t. I’ll report back shortly if it works or not.

Slight problem is security… The EG Webserver doesn’t have strong authentication I think.

It’s really very, very simple. I created the tutorial above because EventGhost’s interface can be somewhat obtuse at times, but if you can follow the steps in the tutorial then setting out on your own and learning (how to configure the Webserver, for example) isn’t so hard.

In fact, if you install the Webserver plugin EventGhost can run an HTTP GET request directly on an endpoint using one of the actions in the Webserver plugin, meaning no messing about with python code.

1 Like

The EG webserver supports SSL and HTTP auth so if you want to secure communications with it you can. Unfortunately, my SmartApp supports neither. The good news is that this is entirely local - there is no reason to open the EG web server to the outside world, as the SmartApp utilizes the local LAN connection to send commands to EG.

Oh … you’re right again. Doh!!!

1 Like