OpenHAB3 Network Binding Configuration with Text Files on Windows 10 - awake IOS iPhone not detected

I am migrating my OpenHAB installation from 2.4.0 where the legacy networkhealth binding is used to 3.0.1. network binding.

I use the binding to monitor device connectivity and to detect human presence.

I was using the networkhealth binding that has since been obsoleted and it worked great, albeit the iPhone could not be detected when in deep sleep mode. That was ok with me for my application.

I have configured the new network binding as follows:



Thing network:pingdevice:IP51 [ hostname="", retry=10, timeout=2000, refreshInterval=10000 ]
Thing network:pingdevice:IP20 [ hostname="", retry=10, timeout=2000, refreshInterval=10000 ]


Switch IP_Lamp_LivingRm		"Lamp-LivingRm [%s]"					{channel="network:pingdevice:IP51:online"}
Switch IP_Robert_Cell 		"IP_Robert_Cell [%s]"		(gMobiles)  {channel="network:pingdevice:IP20:online"}

IP51 works fine just as expected
IP20 does not work because it is my iPhone. I have tested OH3 while my iPhone is playing a YouTube video, ie. fully alive and breathing. However, IP20 is still not detected.

I have read about creating a
file and providing 1 line entry
I don’t think this file is needed, but out of deseparation I tried it anyway.

I will be happy to detect the iPhone when it is awake. It would be a bonus AND desirable to be able to detect it while in deep sleep mode, or be able to wake it out of deep sleep mode so I can detect it.

Any help will be appreciated. Thanks in advance.

that path doesn’t look right and you’ve set that parameter in the cfg file already anyway.

Are you certain your iPhone is getting the same IP address. Not too long ago both iPhone and Androids have taken to spoofing their MAC address as a privacy measure. With a different MAC every time it connects any static IPs you may have configured in your router won’t work.

Is arping installed and in your path?

On Windows there used to be a problem but I don’t remember which way it went. Either the system ping didn’t work or the Java ping didn’t work. Maybe try to enable the system ping. If you have arping installed and available it should be able to detect the iPhone even when it’s asleep, but only when it has the same IP address every time it connects.

iOS is supposed to maintain the MAC address whenever it connects that specific WiFi. I’m not sure if that’s the same for Android, but it would make sense.

You can also turn off the randomization.

Thanks Rich! You are absolutely right :slight_smile:

  • I deleted the referenced .network file.

  • My iPhone is assigned a static ip in my router. However, it connected elsewhere BECAUSE the “private address” setting on the iPhone was enabled. I was not aware of such a setting. I turned that off and the phone was immediately discovered.

It seems best practice that “private address” should be enabled. Perhaps the iPhone has another setting that allows to to repeatedly use the same MAC address when it reconnects to a trusted network. I need to research that.

  • You suggested: Maybe try to enable the system ping on my Windows machine. Is that enable outgoing or incoming. IE, does it enable OH / Windows to send pings, of does it allow Windows to be pinged? My impression was that it enables Windows to be pinged.

  • I’ve read about arping but do not understand how to install / activate it. Google only responds with ancient posts. Do you have any pointers?

