iPhone Presence Detection with hping3 and ARP

Looked up the item receiving the status update from the script using Openhab Rest API - http://openhabianpi:8080/doc/index.html#!/items/getPlainItemState
Seems like we have found a clue on what’s going on we my failing presence detection. :slight_smile:
This is the response:

Response Body
Smartphone 10.0.0.110 is not present
Response Code
200
Response Headers
{
  "content-length": "36",
  "server": "Jetty(9.3.22.v20171030)",
  "content-type": "text/plain"
}

wtf? I was expecting a ON or OFF value here… If this is the string output i clearly cannot use this item in the if-statement in my rule:

if(RunarMobil.state == "OFF")

I’m wondering if im supposed to use a second item (the device item) in this part of the rule?

If you are using Seaside’s script it clearly echos

echo "A's iPhone is ${statusMessage}"

You need to change the echos as appropriate for what you want.

Are you aware that this script is basically built into the Network binding now?

Thank you for trying to help me.
No. As i stated i was following the tutorial in the very first post by @Maurits28. If you think you see the problem i need a guiding hand here.

Edit: Last Q - No i was not aware of that. please provide a link where i can read me up on the topic? :slight_smile:

You need to be on 2.2 release. See the readme for the Network binding. All the stuff talking about arping is basically talking about the binding doing what this script does.

https://docs.openhab.org/addons/bindings/network/readme.html

1 Like

Ah!!! Totally missed this. I know i’ve read this before and have actually been taking advantage of this without even realizing that i was. I’m on Openhabian 1.4 and i assume this “arping service” was included in the bundle. As a novice on Raspberry Pi and its operating system i find myself lost all the time in the jungle of different solutions and software-versions. This was one of these moments. Spent several hours trying to get this to work…

If i understand this correct i need to write me a rule that take into consideration “flapping” to avoid unintended action triggered and maybee use the DHCP request from the Android phone as a “reentry trigger” in my presence rule.
Thanx for helping me out Rich !

One last quick question. Im planning to follow this example: Generic Presence Detection
I’m not barking up the wrong tree here again? :smile:
It seems clean and simple so i think i’ll be able to work that solution out on my own.

I’ve used that for years now and it still works fine. It is what I would recommend for flapping and in case you ever decide to add more sensors for each person.

1 Like

I use Thomas arping
Where do i config the arping parameters in network binding ??
thanks

https://docs.openhab.org/addons/bindings/network/readme.html#binding-configuration

did it work for you ?
my presecence detection is not satisfiying

I run in Docker and don’t want to run OH as root so I don’t use the arping feature. I have an external python script that executes a version of the above script for me. Others have reported great success with the arping feature of the Network binding.

I’m new to openHAB2 and just want to know if this method in the first post is active or has been replaced with something else since?

I’m currently having problem with my iPhones wifi connection dropping in and out.

The Network binding now will do arping so you can just use that. Look at the readme for the binding for details.

There is also an iCloud binding people have been successful using.

Hi,
Has anybody measured the impact of waking the iPhone’s WiFi to answer the pings in battery life?
Regards.

Excellent question @jjmeseguer, I was thinking about the same issue. Yesterday I spent some time googling for that with no success.

So if someone has more information, that would be great!!

Thank you

Thanks Rich!
The network binding works now after some configuration. I extended the time to 90000ms before the device is stated as offline. Seems to be working since then. Before the iPhone presence went offline/online around every minute.

1 Like

Sorry for my ignorance… How set IP and MAC on script file?

(Sorry for my ignorance) :sweat_smile:

How set IP and MAC on script file?

I am receiving the following error on the presence…Anyone have any ideas?

2018-10-08 17:01:01.774 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Determine presence Iphone’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: IphonePresence.rules#|::0.2.1.2.0.0.0.0.2.0.1::0::/1)

Blockquote

How does one update to 2.19?