Network Health Binding next to useless?

I am running OH 1.8.2 on Windows 10 pro. I wanted to use the Network Health binding as a presence detector but it is always detecting the devices as connected even when they aren’t.

If I turn a device off, it will recognize that in the next check, but all checks following this it shows an offline device as connected.

The phones all have static IP’s and I have tried both the device names and their IP’s. I have also tried both with and without the presence detection rule in the samples.

All of the threads I have seen on this issue have no resolution so I am assuming there still isn’t one?

This setup (OH 1.8.2) is working fine for me (Android phones, no iPhone, that’s a different story!):

items:

//Presence
Switch    Presence    ""
Switch    phone1    "AAAA"    <present>    (gMobiles)        { nh="192.168.x.xx" }
Switch    phone2    "BBBB"    <present>    (gMobiles)        { nh="192.168.x.xx" }
Switch    phone3    "CCCC"    <present>    (gMobiles)        { nh="192.168.x.xx" }
Switch    phone4    "DDDD"    <present>    (gMobiles)        { nh="192.168.x.xx" }

rule:

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

import org.java.math.*
import org.joda.time.*

rule "Periodically check presence"
when
    Time cron "0 */5 * * * ?"
then
        if (Presence.state == ON)
        {
                if(gMobiles.members.filter(s | s.state == ON).size == 0) {
                        logInfo("PresenceCheck", "No phone within reach, checking for flapping")
                        if(gMobiles.members.filter(s | s.changedSince(now.minusMinutes(5))).size == 0) {
                                logInfo("PresenceCheck", "Nobody is at home")
                                Presence.sendCommand(OFF)
                        }
                }
        }
        else
        {
                //For initialisation. If Presence is undefined or off, although it should be on.
                if(gMobiles.members.filter(s | s.state == ON).size > 0) {
                        Presence.sendCommand(ON)
                }
                else if (Presence.state == Undefined || Presence.state == Uninitialized) {
                        Presence.sendCommand(OFF)
                }
        }

end

rule "Coming home"
when
        Item gMobiles changed
then
        if (Presence.state != ON) {
                if(gMobiles.members.filter(s | s.state == ON).size > 0) {
                        logInfo("PresenceCheck", "Somebody is home")
                        Presence.sendCommand(ON)
                }
        }
end

Yeah I’ve tried that rule, actually the binding will check any ip you have written in the items anyway. Are you running Win 10? And does it correctly tell you when a device is connected or not everytime?

Please track this issue.

No, Raspbian on Raspberry Pi. On RPi it’s working fine, but as you can see in the issue @watou has mentioned, there are problem with Windows, I wasn’t aware of that.

Yep I’ll try it on Ubuntu when I can be bothered swapping over the hard drive and let you all know the result.