iPhone Presence Detection with hping3 and ARP

Thanks for the clarification!

However, I’m still getting the same error:

2017-08-30 10:00:00.068 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/var/lib/openhab2/scripts/iphone.sh" (in directory "."): error=2, No such file or directory)
2017-08-30 10:00:00.125 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/var/lib/openhab2/scripts/iphone.sh" (in directory "."): error=2, No such file or directory)
2017-08-30 10:00:00.138 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule Find My iPhone: The argument 'state' must not be null or empty.

Could you run “ls -l /var/lib/openhab2/scripts/iphone.sh” in a shell on your computer and paste the result here?

Also, I am slightly confused by the “<” in the first executeCommandLine, this should not belong in there…

Sorry, I was going to mask the ip, but it is internal. The “<” is not in the actual rule.

Here is the result of the ls command:

-rwxrwxrwx 1 openhab openhab 1455 Aug 28 10:00 /var/lib/openhab2/scripts/iphone.sh

Strange, now the only thing I can think of is for you to actually try to run that shell script on the command line (as the openhab user). e.g.

/var/lib/openhab2/scripts/iphone.sh foo bar

and see what happens. If I read the docu to the exec binding right (honestly, I don’t use that binding myself), an absolute path should be possible, they have examples like “/bin/bash something.sh”. See the example with “uptime” at the end of the docu (you are using exec1, right? the OH2 version doesn’t seem to have the ‘execCommandLine’ action…)

http://docs.openhab.org/addons/bindings/exec1/readme.html

Are you asking about the Exec Binding? I’ve installed the 2.1 binding for OH2.

@David_Graeff I’ve upgraded to the latest openHAB build today and tried to use the new Network binding. I’m stuck at

java.lang.IllegalArgumentException: Cache expire time must be greater than 0

thrown by this code part.

Here are my configuration details:

Thing   network:pingdevice:BirkePC  [ hostname="192.168.0.2", retry=1, timeout=5000, refreshInterval=10000 ] 

grafik

(the refresh_interval is a relic from the old binding config)

I could try to delete the cache, configuration or reinstall the Binding but I guess this could be a real bug that needs to be dealt with. Any ideas?

Yup, real bug and fixed in master.
Cheers David

I see, Thanks! Will test this evening.

Where can I find the latest jar of the network binding with the fix?

For arping, do I need to add the device MAC ID to the thing or just the ip of the device? (The demo documentation shows only the option of using hostname ip).

Thx!

It was merged and is now part of the latest openHAB 2.2 snapshot. Upgrading would be an option, otherwise you can upgrade individual bindings:

Thx,

The link is for influxdb …

Oh, wrong link :laughing: there you go.

@David_Graeff

I took the pull request version:

199 | Active | 80 | 2.2.0.201709051938 | Network Binding | org.openhab.binding.network

and it seems that it doesn’t work for me. The binding is working and devices that respond to ping do work, but devices that don’t respond to ping doesn’t work (status is off). When I run ‘arping’ from command line to the device I do get ping. Any idea why?

(This also happens with the version Thom pointed me too)

Thx!

Please direct your questions at @David_Graeff

OK, thx

Please have a look at the thing properties (eg via PaperUI). They should tell you about the recognized arping, because there are multiple existing. arping need to run without sudo on the command line.

Regarding providing the IP or MAC: You only provide the IP, arping does the rest for us.

Cheers, David

Thx will check later today.

In my case I am able to run arping from command line.

Will it be possible (or maybe it is already exist) to specify in the thing which method should be use (ping, dhcp, arping or all)?

Will the thing will work for devices that doesn’t respond to ping (e.g. Alexa)?

Thx

Please read the documentation of the binding to find all your questions answered :wink:

It is not possible to select the method, because we use all methods at the same time to improve accuracy.

Alexa has specific tcp ports open. Just use a servicething for alexa.

Cheers, David

1 Like

@David_Graeff

Can you please explain "They should tell you about the recognized arping, "?

In my system i can run arping in command line:

19:01:06] openhabian@openHABianPi:~$ arping
ARPing 2.14, by Thomas Habets thomas@habets.se
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w ] [ -W ] [ -S <host/ip> ]
[ -T <host/ip ] [ -s ] [ -t ] [ -c ]
[ -C ] [ -i ] <host/ip/MAC | -B>
For complete usage info, use --help or check the manpage.
[19:03:49] openhabian@openHABianPi:~$ whoami
openhabian
[19:03:54] openhabian@openHABianPi:~$

Please note that in my openhab binding configuration I see that the “ARP ping tool path” is set to : arping

Thx!

I have tested the binding with the iputils arping, You are using Thomas version. They should both work, but we need to confirm the recognised version. Please have a look at the thing properties in paperui.

Properties are read-only and I have used them for this binding instead of the log to show all kind of information.