Device tracker incorrectly reports online
croaker-1 opened this issue · 5 comments
First of all, thank you for this integration. I genuinely appreciate all the work you have put into it.
Device tracker reports a disconnected device as online shortly after being marked offline. This happens with both devices designated as a device trackers.
Running manually installed linksys_velop
Here are snippets of relevant logging while testing with my iPhone (MAC address privacy turned off).
iPhone Connected to WiFi
{'deviceID': 'cceaa045-4540-43ba-aa2e-43908dee92dd', 'lastChangeRevision': 75805, 'model': {'deviceType': ''}, 'unit': {}, 'isAuthority': False, 'knownInterfaces': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'interfaceType': 'Wireless', 'band': '5GHz'}], 'connections': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'ipAddress': '192.168.1.240', 'parentDeviceID': '0ddb3568-f47b-f6cc-9c04-e89f805a2651'}], 'properties': [{'name': 'userDeviceOS', 'value': 'iOS 15.6.1'}, {'name': 'userDeviceManufacturer', 'value': 'Apple'}, {'name': 'userDeviceModelNumber', 'value': 'iPhone 11'}], 'maxAllowedProperties': 16}
iPhone WiFi turned off
{'deviceID': 'cceaa045-4540-43ba-aa2e-43908dee92dd', 'lastChangeRevision': 75814, 'model': {'deviceType': ''}, 'unit': {}, 'isAuthority': False, 'knownInterfaces': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'interfaceType': 'Wireless', 'band': '5GHz'}], 'connections': [], 'properties': [{'name': 'userDeviceOS', 'value': 'iOS 15.6.1'}, {'name': 'userDeviceManufacturer', 'value': 'Apple'}, {'name': 'userDeviceModelNumber', 'value': 'iPhone 11'}], 'maxAllowedProperties': 16}
2022-10-10 10:41:30.132 DEBUG (MainThread) [custom_components.linksys_velop.device_tracker] _async_get_device_info (32N10xxxxxxxxx) --> Network Device: setting consider home listener for 2022-10-10 10:44:30
Marked offline, iPhone WiFi still off
{'deviceID': 'cceaa045-4540-43ba-aa2e-43908dee92dd', 'lastChangeRevision': 75814, 'model': {'deviceType': ''}, 'unit': {}, 'isAuthority': False, 'knownInterfaces': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'interfaceType': 'Wireless', 'band': '5GHz'}], 'connections': [], 'properties': [{'name': 'userDeviceOS', 'value': 'iOS 15.6.1'}, {'name': 'userDeviceManufacturer', 'value': 'Apple'}, {'name': 'userDeviceModelNumber', 'value': 'iPhone 11'}], 'maxAllowedProperties': 16}
2022-10-10 10:44:30.376 DEBUG (MainThread) [custom_components.linksys_velop.device_tracker] _async_get_device_info (32N10xxxxxxxxx) --> Network Device is now being marked offline
Marked as back online, iPhone WiFi still off
{'deviceID': 'cceaa045-4540-43ba-aa2e-43908dee92dd', 'lastChangeRevision': 75820, 'model': {'deviceType': ''}, 'unit': {}, 'isAuthority': False, 'knownInterfaces': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'interfaceType': 'Unknown'}], 'connections': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'ipAddress': '192.168.1.240', 'parentDeviceID': '0ddb3568-f47b-f6cc-9c04-e89f805a2651'}], 'properties': [{'name': 'userDeviceOS', 'value': 'iOS 15.6.1'}, {'name': 'userDeviceManufacturer', 'value': 'Apple'}, {'name': 'userDeviceModelNumber', 'value': 'iPhone 11'}], 'maxAllowedProperties': 16}
2022-10-10 10:46:30.246 DEBUG (MainThread) [custom_components.linksys_velop.device_tracker] _async_get_device_info (32N10xxxxxxxxx) --> Network Device: back online
iPhone WiFi turned on and reconnected
{'deviceID': 'cceaa045-4540-43ba-aa2e-43908dee92dd', 'lastChangeRevision': 75835, 'model': {'deviceType': ''}, 'unit': {}, 'isAuthority': False, 'knownInterfaces': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'interfaceType': 'Wireless', 'band': '5GHz'}], 'connections': [{'macAddress': 'F4:DB:E3:xx:xx:xx', 'ipAddress': '192.168.1.240', 'parentDeviceID': '0ddb3568-f47b-f6cc-9c04-e89f805a2651'}], 'properties': [{'name': 'userDeviceOS', 'value': 'iOS 15.6.1'}, {'name': 'userDeviceManufacturer', 'value': 'Apple'}, {'name': 'userDeviceModelNumber', 'value': 'iPhone 11'}], 'maxAllowedProperties': 16}
The thing that stuck out to me in the logs is the interfaceType. When it incorrectly reports device is online, the interfaceType remains "Unknown". It isn't until iPhone WiFi is turned back on that the interface correctly reports as "Wireless".
I am attaching the diagnostic file with the device in the "marked as online but WiFi is off" state.
config_entry-linksys_velop-e40dea6f692343a6700925ee89a75987.json.txt
Thanks for all of the detail. As far as I can tell from the logs the integration is behaving as it should. The pyvelop
library assumes that if no "connections" are listed for the device then it is offline (see below)
Using this status the integration decides whether or not the device_tracker
should be marked as offline. It does this in stages...
- Device goes offline.
- Start tracking the
consider_home
timer
a) If the device comes back online during that timer, cancel the timer
b) If the device stays offline for that duration, mark as offline
As you can see in what you sent over the device_tracker
is being marked offline where no connections are reported.
This information is taken from the JNAP API on the Velop. Does the Velop app show the device as online or offline? Has the consider_home
timer completed so that it can be marked offline appropriately?
That all makes sense. The integration is working as designed but the device is inaccurately reporting the device status via the API.
Looks like the Velop may be returning stale cache data to the API. No use in digging any deeper...time to factory reset and try again.
Thanks for the quick, very helpful response.
You may find that just rebooting the primary node (which is likely to reboot the other nodes as well) will kick it back to life.
Great! I will try that first. Thanks again.
Oh if that doesn't do it, I've just thought of something that might help...
- Turn WiFi off on the iOS device
- Reconfigure the integration in Home Assistant and remove the device tracker
- When it shows offline in the Velop UI (use another device or the WebUI), delete it
- Now turn WiFi back on for the iOS device (it'll register with a different unique ID)
- Using the Velop UI check it is showing up
- Disable WiFi and ensure the Velop UI has the device is offline
- Enable WiFi again and ensure the Velop UI has the device as online
- Go back to the Home Assistant integration and reconfigure it, adding the device tracker again
Assuming that all has been working well outside Home Assistant the integration should carry on working as well.