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 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.
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.
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).
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,
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.