Jump to content

Can PING be used within ISY Programming to verify device presence?


ISY4Me

Recommended Posts

Posted (edited)

I have a simple goal, but an unknown path as to how to get there.

 

I want to do a poor mans geo-fencing.  I would like to programmatically PING my cell phone network (WiFi) IP from ISY.  I run a "reserved DHCP" configuration, so the internal home IP for the phone never changes.  If the PING is successful, then set a state variable indicating that I am home and certain commands can be executed.  By the same token, if the PING fails, it is indicating that I am away from home and now certain systems will be shutdown or changed.

 

Is such a thing possible?

Edited by ISY4Me
Posted

I believe there is such a thing as modern routers that will do notifications upon a particular MAC address connecting in.

 

This would be perfect and very reliable but I do not know of any models that do such a thing.

 

I don't want t hijack your thread but, models of routers that have geofencing capabilities would be good to know. Links?

Posted

I use tasker to set a variable on my isy when it is logged into my home wifi.

 

I don't think ISY has a ping function, but could be wrong. 

 

Can you provide some guidance or instructions as to how you use tasker to set a variable in ISY?  Thanks

Posted

Many home routers can run open-source firmware, usually based on Linux. (I use ASUS-Wrt).

 

Ultimately, then, anything is possible, as you could write your own software.

 

You might research what open-source firmware you can run on your router, and what kind of pre-built modules are available for it. Might be something to do this.

 

If nothing else, you should be able to schedule a periodic shell script. Ping your device, examine the output from ping. Then set a variable on the ISY. (Use cURL).

 

Of course you could do this with ANY always-on computer. It's particularly handy, though, on your router, since it is a low-power, always-on computer.

 

I may experiment with this, as I've been finding Locative too fuzzy. Was planning on getting an iBeacon...

Posted (edited)

Thank you apostolakisl and larryllix for the links,

 

I have used Tasker on Android in the past.  Unfortunately, I forgot to mention that I am now an Apple iOS and Mac household and there is no pure equivalent for Tasker for iOS that I have come across.

 

I have and do use REST commands on a WC8 PLC to feed Temperature data to the ISY, so I am familiar with the REST command approach of data communications. For a while, I thought I could use the CAI WebConnect PLC WC8 to feed to the ISY using PING, but the WC8 does not allow PING... this is only available on the WC32.  I could always upgrade the PLC, but I was trying to accomplish this using the hardware I have.

 

Thanks jtara92101... I have seen some threads talking about what might be possible with DD-WRT open-source router firmware.  To accomplish my connectivity problems, I have moved to a CradlePoint MBR1200B and DD-WRT is not compatible with that router and I wouldn't want to loose the benefits that I have with the Cradlepoint OS.

 

Open to any other suggestions... there must be a way.

Edited by ISY4Me
Posted

An always on PC could ping your phone once/minute then run a rest command to ISY when it changes state.  You'd need to write scripts to do this which might take a while to figure out.  Probably you could get a Rasberry Pi to do it also.  Or you could go back to Android and use all the wonderful features of Tasker once again.

Posted

Thank you apostolakisl and larryllix for the links,

 

I have used Tasker on Android in the past. Unfortunately, I forgot to mention that I am now an Apple iOS and Mac household and there is no pure equivalent for Tasker for iOS that I have come across.

 

I have and do use REST commands on a WC8 PLC to feed Temperature data to the ISY, so I am familiar with the REST command approach of data communications. For a while, I thought I could use the CAI WebConnect PLC WC8 to feed to the ISY using PING, but the WC8 does not allow PING... this is only available on the WC32. I could always upgrade the PLC, but I was trying to accomplish this using the hardware I have.

 

Thanks jtara92101... I have seen some threads talking about what might be possible with DD-WRT open-source router firmware. To accomplish my connectivity problems, I have moved to a CradlePoint MBR1200B and DD-WRT is not compatible with that router and I wouldn't want to loose the benefits that I have with the Cradlepoint OS.

 

