[feature request] [network] 2nd refresh interval for pingable network device

While I recognize that using an Android/iOS device might not be the best thing to detect presence with, it has worked ok for me. I have set my refresh interval to 60s as to not increase the battery drain on my mobile devices. However, when a mobile device is not reachable, no amount of pinging will decrease the battery life. Thus I would like to see more configurable options for this binding, the simplest of them being a 2nd configurable refresh interval for when the device is offline. This way the presence detection when coming home could be improved while not degrading battery life while offline.

I am sorry but I don’t quite get it. How will be binding know that the device is offline by not pinging it (or pinging it less)?
If the device is offline and not reachable by the binding it will not affect the battery life whatsoever.

I do understand what the OP wants. But you should consider the DHCP functionality instead, see docs.

I am sorry but I don’t quite get it. How will be binding know that the device is offline by not pinging it (or pinging it less)?
If the device is offline and not reachable by the binding it will not affect the battery life whatsoever.

When the device is online, the binding should ping with regular intervals to check if the device is online. After the device goes offline, the binding should start pinging with a faster refresh interval to detect presence immediately.

I do understand what the OP wants. But you should consider the DHCP functionality instead, see docs.

I tried using DHCP, but apparrently the only thing my Oneplus 3T with Android 8 spits out when coming back is (tcpdump):
02:39:56.386774 c0:ee:fb::: > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 344: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from c0:ee:fb:::, length 302
02:39:56.387286 c0:ee:fb::: > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 356: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from c0:ee:fb:::, length 314
02:41:10.935961 c0:ee:fb::: > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 344: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from c0:ee:fb:::, length 302
02:41:10.936548 c0:ee:fb::: > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 356: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from c0:ee:fb:::, length 314

So the binding would need to check for the MAC address, or otherwise it won’t work?

This is a normal DHCP request addressed to the IPv4 broadcast address. That should work. Your openHAB need to listen to DHCP traffic on port 67 or so though, so it need to have net capabilities. Should be documented how to make that happen.

Though how is it possible to recognize from which device the request is coming from if the device is not requesting the address (hostname) that I have the binding setup with? Isn’t the only recognizable property here the MAC address?

I don’t see the full packed, but it usually contains the last IP as well. A device is usually trying to get it’s last assigned one