WebCore and EventGhost


#4

I guess to make this a complete walkthru, I should probably mention that you can also pass arguments back in the other direction. (from your computer to webCoRE)

  • Create a piston in webCoRE.
  • Take note of the External URL
  • In EG, create an Action > EventGhost: Python Command
  • The command is: import urllib; urllib.urlopen('')
    (Your External URL goes between the quotes)

Running this in EG should run your piston. Simple enough…

If you want to pass along another parameter (or argument) then you can add one (or more) to the end of the URL like normal. Such as:
?PcLocked=false&CurrentApp=firefox

So basically, when my computer locks, EG sends one command, and when my PC unlocks it sends a different command to the same piston.

When Using PC:
import urllib; urllib.urlopen('https://api.smartthings.com/api/token/123abc/smartapps/installations/456def/execute/:789abc:?PcLocked=false')

When Screen Is Locked:
import urllib; urllib.urlopen('https://api.smartthings.com/api/token/123abc/smartapps/installations/456def/execute/:789abc:?PcLocked=true')

(Notice only the last word changed)

Then we just edit that piston again, and make sure it is looking for that arg, and acting accordingly. Such as:

temp


Intelligent Echo Device Location change piston
Intelligent Echo Device Location change piston
Using External Information
#5

So, in a nutshell:

EventGhost can send data, and webCoRE can act upon it…
…or…
webCoRE can send data, and EventGhost can act upon it…
…and perhaps the coolest one…
webCoRE / SmartThings / Alexa / GoogleHome can toggle a switch (real or simulated), and EventGhost can act upon it… Such as:
“Alexa, turn on VPN” can actually run a program in windows!

The only variation that I have not found is EventGhost turning on a switch directly… But this isn’t that big of a deal because EventGhost can tell webCoRE to turn on that switch.


#6

Those are some great suggestions. Thanks alot. I had to think about it. I ended up using the simulated dimmer switch. I liked the idea of only one dimmer but several options in webcore.
I have one slight problem for now Im using a light switch as a trigger and EG only shows the dimmer either on or off

Figured it out I put it in both places as a switch not a dimmer. Saw my mistake after I read your post again


#7

Looking good! If you want to streamline that a bit, you can totally drop the “Wait” as well as the lines “Turn on/off”, and it will still do the same thing. (Don’t worry, no electricity is used to power a Simulated Switch, hehe)


#8

I was using Arduino hardwired to door and window switches for alot of this before I started buying z wave. I have a temperature sensor outside that arduino reads and then its read out loud on my computer and throughout the house. Could I put a motion sensor (with temp) outside and use WebCore to somehow push the temp to my computer and use Ivona or something else to read the temp


#9

Well, in EventGhost, you can add a Plugin to the Autostart section called “Other > Speech”. Once that is in place, you can add a new Action: “Speech > Text to speech”, and you will get something like this:

temp

It comes with two voices, but I have seen other people add more to the list.


I think the challenge will be to get a variable from webCoRE to be spoken in EventGhost. I know it is possible, but requires a bit of scripting. (usually python) I usually simplify and have “canned responses” at the ready, just so I don’t waste time scripting.

When I want current variables to be spoken outloud, I use my Tasker method described here to get really customized text alerts. Yes, I still had to code that, but with the one code in Tasker, I never need to code again for any incoming variables.

In other words, EventGhost is easiest with pre-determined spoken responses, such as “Welcome home” or “Turning on AC now”… (or playing a wav sound effect)


#10

OK about the virtual dimmer.
Im monitoring power for washer and dryer and a piston for each
In EventGhost on my PC I can see the piston working it shows up on the left side of EG it also shows the dimmers level. On the left side I create an action and I drag the st.STEventghostdimmer to the right side. when I do that the dimmer level does not show up. I dried to right click and configure and type the level in as it appears on the left side but then it does not work at all. Whats happening is when the piston triggers it uses the same action for both the washer and dryer. Not sure why
correction its playing both wav files its just that the first one does not get played just goes right to the second one
In my piston I set the level to 5 then wait then to 1 and I notice that the action is triggered at the level 5 and again at level 1


#11

Oh yea, sorry, I forgot to mention that. Anything past the core command is stored in a payload. You just have to create one extra macro for it to work. (shown below)

temp

