Use NetworkHealth Binding for iphone detection

1 Minute reaction time is worse than what I am getting if I am using IFTTT and signaling via myopenhab.
The disadvantage though is that myopenhab is sometimes down and thereby the reliability is not so great.

IFTTT sounds like a good solution, too, but I would need access to the phone. The iPhone is actually my wife’s phone and she doesn’t want me installing anything on it. So using the NetworkHealth binding is much more transparent with no setup on the iPhone end. Plus, I can also setup presence for the person who cleans our house so she won’t trip any alerts. This works because I know she setup her phone to use my Wifi.

I’m having mixed results. I have an iPhone 5s and it work sometimes but not reliably. When it works, the subsequent ping latency is sometimes multiple seconds. That makes me think the phone is is probably in some low power (reduced clock speed?) mode and processing the network inputs much more slowly than usual. My wife is using an iPhone 4 and this technique doesn’t with that phone. We’re both running iOS 9.

It would also be an issue if I need root permissions to run hping3 since my openHAB server doesn’t run with those privileges. Maybe I can write a program to send the UDP packet without hping3.

My wife has an iPhone 6. We also have an ipod touch that looks like an iPhone 5. I have no idea what generation it is, but I am going to test pinging that device, too.

Yeah, I actually have sudo in my binding config command. On Ubuntu, I just created a sudoers file to allow openhab to run hping3.
/etc/sudoers.d/hping3:
openhab ALL=NOPASSWD: /usr/sbin/hping3

Jmckenna how quickly do find the IPhone is detected when returning to the house/wifi network?

Worst case, one minute with my current configuration.

Hi jmckenna, thanks a lot for sharing this solution!
I would really like to try this myself because iBeacons are proving troublesome for me :frowning:
However, I don’t have access to a development environment where I could perform the modifications on the binding source. Could you maybe share your compiled binding file?

I would also appreciate that!

Maybe I’m wrong but I think Network Health Binding main usage is to detect presence by pinging Phones or other devices. Would it be possible to make it officially iPhone compatible?

The problem is NOT the binding, the problem is the iPhone, because it goes to sleep mode during wifi activity.
Android phones and all other devices are working great with the binding.

So the question is, can Apple make the iPhone compatible!

I understand you sihui, but I think Apple drives the world of smartphones so we need to adapt to her.

The patch above is meant to be generic and not specific to iPhones. You can include a command in the binding config to execute before each ping. The command I used was to wake up an Apple device.

That being said, I can’t think of any other use cases where executing a command before a ping would be helpful. And with so many Apple devices out there (iPhones, iPods, iPads), maybe the NetworkHealth binding should officially support these types of devices.

Apple surely isn’t going to bend over backwards to accommodate OpenHab.

This was sarcastic! Maybe I should have put a smiley at the end …

FWIW, I use the NetworkHealth binding for purposes other than presence detection. For example, I use it to verify I can reach my network gateway and that there is a healthy network connection between the gateway and the internet. I also use it to verify that IP cameras are alive and communicating on the LAN.

I did iPhone detection dumping the active wifi connections from my access points. Here is how it was done.

I’m brand new to openHAB but have worked on a lot of Bluetooth projects. If you know the Bluetooth MAC address of the device in question it should be simple enough to scan for its existence. You can do this with phones (assuming Bluetooth is turned on), and even fitness trackers.

I’ve done this and it works well if the phone is close enough to the server. Unfortunately, my home is not friendly to RF so the range is very limited.

I, like @steve1 do not use the Network Health binding for presence detection, but other “network health” checks like verifying servers, VoIP phone, Internet, etc.

It is very basic network management, but is nice to centralize a little bit so if network problems do come up, you can create interaction with the user in the home to let them know.

Hi All

I am trying to modify the Networkhealth binding code to be able to execute commands. For that end I need to add the library apache-commons-exec to the binding project. I managed to add this dependency in eclipse so no error in the GUI are displayed, but when I try to build the whole project (mvn clean install) it fails, because it cannot find some clasess that I use and they are inside the jar file (apache-commons-exec). My question is, how can I modify the pom.xml file or any other files (build.properties…) in order to build successfully the project? I added a dependency to this jar inside the pom.xml file for the project (networkhealth binding) with no luck…

Thanks in advance

@jmckenna mind sharing the binding?