Ping a local device

I’m running a v2 hub, does this need to be update to support it?

I’m getting this error on my logs…
4:01:52 PM: error groovy.lang.MissingMethodException: No signature of method: static java.lang.Long.parseLong() is applicable for argument types: (java.lang.Integer) values: [80]
Possible solutions: parseLong(java.lang.String), parseLong(java.lang.String, int) @ line 136

Line 136 def porthex = Long.toHexString(Long.parseLong(dest_port))

Whats in your variable dest_port ?

I tried port 80 and 443. I tested it pointing to a local web server and get the error in the log.

you 100% sure the device you are ping will respond ? for myself my ouya work but not my TV

Just trying this now on my V2 hub and having the same error trying to ping a local webserver on port 8000. Did you ever figure this out?

8:06:17 PM: error groovy.lang.MissingMethodException: No signature of method: static java.lang.Long.parseLong() is applicable for argument types: (java.lang.Integer) values: [8000]
Possible solutions: parseLong(java.lang.String), parseLong(java.lang.String, int)

I have a Pi that I am looking to do just what you described. Could you share?

The code is pretty old but may still be relevant. Go to my GitHub. https://github.com/midyear66

Hope it helps!

Will this work for a local IP address?

  1. I have created virtual switches for all of my PCs
  2. I have created a CoRE piston for each virtual switch that executes a Wake on Lan (WOL) when virtual switch “Changes” to on
  3. I have installed Event Ghost and created a webserver and macros to tell the PC(s) to force Turn Off
  4. I have installed the Send to Event Ghost App for each PC and assigned ports for them.
  5. I have opened these ports in my router

This all works great however, If the PC is switched on or turned off manually then the virtual switch is out of sync.
For 3 of my PCs, I have an Iris Smart Plug that monitors the Power so i am able to use those to sync the status of the Virtual Switches.

However, I would like to be able to use a simple “Pinger” instead of the Iris Plug to check periodically (every 30 seconds?) if the PCs are on or off.

Since the Pi is always on, for my alarm server, I would like to use it to ping the PCs and then report their status to SmartThings…

I got it working on my V2 hub by changing line 136
from
def porthex = Long.toHexString(Long.parseLong(dest_port))
to
def porthex = Long.toHexString(dest_port)

I’m new to SmartThings (and Groovy), so i’m not sure if this is the correct way to do this, but it seems to work for me.

I[quote=“rontalley, post:17, topic:18109”]
Will this work for a local IP address? 1. I have created virtual switches for all of my PCs2. I have created a CoRE piston for each virtual switch that executes a Wake on Lan (WOL) when virtual switch “Changes” to on3. I have installed Event Ghost and created a webserver and macros to tell the PC(s) to force Turn Off4. I have installed the Send to Event Ghost App for each PC and assigned ports for them.5. I have opened these ports in my router

This all works great however, If the PC is switched on or turned off manually then the virtual switch is out of sync. For 3 of my PCs, I have an Iris Smart Plug that monitors the Power so i am able to use those to sync the status of the Virtual Switches.

However, I would like to be able to use a simple “Pinger” instead of the Iris Plug to check periodically (every 30 seconds?) if the PCs are on or off.

Since the Pi is always on, for my alarm server, I would like to use it to ping the PCs and then report their status to SmartThings…
[/quote]

Solution is Host Pinger! Works Great!!

I would like to see how your ping your phone and use for presence. I was thinking this same thing to use as an alternate arrival detection.

I’m wondering if anybody has got this working?

I have amended the code slightly to make it a switch. However the issue I have is that parse() is never called (I knwo this because the log.debug statement in it is never displayed in the log).

I am calling a Chromecast on port 8008. I’m wanting to detect if the TV is on and when it is the Chromecast is also on. If you connect to the Chromecast on port 8008 you get a 404 error. That’s absolutely fine. I don’t care about the result only that they are returned. I have also tried to connect to http://:8008/ssdp/device-desc.xml (by amending path in the HubAction) whcih responds with a page of info on the Chromecast. Again, no difference.

It seems that no matter what is returned by the HubAction parse() is simply not being called.

The device network ID is correct (IP and port in hex).

I recognise this code is quite old. But I also know the Smarthub should be able to do this so I don’t want to start using any other machines to do this (ie. Host Pinger).

Anybody help?

I’m trying to do this with an arduino, I can send GET requests to the arduino without problems but im not able to receive the response of the arduino. Does anyone have any idea how to do this?

Here you go…

I’ve got a radio link which keeps hanging, trying to use the http ping to power cycle a Smarthings outlet on the radio power line.
I’ve installed ping and set ip, I can see ping times in the logs but the contact sensor never shows open/ close- I was hoping to use this to just use a Smart Lighting rule or similar to turn off the outlet when ping fails, then turn it back on again after a minute.

Anyone have similar working? It’s so simple I don’t really want to mess about with Arduinos/ PI, etc

Hey Paul (Pauby), did you get this working? I am seeing the same problem you note here.

1 Like

Hello everyone,

Has anyone managed to make this device handler work?
It’s a very important function and I really need it … like many others I suppose.

thank you in advance

This DH works except for one tile…

    standardTile("ttl", "device.ttl", inactiveLabel: false, decoration: "flat") {
        state "ttl", label:'${ttl}'

Is showing a NULL value. I have tried everything to resolve this but so far I haven’t been successful. Help?

Perhaps

label:’${currentValue}’

Tried that.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.