Line 1 is: a Macro (with any name)
Line 2 is: the normal drag trigger (with no trailing stuff)
Line 3 is: Add Action > Python command

The python command on line 3 is:
eg.TriggerEvent("EgDimmer." + eg.event.payload[0])

What this does is when your Sim Dimmer changes, it triggers those 3 lines above.
That code strips the number at the end, and sends out a NEW trigger.

temp

(Main.EgDimmer.74 for example) This new trigger is the one you want to watch for, and do your sound alerts etc.

In other words, the “EgDimmer Retrigger” section only needs to be created once. The 2 samples below that are for whatever numbers you are using. (easy to copy/paste for new numbers in the future)


Intelligent Echo Device Location change piston
#12

Thanks that was a hair puller for awhile.
In regards to the Temp and EventGhost I think I will leave that alone for now but thanks for the info.
I think that’s it for today :slight_smile:
Every thing is working good now


#13

Well, since we have already ventured into a bit of Python scripting, here is how you can do this:

Make a piston in webCoRE with the following line:
Make a GET request to 192.168.1.2:80/?OutsideTemp&78&Cloudy
(change the IP and port to match your PC)


Then back in EventGhost, we look for the trigger “ST.OutsideTemp” such as:

temp

The code in line 3 is:
It is currently “{eg.event.payload[0]}” degrees outside and “{eg.event.payload[1]}”


When I trigger the piston in webCoRE, my computer will say, “It is currently 78 degrees outside and Cloudy”

For the record:
“{eg.event.payload[0]}” is the first parameter sent from webCoRE
“{eg.event.payload[1]}” is the second parameter sent from webCoRE
and so on…


Of course, once you have got it running, you’ll want to tweak your piston to put REAL data in the URL before sending the GET request… Such as:

index

(as usual, change the IP and port to match your PC)


#14

I got the temp to show up in EG but not exactly clear on how to get it to speak the temp
I see in the third line it starts with
Speech: Speak:
Not sure how you got that.
I have the event under my new macro (st.Outside temp)


#15

You’ll have to save after adding to the Autostart section, and then probably restart EventGhost so it loads the proper files.


#16

yup did that then when I create a new task it opens up the text to speech window. In the text window it typed in Its currently then at the bottom there is a place for additional event suffic thats where i pasted in “{eg.event.payload[0]}” degrees outside and “{eg.event.payload[1]}”
obviously thats wrong casuse it didnt work


#17

Yes, leave the suffix section blank…

temp

Your speech output goes in the top line (where I typed “Testing speech capabilities”)


#18

Just for the record, I don’t think you can use the Sim Dimmer to send extra parameters (like temperature). I would use the method described in this post when you want to pass variables from webCoRE to EventGhost.


#19

OK I got it working.
Thanks for all your hard work. I just have to add an action to get it to say the time. Not sure what I want to do yet.
I do have a couple questions
When I changed to your piston it didnt work and I noticed that on my piston in the line with the ip address at the end I have the word (form) on yours you have the word (JSON)
I had to change that back to the word (form)
One other thing where does it get the weather info Im asking because it says its 91 out right now and really its only 80


#20

If you are doing a POST request, then you have those extra options.
The method I suggested was a GET request which has neither form nor json attached.
temp


This is from WUnderground based on the location you have setup in the SmartThings IDE.


(by the way, the variables at the top of the piston only update when the piston is run, so there is a chance it is showing old data)

temp


#21

For all those watching this thread, I have just programmed my webCoRE dashboard to display the current status of my PC in a tile. I may throw together a tutorial in the future, but if anyone wants to grab my custom icons, here they are:

PC0-Off . PC1-On . PC2-InUse . PC3-SSaver

They are perfectly sized at 78x78, and look quite nice on my dashboard…

The code to draw them is something like:


#22

Your right those two words don’t appear at the end of that line but when I use your piston as a backup the word JSON shows up If I open that that line up under method is Value - GET but I don’t see where the JSON comes from or what I have FORM


#23

I am not sure if it matters, but I notice that you have two semi-colons on that line…

If you edit the GET request, the URL Value should be:
192.168.4.51:80/?OutsideTemp&{tempRound}&{currently}
(numbers changed to match your IP & port)

Note that you will not type ANY semi-colons in this command at all.
WebCoRE will automatically add one at the end when you hit Save.