Use NetworkHealth Binding for iphone detection

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?

Bump
Is anyone got a working binding to share?

I used the solution presented in Working Iphone wifi presence locator which is mainly the same but without modifying the binding. The hping3 command is sent via a bash script that sets the openhab value.

is this binding proper for iPhone and solve the deep sleep in wifi. I use windows 10 for my openhab