Thanks again. (You also helped me with my mqtt problem. From what I learned with mqtt I was able to get the wemo binding working on first try: :slight_smile: I have another thread still open trying to resolve an exec binding issue.

I’m guessing you assigned the static IP based on the original MAC address, and then the phone subsequently started identifying itself with the privatized address. So, you might be able to turn that setting back on and then redefine your static IP to reference the private address.

Does the private address remain constant of is it randomized?


Which would disable system ping and cause it to use Java.

Those “ancient” posts are probably still valid. This binding hasn’t changed much in this area for years.

Per the link in my earlier post, it should be constant within the same network.

To improve privacy, iOS 14, iPadOS 14, and watchOS 7 use a different MAC address for each Wi-Fi network. This unique, static MAC address is your device’s private Wi-Fi address, used for that network only.

On a side note, this feature was apparently hidden in Android 9’s developer settings, and is now the default in Android 10.

I can say that for Android at least, when Android 10 installed it immediately created a different MAC for all networks it connected to after the upgrade, including networks that were previously connected to. As a result our phones were no longer detected. The settings can be changed on a per ssid basis on Android.

I have 2 WiFi SSIDs in my home. With limited testing on my iPhone I am finding that the “private address” MAC address holds constant for a SSID but changes among SSIDs.

I am continuing to test my iPhone.
The network binding things configuration documentation states 4 examples:

network:pingdevice:one_device [ hostname="" ]
network:pingdevice:second_device [ hostname="", macAddress="6f:70:65:6e:48:41", retry=1, timeout=5000, refreshInterval=60000 ]
network:servicedevice:important_server [ hostname="", port=1234 ]
network:speedtest:local "SpeedTest 50Mo" @ "Internet" [refreshInterval=20, uploadSize=1000000, url="", fileName="50M.iso"]

followed by

Use the following OPTIONS for a network:pingdevice:
hostname: IP address or or or or hostname of the device.
macAddress: MAC address used for waking the device by the Wake-on-LAN action.
retry: After how many refresh interval cycles the device will be assumed to be offline. Default: 1.
timeout: How long the ping will wait for an answer, in milliseconds. Default: 5000 (5 seconds).
refreshInterval: How often the device will be checked, in milliseconds. Default: 60000 (one minute).

Per the one_device example, is it permissible to use the hostname: IP address or or or or hostname of the device. option? IE.,

network:pingdevice:one_device [ hostname="6f:70:65:6e:48:41", retry=1, timeout=5000, refreshInterval=60000 ]

Is it an option or not? The documentation lists it as an option but my testing does not work with OR without it.

Here' my `.things` file
Thing network:pingdevice:RobertRoot [ hostname="e4:9a:dc:6f:88:b2", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:RobertMain [ hostname="7a:74:3e:0f:3d:ac", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert17	[ hostname="1a:bc:16:a8:23:43", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert18	[ hostname="ca:6d:1f:4b:65:57", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert5G	[ hostname="46:c2:74:f6:34:46", retry=10, timeout=2000, refreshInterval=10000 ]

I have not been able to get any of these work.

I also tried:

Thing network:pingdevice:RobertMain [ hostname="7a:74:3e:0f:3d:ac", macAddress="7a:74:3e:0f:3d:ac", retry=10, timeout=2000, refreshInterval=10000 ]

and it does not work.

The only way I have been able to get OH3 to recognize the device is by assigning my iPhone to a router static address and configuring as follows:

Thing network:pingdevice:RobertMain [ hostname="10:0:0:20", retry=10, timeout=2000, refreshInterval=10000 ]

but then if I switch the iPhone to “wifi off” OH3 CONTINUES to discover it!
I have even put the phone in “airplane mode” and it still falsely discovers it.

Either the binding has an issue or I’m doing somethin wrong.
Any suggestions?

Thanks again.

You’re confusing hostname with macAddress. A device would never identify itself on a network as its MAC address. The hostname can only be an IP or the network name you gave the device in its settings.

If you try to use the MAC as the hostname, it will definitely fail. I think what you want to try is to omit the hostname completely.

Thing network:pingdevice:RobertMain [ macAddress="7a:74:3e:0f:3d:ac", retry=10, timeout=2000, refreshInterval=10000 ]

I have no idea if this will work. I was already using static IPs before I got into openHAB, so I’ve never felt the need to dig deeper.

  • Thanks for the clearing up my misinterpretation of “hostname”.

  • The only channel of the following that works is the last channel where IP is the router static IP address.

The first 6 channels set the switch item to OFF. If I turn the switch item ON then OH returns it to OFF after a slight delay. But it never turns it ON.

The 7th channel switch item acts differently. It’s .state is null and if I turn the switch item ON then it stays null, AND OH returns it to OFF after a slight delay, but the .state remains at null no mater what I do.

	Thing network:pingdevice:RobertName [ hostname="RA.Nyholm", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:RobertRoot [ hostname="e4:9a:dc:6f:88:b2", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:RobertMain [ hostname="7a:74:3e:0f:3d:ac", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert17	[ hostname="1a:bc:16:a8:23:43", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert18	[ hostname="ca:6d:1f:4b:65:57", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:Robert5G	[ hostname="46:c2:74:f6:34:46", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:RobertMAC	[ macAddress="7a:74:3e:0f:3d:ac", retry=10, timeout=2000, refreshInterval=10000 ]
	Thing network:pingdevice:RobertIP	[ hostname="", retry=10, timeout=2000, refreshInterval=10000 ]e only one of the following ```

If I could get only one of the non-working channels to work I would choose the first where the hostname is my device name. With it a wifi connect via any of the SSIDs would be detected, and I would not need to configure my router with static IPs.

Is that too much to hope for?
Any suggestions?

Okay, so that would seem to confirm that you have to have the hostname with an IP address.

But let’s put that aside, because I think you might be overcomplicating this. As I understand it, your goal is to detect your phone regardless of which WiFi it’s on. You can do this with a group:

  1. Create a thing/item for your phone when it’s connected to the first SSID (with a static IP)
  2. Create a thing/item for your phone when it’s connected to the second SSID (with a different static IP)
  3. Create a group that is ON when one of the two items is ON.

Personally, I would install a mesh router to remove the problem entirely, but I’ll look for any excuse for a tech upgrade.

Thank you. Your suggestion with static IPs will work.

I’ve been doing further testing since I would really like my devices to be discovered by “Hostname” as the documentation states is achievable. Since I had only failures discovering the iPhone I decided to try my pc.

I found that “Hostname” does work if and only if MyComputer is connected to the router via hardwire. It is discovered almost immediately when plugged in, and undiscovered within ~1-2 minutes.

Thing network:pingdevice:MyComputerChannel [ hostname="MyComputer", retry=10, timeout=2000, refreshInterval=10000 ]

If I connect to MyComputer via WiFi it is not recognized :frowning:
I have tried clean starts by simultaneously rebooting the router and MyComputer, and restarting OH. No matter what I try the binding will not discover MyComputer when connected via WiFi.

My conclusion is that the network binding has issues. It does seem strange that the “Hostname” does not work with WiFi but does with hardwire. I would not think the host’s name to be altered, prefixed, or appended with additional information that might be confusing the binding?

Do you have any thoughts or suggestions?
Do you know how I can report this issue with the binding to its author(s)?

is your computers hostname resolved to it’s IP address within the network when it is connected via WiFi ?

There’s not enough information here to draw any conclusions. I’m not saying you’re wrong, but you’re assuming that there are no issues with your network. And in my experience, that’s just as likely to be the problem.

I don’t consider local hostnames to be reliable. I used to find that one of my Android devices could only resolve my openHAB server by its IP address, and then one day the hostname started working…even though I didn’t change anything. Windows devices tend to be less problematic.

You also have two WiFis in the same space and attached to the same network. I have no idea about your network configuration, but the problem could be that your iPhone identifies itself with the same hostname on two different networks.

I use static IPs because they always work, and I use mesh to avoid having my devices jump between two SSIDs. So, my suggestions remain as above.

Problem solved. :slight_smile:

I have a love / hate relationship with OpenHAB. Way too many “features” that documentation does not address.

Thing network:pingdevice:RobertName [ hostname="RA.Nyholm", retry=10, timeout=2000, refreshInterval=10000 ]

does not work, but

Thing network:pingdevice:RobertName [ hostname="RA-Nyholm", retry=10, timeout=2000, refreshInterval=10000 ]


The binding does not like the decimal in the host name even though it is a very common naming convention. I suppose the author looks for a decimal and assumes it is an IP address?

The documentation needs to be updated to include “The hostname cannot contain any decimals”.
What other characters will it not accept :frowning:

I believe what’s happening is that you’re not familiar with how iOS generates device hostnames.

I assumed that you had intentionally named your iPhone “RA.Nyholm”, in which case that’s how it would identify itself on your network. But if it’s named “RA Nyholm”, then iOS converts that to RA-Nyholm. Spaces become hyphens, and special characters are excluded. So “Robert’s iPhone” would become Roberts-iPhone.

Actually, now I’m not even sure if naming it “RA.Nyholm” would keep the period, or convert to RANyholm. I think the period would stay in that case.

I don’t have an iPhone handy to test, so correct me if I’m wrong, but that’s how hostnames work for the iPads I’ve maintained in my workplace. I can’t find any evidence on the web that Apple has changed this practice.

While this is not a case of the documentation being incorrect or a feature being unaddressed, it is true that it happens, because the docs are maintained by community members like you and me. I’d caution you again about jumping to conclusions that something is broken/incorrect, but I’d also encourage you to submit edits to the docs when you come across something that could be improved. You just need a GitHub account, and once you do it a few times it becomes really easy. The only way the docs will improve is if the people who notice issues improve them.

If you’re interested, I can provide some links to help you get your feet wet.

My NetGear router sees and lists the decimal in the host name. The binding must eliminate or replace the illegal characters. But which characters?

I’m a weekend warrior and am programming new features or new applications every several months to a year. I should attend an online class to understand more.

I am a member of the community and GitHub. I submitted a documentation note to the link at the bottom of the binding documentation. Who reviews the submission to ensure it’s not further misleading casual users like me? Hopefully the author?

Thanks for helping me thru this issue.