ayavilevich / homeassistant-dlink-presence

A D-Link AP/router device tracker for Home Assistant
MIT License
9 stars 2 forks source link

Device tracker does not go to "not_home" #4

Open Romioyar opened 3 years ago

Romioyar commented 3 years ago

Hi, I use the component and it detects new conected device correctly but the state does not change after disconnection of the device, router does not see the device anymore. HA restart helps.

ayavilevich commented 3 years ago

Hey, What kind of router/AP? Is this true for all devices or just specific ones? Which one? Did you try to telnet to the device and check the status manually? What do you consider "disconnection of the device"?

Romioyar commented 3 years ago

Hi, sorry for late reply. I use D-Link Dir 825 router. I tried only with iPhone 11. No, I did not try. I mean I disconnect phone from Wi-Fi and it disappears from the list of connected devices on the router, but device tracker entity is still “at home” until HA restart.

ayavilevich commented 3 years ago

Can you still reproduce the issue or was it a one time thing?

Please telnet to the dlink when the phone is connected.

Run:

iwlist wlan0 ap iwlist wlan1 ap

then disconnect the phone from wifi and repeat the commands. post the results here. you can obfuscate MAC addresses if you prefer.

Romioyar commented 3 years ago

Hi, yes I still can reproduce, hovewer sometimes it works correctly and it goes to not_home after some minutes as set for device tracker, and sometimes it can be at home some days. I'll telnet to the router and as soon as it is done I come back to you.

Capone1983 commented 2 years ago

Having the same issue. HA still shows "Home" even when the devices have left the building.

However the devices still show when i run iwlist wlan1 ap So i think its more of a router issue. Devices are not getting cleared from list.

Maybe add some code to check signal strength anything below 5/100 is offline

Quality=4/100

ayavilevich commented 2 years ago

@Capone1983 "left the building", does it mean still within wifi range? Just making sure you are aware that the router doesn't know if the device is in the building or outside. It just assumes state based on whether the wifi is connected or not.

Try to turn off wifi on the phone/device and then run "iwlist". LMK what router model that is.

Anyway, if the router says the device is connected then I have to roll with that. It works with many devices so I don't think it will be beneficial for the majority of users to change it.

Capone1983 commented 2 years ago

Sorry "left the building" means -> device has disconnected from the Wifi when out of range. The Router is a D-link DIR-825ACG1.

So I did more tests.