[SOLVED] Windows ping does not work correct


I am struggling with the network-binding.
On my Raspberry with OpenHABian (version 2.2) everything works fine.
For testing I use my Windows PC with Windows 10. On this PC the version 2.1 works good.
But with versions 2.2 and 2.3 I am in trouble.

The problem is that devices are always online. Even IP-addresses that don’t exist are reported “online”.

It took me a while before I find out what is the cause.
It is the windows ping. A windows ping command returns an exit value of zero when devices are on the local subnetwork, even if the are unreachable. I found a link that explains it:

The reason that I did not have that problem with version 2.1 is that I set
in the things definition.

But in version 2.2 and 2.3 this setting changed to allowSystemPings=“false”) must be in the network.cfg file.
And I don’t think this network.cfg file is never read. (I have done some debugging on the binding.)

A site effect of not reading the cfg file is that I can’t set a path to arping. Having no arping gives error messages.

I hope this can be corrected.

Correct. A 2.x binding does not read a cfg file at all.
The settings are done either in a things file or via GUI (PaperUI or HABmin).

Also note that the thing configuration has changed in newer builds:


is now


Edit: Interesting, that binding has changed and reads some sort of config file now … very strange.
As I understand the file is not network.cfg, but org.openHAB.binding.network.cfg in/etc folder

I know and I use the new network:pingdevice since version 2.2.
The network-binding documentation describes a cfg file. I have tried a network.cfg file in the conf/services folder and a org.openHAB.binding.network.cfg file in the userdata/etc folder. Both with no luck.

For the arping.exe file, I have tried to set the path inside $PATH and I have tried placing a copy of the arping.exe file in different folder of openHAB. I keep getting the message:
Cannot run program “arping” (in directory “.”): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden)

Perhaps I do something wrong, but I don’t know what.

But most important is the fact that the windows ping does not do what it is supposed to do. By that every IP address is marked online.

I don’t think this is strictly true in all cases. From the Network Binding readme:

Create a file org.openHAB.binding.network.cfg in your openHAB/etc directory and use the above options like this:

So either the readme is out of date or the Network binding is supposed to support a .cfg file.

However, the above may be inaccurate. I would expect that this file would need to be placed in the services folder of the openHAB/etc folder (/etc/openhab2/services). @Anton_Wedemeier, place the file org.openHAB.binding.network.cfg into /etc/openhab2/services and see if that makes a difference.

That’s the reason I already provided an edit shortly after posting :grinning:
But I guess your are on your phone and replying via email …

1 Like

I think that that is the folder OPENHAB\userdata\etc on a windows pc. This folder contains a whole lot of cfg files, like the org.ops4j.pax.logging.cfg file. I already tried to place a org.openHAB.binding.network.cfg file in that folder, with the parameters mentioned in the documentation. It made no difference.
I am not good at it, but I placed breakpoints inside the binding on lines where (I think) the binding must act on a cfg file and these breakpoints where never activated.

Actually I opened it, had to leave for awhile, came back and didn’t refresh to see the edit. But the same result. You beat me to it. :smiley:

Nope, its OPENHAB\conf\services on a Windows PC.

Those are config files for the Karaf console. Binding configs do not go there. Unless you know what you are doing there should be no need to edit anything in userdata. About the only time you should do anything with files in userdata is:

  • clear the cache
  • changing the logging config
  • changing karaf console login configs
  • fixing a problem (e.g. you removed a broker configuration in mqtt.cfg but the logs indicate the removed one is still there)

If the cfg file is still supported (I have no reason to believe it isn’t) the config will go in conf/services.

The other option I already tried was a network.cfg file in the OPENHAB\conf\services.
I have not tried to put a org.openHAB.binding.network.cfg named file in that folder. I will try that tomorrow.

I started this topic pointing out that the windows ping is not working as it should.
I hope that someone will response to that. If the windows ping works as expected then the problem with the config file is less important (for me).

I’ve seen it reported before that the Windows ping doesn’t work correctly.

I can confirm that the Windows ping is NOT working as expected. I switched back to the old Network Health Binding for my Windows installation.

I did a search but did not find a report of this issue. But there are a lot of topics and I could have simply missed it.

I use windows as a test environment for my Raspberry (‘production’) installation. Therefor the configuration should be as much as possible equal.

I agree and I also would like to use the new network binding. So I am also interested if there is a solution to this.

I opened this topic about 8 motnhs ago:

However at that time I was not aware that this was only a Windows related issue.

I only found out when I looked into the source. Then I search on the internet for an explanation. And I found it, see the link in the first entry. A solution is also in that link.

But not solution for the network Binding. Or do I misunderstand something?

Sorry, I did not mean that I have solved it, but that in the link a solution is given.

The solution would be that the output of the ping process should be tested against some text,
as in:
ping -n 1 %1|Findstr /I /C:“timed out” /C:“host unreachable” /C:“could not find host”

Of course this must be changed in the source code.
I wanted to try it out myself. But just now I can not get the latest developer installation downloaded. The Eclipse Installer gives errors. I am no expert in these matters.

Meanwhile I have tried every combination of cfg-files and folders. But I do not see any change.

If, as said, “A 2.x binding does not read a cfg file at all.” then, I think, the framework of a binding does not give a config file to the network binding. And inside the source of the binding I do not see code that does read a file itself.

In version 2.1 all parameters where given in the thing definition; that worked. If I understand things correctly, these parameters should now be given through a bridge.

The reading of the config file gets done by coffee in esh and the parsed result gets passed to the binding. The binding doesn’t read the configs itself.

OK. That explains that the source code does not read a file.

Some days ago I had placed breakpoints to see if the NetworkBindingConfiguration update function got called and it never happened. I will retry this.

Edit: Only got called with the default values.

Care to try out this test jar? I think it should fix the problem.

Code change is here, for those interested.