Open to any other suggestions... there must be a way.

I second the always on PC. Check out my review for the in the coffee shop section on the Azulle PC stick. Good price, low power, full Windows 10. Then just find a program or write script. Done. Time saved it worth paying the money.

 

-Quantum Access LAN Windows 10 Fanless Mini PC Stick

 

https://www.amazon.com/dp/B018GWVOGC/ref=cm_sw_r_sms_c_api_FCuMxbFJ6NJRD

  • 1 month later...
Posted

Anyone have any advice on a PHP ping script?  I'm running WAMP on a Server 2012 R2.  It doesn't have to be PHP, but I am not having any luck finding a PING script that works correctly.  Ideally, ping an IP address and send a REST command to my ISY if the internal IP is alive or not.

 

I always get "Ping Sucessful"

<?php
$host="192.168.1.101";

exec("ping -c 1 " . $host, $output, $result);

print_r($output);
?><br/><?php
print_r($result);
?><br/><?php
if ($result == 0)
{
echo "Ping successful!";
}
else
{
echo "Ping unsuccessful!";	
}
?>

Posted

Endless Googling and trying for the 2nd night....

<?php
$str = exec("ping -n 1 -w 1 192.168.1.70", $input, $result);
if ($result == 0){
echo "on";
}else{
echo "off";
}
?>
Posted

I was reading the enhancements of version 4.5.2

 

Can someone explain to me what this feature is all about?  wouldn't it check for the presence of a certain device (almost like a ping)

 

Enhancements:
[OADR]
- /rest/oadr/status - retrieve network connection/online status

 

If not, can anyone give ideas of usage of this OADR?

Posted (edited)

I was reading the enhancements of version 4.5.2

 

Can someone explain to me what this feature is all about?  wouldn't it check for the presence of a certain device (almost like a ping)

 

Enhancements:

[OADR]

- /rest/oadr/status - retrieve network connection/online status

 

If not, can anyone give ideas of usage of this OADR?

Entirely unrelated, this is for OpenADR, just reports whether the VTN (Virtual Top Node) is online.

 

The VTN is usually a service running out at your utility company, not a device in your home, and the status does not do a traditional PING test.

Edited by KeviNH
  • 2 weeks later...
Posted

I'll have to go back and collect up all the links, but I basically have all of this working for you and it's been running strong for years.

 

I run openwrt on my router and have a script that will check for wireless devices on wifi and is fully configurable with mac addresses and IST variable numbers.

 

I also have another script I wrote in Python that will used Bluetooth on a raspberry pi to look for devices as well.

 

AND I just posted new code yesterday with a link in a post on this forum to another Python script I wrote that uses the iCloud API to do an actual real geofence and look up your phones exact location and update a variable on the ISY with your relative distance to home.

 

I used all 3 together and it's totally rock solid, I've been running the wifi and Bluetooth for 3 years plus that way and my new iCloud script for a few weeks and it's working great!

 

 

Sent from my iPhone using Tapatalk

Posted

As said before, get a pi and it can be done easily. I can even provide the bash code, you just need to put in your isy info and ip info! I have mine setup so when my iPhone connects to the wifi it unlocks my door. Works 100% of the time!

Posted

Please post the links... All iOS here so curious about the iCloud bit.

 

@memphis2k: ISY iCloud Proximity that's the github page with the code I just posted yesterday... it works great, but I'm still adding a bunch of stuff to it, you'll see in the description.

 

And here's a link to the forum post where I first put it out there: http://forum.universal-devices.com/topic/19793-ios-isy-proximity-script/

 

I can copy the WiFi proxy arp bash script I have and post it somewhere as well if people are interested. Bluetooth is a little more involved, but I'd be happy to help anyone that would like through it for a bit and see if I can generalize and adapt the code for you.

Guest
This topic is now closed to further replies.

×
×
  • Create New...