WebCore and EventGhost


#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.


#24

Your going to shake your head on this one
I cannot figure out how to get an if statement just under location to add in an if so I can run the piston at a certain time


#25

Are you looking to have it run once a day at a certain time, or periodically (such as every 2 hours)??


#26

I was going to run once a day


#27

You can edit the piston, and then:

  • Click on “Add a new statement”…
  • Then “Add a timer”
  • Every Value = 1 day
  • At this time Value is in military time (18:00:00.00 is 6pm)
  • Then click on the button “Add a statement”
  • Then click on Cancel

You will be left with this at the bottom of your code:
temp

Then make sure the 4th button up top is blue:
temp

Then you can drag your original code to the proper place.


To drag and drop code, click in the yellow section to highlight the entire WITH command

and then drag the blue arrow and carefully drop it inside the new timer which I have highlighted below:

temp


#28

Your final code will look something like this:


#29

Got it
Thank you


#30

Oh, this is awesome. Now I can tell when my son is on his computer after his bedtime and put it to sleep, lol. Now I have to figure out how to send notifications for that. I guess when computer is ON after a certain time?


#31

I still use webCoRE for all my logic… In that case, you could have one command sent when his PC is turned on, and another when he shuts down. Let webCoRE keep track by way of a variable, and then at your designated time, simply check to see the state of the variable. This is much easier coding than if you want to send a query to his machine, wait for a response, and then do something.


Sample code to get you started:

sample


The main code back to webCoRE are the lines starting with “WC - PC is currently”
(Both are found by right clicking > Add action > EventGhost > Python Command)

WC - PC is currently (turned ON)
import urllib; urllib.urlopen('https://api.smartthings.com/api/token/123abc/smartapps/installations/456def/execute/:789ghi:?PcLocked=false&PcOff=false')


WC - PC is currently (turned OFF)
import urllib; urllib.urlopen('https://api.smartthings.com/api/token/123abc/smartapps/installations/456def/execute/:789ghi:?PcLocked=true&PcOff=true')


They both point to the same piston, but use different arguments, so different portions of the piston run depending on the circumstances.

Side Note:
You may want to hide the EG icon in his tray, because if he manually exits the app, it will send the OFF command to webCoRE (thereby defeating your monitoring)


#32

Interesting sound effects. :wink: If I used sound effects, would they play on his computer, or on mine? (Just curious)

Is this for ActionTiles?

In a piston, right? (For now, I’m just taking a quick glance at my ST app…although I haven’t set up the PING program yet.


#33

It plays on the machine with EventGhost that is taking action… Although nothing is stopping you from having one machine talk to the other. Just add another line of code to send a command directly from his PC to yours.


Those tiles are on my webCoRE Dashboard:

temp


Yes, the same piston can monitor the PC-ON command as well as the PC-OFF command, and set a variable at that time. If you use a global variable, then you can have another piston running at specific times, and use the global variable as a condition.


#34

Could you give me an example, please?

Wait, what? You mean on this screen?


#35

I am booked for a week or so, but basically it is the same URL as the examples I have already linked to. (but instead of webCoRE to EventGhost, that URL is used in EG to EG.


Yup! :sunglasses:


In a nutshell, once EventGhost can talk to webCoRE and visa versa, then anything in one environment can do anything in the other.

(Pro tip: Throw in Tasker as well, and then your phone, PC, SmartHome etc will all be linked)


#36

@WCmore

Hey, Eventghost is working great, but I noticed something in my Devices when I was adding my son’s RP. Our PCs show different settings.

Should they both be virtual, or simulated switches? I notice his Status and Execution are different. Should I change one or the other?


#37

Personally, I use Simulated Switches instead of virtual switches.

No matter which you choose, I would keep them the same to make future coding easier.


#38

I just thought it was weird that his computer shows as Active/Local, even though I’m accessing his through the network, but my computer is coming up as Online/Cloud, even though I’m running it on my 'puter as I type, lol.


#39

I suspect this is just one of the differences between virtual and simulated switches. I find SimSwitches much more useful and reliable, but your mileage may vary.


Just to clarify, everything in your last post is related to the imaginary switches. (ST cannot see your PC)
IE: “his virtual switch shows as Active/Local, … but your simulated switch is coming up as Online/Cloud”


Personally, I use EventGhost to send a command to SmartThings which flips my Simulated Switch and sets a variable.

I can then look at my SimSwitch and know if my PC is on or off, but it is not a ‘live’ connection. I have to program the on/off command to be sent.


#40

Oh, I’m doing that as well…I’m just not sure how I got them configured differently. I tried to recreate my steps as carefully as possible.

What would be the biggest difference between a virtual and simulated switch?