salexes
(Salexes)
January 11, 2018, 8:07pm
1
Hello guys,
as far as I read the latest Network Binding (openhab 2.2) has the arping feature already build in, correct ?
So I did the following:
Installed the Network Binding.
Installed this on my openhabian
apt-get install iputils-arping
as suggested in the documentation.
And then I use this to show the presence in my sitemap etc.
.sitemap file
Frame label="Anwesenheit" icon="presence"{
Text item=IPhoneA_Online label="A [MAP(home.map):%s]"
Text item=IPhoneB_Online label="A [MAP(home.map):%s]"
Text item=IPhoneC_Online label="A [MAP(home.map):%s]"
}
and this in my .items file
Switch IPhoneA_Online "A [MAP(home.map):%s]" <presence>
Switch IPhoneB_Online "B [MAP(home.map):%s]" <presence>
Switch IPhoneC_Online "C [MAP(home.map):%s]" <presence>
How do I now make sure arping works as it should ?
Because right now it seems that it does now work.
When I check the it via the basic us it shows the iphones as “Away”.
The iPhones are all in the house and connected to the wifi but not used (deep sleep mode)
Normally it should be able to detect the presence of it if arping would be working correctly, right ?
What could I do to get it working?
Could it be a permission issue ?
kind regards,
salexes
MartinKo
(Martin Korsrud)
January 11, 2018, 8:14pm
2
Are we reading the same documentation? This is how I use the network binding
network.things
network:pingdevice:ChromeCast "Chromecast Ping" [ hostname="192.168.0.16", retry=1, timeout=5000, refreshInterval=360000 ]
network.items
Number ChromeCastPingTime "ChromeCast Ping response" { channel="network:pingdevice:ChromeCast:latency" }
DateTime ChromeCastLastSeen "ChromeCast last seen" { channel="network:pingdevice:ChromeCast:lastseen" }
It could also be permissions. Run
chmod u+s /usr/sbin/arping
salexes
(Salexes)
January 11, 2018, 8:25pm
3
The thing is created via the PaperUi and linked with my item.
So that should be covered.
I tried to do: chmod u+s /usr/sbin/arping
But openhabian returns this error:
chmod: cannot access ‘/usr/sbin/arping’: No such file or directory
Any suggestions what to do now?
rlkoshak
(Rich Koshak)
January 11, 2018, 8:39pm
4
Did you set the permissions appropriately as documented in the README:
On Linux and MacOS you might need elevated access permissions, for instance by making the executable a suid executable (chmod u+s /usr/sbin/arping). Just test the executable on the command line, if sudo is required, you need to grant elevated permissions.
MartinKo
(Martin Korsrud)
January 11, 2018, 8:44pm
5
The file does not exist. I think you need to reinstall arping. Also it does not seem like you’ve connected the items to the network thing
salexes
(Salexes)
January 12, 2018, 12:13am
6
As you can see in the screenshot above the item iPhoneB_Online is linked with the network:pingdevice:ef03056:online
And this are the settings of my Thing
furthermore i reinstalled arping and run this command: sudo chmod u+s /usr/sbin/arping
but it is still not working as it should, what else could the issue be ?
Edit: this are the properties of the thing iphone b (which are shown in paperui)
uses_dhcp_listen no
dhcp_state Running normally
presence_detection_type ICMP_PING
arp_state THOMAS_HABERT_ARPING_WITHOUT_TIMEOUT
uses_ios_wakeup On
icmp_state IPUTILS_LINUX_PING
uses_arp_pings no
The arping version is: arping version 2.14
rlkoshak
(Rich Koshak)
January 12, 2018, 1:17am
7
Please see my post above. Did you change the permissions on arping like the docs say?
salexes
(Salexes)
January 12, 2018, 1:28am
8
Yes See the screenshot above.
I did everything correctly, right ?
rlkoshak
(Rich Koshak)
January 12, 2018, 1:35am
9
What happens when you run arping from the command line?
salexes
(Salexes)
January 12, 2018, 1:46am
10
This:
[02:44:18] openhabian@openHABianPi:~$ arping -c 1 -I eth0 192.168.1.113
arping: Unable to get the IPv4 address of interface eth0:
arping: libnet_get_ipaddr4(): ioctl(): Cannot assign requested address
arping: Use -S to specify address manually.
[02:45:46] openhabian@openHABianPi:~$ ^C
[02:45:53] openhabian@openHABianPi:~$
That is a correct command to test it right ?
What does that error mean ?
MartinKo
(Martin Korsrud)
January 12, 2018, 6:59am
11
It means that you have installed arping and the permissions are OK. However, it seems that you have no IP address on eth0. If you run
$ ifconfig
you should get a status of the your connections like this
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.0.120 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: xxxx::xxx:xxxx:xxxxx:xxxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4719521 errors:0 dropped:745 overruns:0 frame:0
TX packets:2870473 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1093198948 (1.0 GiB) TX bytes:1134241846 (1.0 GiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
.........
Of cause, you can only use network services on a configured network device. Find a device in the list (except lo) that has an inet address and use this device/address when you run arping from the command line to test if arping is working
salexes
(Salexes)
January 12, 2018, 2:09pm
12
This is what the ifconfig command returns:
eth0 Link encap:Ethernet HWaddr b8:27:eb:58:10:d7
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29847671 errors:0 dropped:0 overruns:0 frame:0
TX packets:22963182 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2201051689 (2.0 GiB) TX bytes:2839539209 (2.6 GiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:33433 errors:0 dropped:0 overruns:0 frame:0
TX packets:33433 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:7180204 (6.8 MiB) TX bytes:7180204 (6.8 MiB)
vethX2UO34 Link encap:Ethernet HWaddr fe:cb:57:a4:20:03
inet6 addr: fe80::fccb:57ff:fea4:2003/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:788187 errors:0 dropped:0 overruns:0 frame:0
TX packets:6543412 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:92331376 (88.0 MiB) TX bytes:721498224 (688.0 MiB)
wlan0 Link encap:Ethernet HWaddr b8:27:eb:0d:45:82
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
yahmbr0 Link encap:Ethernet HWaddr b8:27:eb:58:10:d7
inet addr:192.168.1.107 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fe58:10d7/64 Scope:Link
inet6 addr: 2003:75:6f05:cb00:ba27:ebff:fe58:10d7/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30573901 errors:0 dropped:0 overruns:0 frame:0
TX packets:23613800 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19454846166 (18.1 GiB) TX bytes:2612965462 (2.4 GiB)
What doest that mean ? Which one is the right one to test it with ?
MartinKo
(Martin Korsrud)
January 12, 2018, 2:38pm
13
It looks like yahmbr0 is a good candidate as it is the only device that have an IP4 network connection. Try
arping -c 1 -I yahmbr0 192.168.1.113
Seems to me should be yahmbr0 as is the only one that has an IP v4 address, see inet addr: 192.168.1.107
Eth0 has no IP address so no way it will work, so the instruction should be
arping -c 1 -I yahmbr0 192.168.1.113
salexes
(Salexes)
January 12, 2018, 2:47pm
15
This is the response:
[15:14:46] openhabian@openHABianPi:~$ arping -c 1 -I yahmbr0 192.168.1.113
ARPING 192.168.1.113
Timeout
--- 192.168.1.113 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)
This is the ip of my iphone: 192.168.1.113 so normally it should work, right?
is this the right output which is expected, or is something not working ?
If the iPhone was sleeped is an asnwer I would expect. Try to run the same instruction let’s say 5 times and see what happens
even better try this:
arping -c 5 -I yahmbr0 192.168.1.113
rlkoshak
(Rich Koshak)
January 12, 2018, 3:13pm
18
Of course, now that we know that this works from the command line, how do we configure the binding to use yahmbr0 instead of eth0 as I suspect it will encounter the same error as running it without the -l option.
I suspect an issue will need to be filed to allow setting the interface.
salexes
(Salexes)
January 12, 2018, 3:41pm
19
Thank you, how and where do i need to file an issue ?
And how long would it take to be added ?
kind regards
rlkoshak
(Rich Koshak)
January 12, 2018, 4:14pm
20
As long as it takes for someone to decide to work on the issue. This is an opensource project built with all volunteer labor. Something gets fixed or features added only because someone has decided to donate their time to fix it. So it is impossible to say how long it would take. There are some issues that have been open for years while others remain open for mere minutes.
This one seems like it is important enough that I’m sure someone will pick it up and fix it. But it is impossible to say how long it will take.
2 Likes