when I ping my iphone (tel jpp) it is sometimes unreachable. while another android phone works without problem tel fabienne) . It must come from iphone, what should be configured on the iphone so that it always responds to the ping?
However, when I do it manually, it responds well
From what I know, this is when the iPhone goes to sleep and saves battery. I donāt think thereās anything you can do about it.
In my case, where I do this, I only record the state as off if it couldnāt ping over a duration of 5 min (it pings every 30 sec). This is very long, but for my application itās ok.
You can look into other mechanisms of device tracking, like Bluetooth or looking at registered devices on the network (using the ARP tables, which is what some of the network equipment device integrations would do).
I have had reasonable luck with this on HassOS on a rPi4. Uses a similar thinking. Need your own IP; and ensure this remains static in your router; and turn off the iPhone āPrivate Wi-Fi Addressā security for the SSID.
It is a common problem for many modern phones and Android is not exempt from this, especially not if it is a Samsung Android.
Ping is probably the worst solution, because it will wake the phone up and increase battery drain.
The integration is not better really.
It actively asking the phone to reply and there also waking it up.
With the 12 secs update interval it is keeping the phone awake, even though you might not see it.
If the ARP timeout in your router can be changed, then this interval can be increased.
The best way would be if the ARP timeout can be changed and set to something like 5 minutes, if that is low enough for you.
The 5 minutes timeout means the phone will wake by itself and update the entry before it times out, so there is no active pulling the phone.
The ARP table can usually be extracted by SNMP, which is a standard protocol that is available in nearly all management software, including HA and Node Red.
Not much disagreement, but the thought was this is āat homeā and battery drain isnāt normally a huge concern. The ping on an iPhone doesnāt actually wake the device up and frequently it makes it the āWozniakā before finding it in the IP tables. The good news is it doesnāt have many (if any) false positives and is extremely fast when moving off the network. I did Bluetooth scans at one point, and those are worse on battery drain from my results.
The most optimal regarding battery drain is probably the companion app since it only requires one send from the phone to HA.
Then the phone can go to sleep and nothing that requires the battery will happen untill the phone disconnects from the WiFi
ARP table takes the least drain on the battery, but the it means you can not really do lower intervals than what the phone normally have of intervals to wake up and send stuff.
ARP table done that way is totally passive and just catches the normal operation of the phone on the network.
This only works locally though and require you can read the ARP tables and maybe also adjust the timeouts (my router had ARP timeouts set to 4 hours as standard.)
The companion app just works and provide a broader service for detection, like also detecting IP addresses, SSIDs, geolocation among other. It is an active detection form though.
I canāt say if itās active or not, but since it even can report you as on the network even when the phone is turned off (falsely though) then I highly doubt ARP can do it more efficient
if you can control the ARP timeout on your router, then ARP will set your phone entry to stale after the timeout where no packets have been seen.
The ARP table is managed by the network gear and therefore independent of the phone.
I actually use several detection technics on my set up and the ARP table lookup is the one I put the most reliance on.