So is the arping reply interval of up to 94s as expected?
I also did the port 67 forwarding described in the binding doc, but uses_dhcp_listen is still a: no
When I check top (-V) I can see ping being run regularly, but never arping.
My toolpath is set to /usr/sbin/arping and the openhab user given privilege in sudoers:
edit: showing now after one additional restart of openhab
however i still have the same problem as @OMR in regards to the DHCP_state. all settings in regards to port forwarding are done as mentioned in the binding doc, but still getting the “No Access …” message.
Got it working and it seems to work really reliable for my P10plus.
however i noticed that in the config nothing is showing for the “Presence _detection_type”
is there a reason for that? (runninh lates bundel 2.2.0.201709102120)
I am using RPI-3B with openhabian-jessie lite version,
I have installed ARPing with 2.19 version,
I have use sudo visudo and add below line,
openhab ALL=NOPASSWD: /usr/sbin/arping
but openhab still don’t have access right,
I set a rule for test purpose, run command as below
var String arping = executeCommandLine("arping -c 1 -I eth0 192.168.xxx.xx", 120*1000)
Result:
17:58:45.908 [INFO ] [clipse.smarthome.model.script.AirCon] - result:arping: libnet_init(LIBNET_LINK, eth0): libnet_open_link(): UID/EUID 0 or capability CAP_NET_RAW required
arping: you may need to run as root
I’m pretty sure the openhab user is the right user in this case. OH runs as openhab, not openhabian, so openhab is the one that needs the permission to run arping.
When testing the arping command from root@shs2:/home/omr# su -l openhab -s /bin/bash running just the /usr/sbin/arping command seems to work, but providing actual parameters it will tell you you need to be root.
After fiddeling with visudo and entries in /etc/sudoers for hours, I ended up running root@shs2:/home/omr# chmod u+s /usr/sbin/arping. Then it worked!
I can even see in top (-V) that arping is called regularly. But, my Android phone is not seen, even though manual arping detects it. I suspect that is because on Ubuntu, my lan port is not named eth0, but enp3s0:
I gave up, I found run script at router response and reliability much better,
I shall monitor closely for 48 hours.
I modify @Seaside script and run it on router, result looks more reliable than I think
#!/bin/bash
#Enter your ip of the devices here, separator space
DEVICES="192.168.0.1 192.168.0.2"
for i in `echo $DEVICES`; do
status=`arp -an $i | awk '{print $4}' | grep "..:..:..:..:..:.."`
statusMessage="OFF"
#A mac will be 17 characters including the ":"
if [ ${#status} -eq 17 ]; then
echo "Phone $i is detected!"
statusMessage="ON"
else
echo "Phone $i is not present"
statusMessage="OFF"
fi
if [ $i == "192.168.0.1" ]; then
curl --max-time 2 --connect-timeout 2 --header 'Content-Type: text/plain' --request PUT --data '${statusMessage}' http://192.168.0.255:8080/rest/items/iPhoneA_Online/state
echo "A's iPhone is ${statusMessage}"
fi
if [ $i == "192.168.0.2" ]; then
curl --max-time 2 --connect-timeout 2 --header 'Content-Type: text/plain' --request PUT --data '${statusMessage}' http://192.168.0.255:8080/rest/items/iPhoneB_Online/state
echo "B's iPhone is ${statusMessage}"
fi
done