[OBSOLETE] Host Pinger (IP based Online State / Presence)

The PC activity stuff is neat - I might do the same at some point, but from my understanding of your code, the Trigger you’re using to wake/shutdown your computers is if there’s Activity. I totally get that use case, but I don’t see anything that allows you to manually trigger the on/off, which is what I’m really after.

To turn off the PC, the “Off” event (i.e. PC Switch Changes to Off) is captured in EventGhost and that is tied to a macro in EventGhost to shut the PC down (in my example, it’s tied to hibernate but easily modified to turn completely off).

To turn on the PC, just create a Piston to WOL when PC Switch changes to On.

Again, Host Pinger is turning the status of the switch on/off but you can also turn it on/off manually or via ST. Sweet!

The question I have is for your last statement, where can you manually turn them on/off? You can do it by adding/monitoring status of more virtual switches, but it’s sort of partially duplicating the PING devices. My goal is to use the PING devices as actual switches that Webcore monitors.

1 Like

Ohhhh!!! I thought Host Pinger allowed you to create Virtual Switches but it looks like now it only does Presence…This will not work and now I understand why you are asking where do you manually turn on/off the PC! You must use a Virtual Switch which you can create in the official ST Virtual Switch App.

I have one Switch per PC to turn it on/off.

This PC Switch is a Virtual Switch that shows up in the ST App just like any other device. If I go into the ST App and manually click off, then the PC shuts off. If I turn it on, then it turns on.

If I manually shut down the PC, just like a normal person, then the VS in ST turns off and visa-versa.

I hope I am answering your question…If not, then I did my best to go step by step in the tutorial I posted above. Detailed setup is in Post#2.

ST turns on the PC by using the WOL command in webCoRE.
ST turns off the PC by EventGhost monitoring the off command from ST then runs a macro in EventGhost to shut down the PC.

This has nothing to do with the Activity Switch. This switch just lets me know if someone is actually using the PC. I have one for every PC and I have 10 on my network.

1 Like

Yeah this is the right way to do it as you will always have a reliable current state, changing to a toggle switch isn’t the way sensors work, but I know some people are a little OCD about adding extra virtual switches, so it’s a little hacky but easy to add the code

I’m getting this error trying to load a sketch onto an esp8266 nodeMCU module…

Arduino: 1.8.7 (Windows 8.1), Board: “NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

Build options changed, rebuilding all
sketch_nov12a:11:67: error: ESP8266Ping.h: No such file or directory

#include <ESP8266Ping.h> //https://github.com/dancol90/ESP8266Ping

                                                               ^

compilation terminated.

exit status 1
ESP8266Ping.h: No such file or directory

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

Have you installed ESP8266Ping in to your library from https://github.com/dancol90/ESP8266Ping ?

1 Like

By the way let me know how you get on, you will probably be one of the first using an ESP8266 for this!

I’m loving this so much, thanks Jake. I’ve already liberated two smart plugs from my PC and TV. It’s working like a charm, I’ve been wanting to try your app for ages. I’ve covered it in nail varnish to protect it (a trick from @iharyadi). Next going to see what I can do with Presence.

2 Likes

Did you ever get this worked out?

Looks good! I use the Wemos Mini D1 (The ones pictured in the IR transmitter I PM’d you), that has a couple of cases available, so you can just put in in one of those in a case, that and they are also smaller and have prototyping boards, only disadvantage is less GPIO pins etc… but not an issue in this use case…

I’m currently programming my Christmas tree on one this year with 150 addressable LEDs…

1 Like

Hello

Awesome idea

Installed the smart app - enabled debug and got my codes

Added to config.config with the values

ran the app and got a sucess message

Added the custom IDE to create a virtual switch and the ping shows offline

What am i doing wrong?

Did you create the host in the app and also associate the virtual device to it?

If you did and the last event screen is showing activity… then close the exe and re-open, it will only update the devices on status change, if you ran the exe prior to setting up the app then it wont update until the next state change, restarting the exe publishes the current state…

Hope that helps, if not then a screen shot of your setup, or the app settings from logging… go in to the child app and press done until logging is updated with app settings. Also confirm you are seeing something in the last event section…

Same thing for me, Yesterday was working fine, now it wont switch to online… exe isnt showing any errors with debug 2

@BaRaD5 I’ve just tested mine and it appears to still be working for me…

Can you both please check which web address you are hitting when you log in to the IDE and confirm that matches the prefix for the config?

I’m on the EU server and often we get updates later than other shards… perhaps something to look forward to!

graph-eu01-euwest1.api.smartthings.com

I reinstalled everything, Smartapp and DTH, i’m on graph-eu01-euwest1, and there is no reason for it not to work, I had 2 devices reporting perfectly fine and now niether of them will show…

Can you open host pinger and go to “Events Received” if there is nothing in there press done then close and re-open the exe and then return to the Events Received screen…

If you still have nothing then the two are not successfully talking…

By the way if you re-install the app you will need to update the app id and token… if you don’t do this the exe may still be communicating via the previous token and still show successful…

Both devices reporting in the Events Received screen showing online
IDE showing everything as reported in the EXE

Use the below DTH code:

I’ve made one tweak (I expect that wont fix it) but also added a couple of debug lines, so at least you can see if it is getting to the virtual device…

/**
 *  Host Ping Device
 *
 *  Copyright 2016 Jake Tebbett
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 * 	V1.1 - Added Presence
 */

metadata {
	definition (name: "Host Ping Device", namespace: "jebbett", author: "jebbett") {
		capability "switch"
        capability "presenceSensor"
        attribute "switch", "string"
	}

	tiles(scale: 2) {
        standardTile("switch", "device.switch", width: 6, height: 6, canChangeIcon: true) {
    		state "off", label: 'Offline', icon: "st.Electronics.electronics18", backgroundColor: "#ff0000"
    		state "on", label: 'Online', icon: "st.Electronics.electronics18", backgroundColor: "#79b821"
		}
    	main("switch")
        details(["switch"])
    }
}

def on() {
    sendEvent(name: "switch", value: "on");
    sendEvent(name: "presence", value: "present");
    log.debug "Online"
}

def off() {
    sendEvent(name: "switch", value: "off");
    sendEvent(name: "presence", value: "not present");
    log.debug "Offline"
}
1 Like

I expect that wont fix it


2 Likes