[Network Binding] Problems with setup

Hey folk,

i just want to get a view of my current “online” network devices and will get a message after a change of the status…

Following setup:

Thing network:pingdevice:ping_hue 				"Ping Hue Bridge" 		@ "Diele" 		[ hostname="192.xxxx", port="0", retry="2", timeout="5000", refresh_interval="60000", use_system_ping="false", dhcplisten="true" ]
Thing network:pingdevice:ping_fritzbox_cmhw_1 	"Ping FritzBox-CMHW-1" 	@ "Diele" 		[ hostname="192.xxxx", port="0", retry="2", timeout="5000", refresh_interval="60000", use_system_ping="false", dhcplisten="true" ]
Group gStatusNetwork (gStatus)

Switch	Ping_Hue_Hub			"Ping Hue [%s]" 			<colorpicker> 	(gStatusNetwork)	{ channel="network:pingdevice:ping_hue:online" }
Switch	Ping_FritzBox_CMHW_1	"Ping FritzBox-CMHW-1 [%s]" <network> 		(gStatusNetwork)	{ channel="network:pingdevice:ping_fritzbox_cmhw_1:online" }
rule "Ping Hue"
when
    Item Ping_Hue_Hub changed
then
        if(Startup.state != ON){
                sendTelegram("Carsten", "Hue Bridge ist jetzt "+Ping_Hue_Hub.state)
        }
end

rule "Ping_FritzBox_CMHW_1"
when
    Item Ping_FritzBox_CMHW_1 changed
then
        if(Startup.state != ON){
                sendTelegram("Carsten", "Fritzbox-CMHW-1 ist jetzt "+Ping_FritzBox_CMHW_1.state)
        }
end


Now i see that the devices are online according to the sidemap…
But when i un plug my hue bridge now status is changed or any message is send to my telegram bot…

Any ideas were are my faults are?

Thanks :slight_smile:

Edit: Rule

There is a mistake inside your rule.(I think) There is no Item named Ping_Hue. Just an item named Ping_Hue_Hub. ping_hue is a thing. :thinking:
Telegram send +Ping_Hue.state still a thing?
Also this if(Startup.state != ON) looks strange. Is there and Item named Startup? What is it?

rule "Ping Hue"
when
    Item Ping_Hue_Hub changed
then
        if(Startup.state != ON){
                sendTelegram("Carsten", "Hue Bridge ist jetzt "+ Ping_Hue_Hub.state)
        }
end

Thanks for this hint :slight_smile: But why my Sitemap item is not switched to off this has nothing to do with the rule, or am I wrong?!

Correct… this is strange…
Question? Why Textual configuration of the Network things and not via PaperUI?

Yes should be a question :smiley:
Why the item is not switching off when no connection…

Ehm when i setting everything up via text i have later no problems with resetting up etc.

Me neither. I keep a backup of my /items /services and /var/lib/openhab2/jsondb so I don’t need to do it again via PaperUI

2 Likes

Ok, but the Problem is that the items are not switching off when I unplug a Device?

How long are you waiting for the Network binding to report? You currently have your Things set to only check once a minute and have a timeout of five seconds so you have to wait at up to 65 seconds before Network will report the device as offline.

Also, if you are using a recent snapshot (anything after around build 900 I think) the capabilities and Thing definition syntax changed significantly. See the readme for the Network binding.

Your thing configuration is a mix of Openhab 2.1.0 and Openhab 2.2.0

In Openhab 2.2.0 change:
refreshInterval=60000 not refresh_Interval=60000

Delete → use_system_ping=“false”
Delete → port=“0”

Only the IP Adress must in " " … the other are Integer and need no " "

This is an working Example … for my Fritzbox
Openhab 2.2.0

network:pingdevice:fritzbox [ hostname="000.000.000.000", retry=4, timeout=5000, refreshInterval=60000 ]

http://docs.openhab.org/v2.1.0/addons/bindings/network/readme.html and Switch to your Version

1 Like

Thanks now it is working :slight_smile:
I only get this warning…can I ignore that or is there something wrong in my settings!?

2017-11-24 14:02:08.627 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "arping" (in directory "."): error=2, No such file or directory)

install arping running: sudo apt install arping

1 Like

Just upgraded to OH2 2.2, and the network binding is killing two of my IoT devices (ie they hang).

This worked fine in 2.1, but there have been a lot of changes for the 2.2 release, and it’s the arping that kills my two devices.

I’ve renamed arping to stop this happening, but does anyone know how to disable arping in the binding? maybe on a per-device basis (it only affects these two devices).

I’ve looked at the binding readme, and it’s not very clear, it says:

Create a file org.openHAB.binding.network.cfg in your openHAB/etc directory

Now I’m assuming this means /var/lib/openhab2/etc as it’s not clear what the openHAB/etc directory is, but the only option is

allowSystemPings=false

It’s not clear if this is ping, or arping or both?

In addition, it doesn’t work, so I’m assuming the location is wrong, or the file name is wrong. Why the non-standard naming? ie openHAB vs openhab in the file name, and why would this not be in /etc/openhab2/services like all the other binding configurations?

Anyone have any suggestions?

Thanks,

You can set the arpPingToolPath config parameter to /dev/null instead of changing arping on your system which will effectively disable arping for the Network binding. I know of no way to selectively enable/disable arping on a Thing by Thing basis as far as I can tell.

https://docs.openhab.org/installation/linux.html#file-locations

You can use the following configuration options:

  • allowSystemPings: Use the external ICMP ping program of the operating system, instead of the Java ping. Useful if the devices cannot be reached by Java ping. Default is true.
  • allowDHCPlisten: If devices leave and reenter a network, they usually request their last IPv4 address by using DHCP requests. If we listen for those messages, we can make the status update more “real-time” and do not have to wait for the next refresh cycle. Default is true.
  • arpPingToolPath: If your arp ping tool is not called arping and cannot be found in the PATH environment, you can configure the absolute path here. Default is “arping”.
  • cacheDeviceStateTimeInMS: The result of a device presence detection is cached for a small amount of time. Set this time here in milliseconds. Be aware that no new pings will be issued within this time frame, even if explicitly requested. Default is 2000.

Thanks,

but I’m still not clear what the openHAB/etc directory is. In the link you give, one is /etc/openhab2 (and does not work), and the other is /etc/default/openhab2 which is a file.

There are of course other etc directories such as ~openhab/etc, but none of those work either. Configuring in Paper UI doesn’t make any difference either.

Thats why I’ve had to resort to renaming arping, to stop the binding using it.

Does anyone know what directory openHAB/etc actually is? I’m using Ubuntu with a repository install.

Thanks,

/etc/openhab2/services/network.cfg

Site configuration /etc/openhab2

That makes more sense that anything else, however, still doesn’t work.

Nothing I do makes any difference, the system insists on using arping, so I have to rename the command and restart openhab to stop this behavior.

Weird.