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
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.
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.
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.
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
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.
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, âŠ?
Thanks!!!
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.
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!!!