Vaskivskyi / ha-asusrouter

Monitor and control your AsusWRT-powered router from Home Assistant
https://asusrouter.vaskivskyi.com
Apache License 2.0
173 stars 16 forks source link

AsusRouter integration causing asus Web UI to show disconnected clients as connected #760

Closed jata1 closed 6 months ago

jata1 commented 6 months ago

The problem

This issue could be related to the improvements that are currently being developed for device tracking in the asusrouter integration.

After installing the integration I have seen some clients show as connected in my asus web based UI.

Your device model

RT-AX86S

Firmware type

Merlin

Firmware version

3.0.0.4.388.5

Integration version with the issue

0.27.2

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

2023.12.4

Is there anything useful in the logs?

will add later

Diagnostics information

will add later

Additional information

will add later

jata1 commented 6 months ago

I am starting from a clean install of my entire asus network plus I have fully removed asusrouter integration from HA so I can start with a clean baseline.

For the last 3 days router/network has been working fine with clients correctly displayed in the asus web UI.

At this point asusrouter integration is not installed in my HA setup.

Will add additional to this thread after I setup asusrouter integration to see if I can reproduce the issue.

jata1 commented 6 months ago

First thing to note is that a number of non-asus devices are identified and there is no way to deselect... This is a different issue but thought I would share :-)

image

Vaskivskyi commented 6 months ago

The integration creates devices only for your router + AiMesh nodes.

Plus (only if set explicitly in the configs) for the clients with parental control rules set, so that entities for them are attached to devices and can be found easier (and are also merged with device trackers.

All others are a result of HA way of handling device_trackers - if there is already a device with the same MAC address by any other integration as the created device_tracker entity - they will be merged. It's not that AsusRouter creates them, but they are rather shown as provided by two integrations.

You will see such devices in the following way:

image

This behaviour cannot be changed from the integration side. Only if you disable device_tracking all together (so that AsusRouter won't create device_tracker entities at all)

jata1 commented 6 months ago

Thanks but I do not have or want device tracking on my hue bridges or a IR remote blaster and these are the three additional devices that are identified when I install the integration. I have loads of other devices that are not identified and added like this so there is something weird with how this is working - but it's a different issue so let's park it for now

jata1 commented 6 months ago

Looking at asus web UI (and mobile app) - there is an issue that I can reproduce easily so I hope we can work together to solve it

What I can see is this:

  1. connected_devices entity in HA via asusrouter is working well. I can see my devices moving between nodes as expected
  2. web and mobile app ui for device list is not updating and retains an out of date status/node for devices that moves between nodes
  3. when devices are off the wifi network (away from home) then HA is updating correctly but asus gui does not update
  4. logging on the router shows the client move (roam) as a result of rssi on the client (as expected) but the gui is not updated

Just now my wife and her two friends have gone out. I see their devices are correctly updated in HA in connected_devices and device_tracker (wife only as I don't track her friends lol) but all three are showing in the asus web gui and mobile app as here and connected

Attached are the logs from my router (i know I should scrub mac addresses but we will need this info) from around the time my wife and her friends went away. Looks as expected i think but the issue is that the asus web gui and mobile app is not updated.

New Text Document.txt

jata1 commented 6 months ago

Here is another example that we can use/test using my iphone and apple watch. I can easily move them across my network from node to node and test which node they are actually connected to.

If I move across my house I can see the asus logs roam the clients and the HA connected devices is updated correctly. The issue is that the asus web gui is not updated at all. everything stays the same.

So at the moment, HA is working well but the Asus web GUI is incorrect.

I hope this is helpful. Let me know if I can test anything specific for you.

iphone roam.txt

Vaskivskyi commented 6 months ago

It looks like sometimes forcing clients to update can interfere with the Web UI (because Web UI and the integration are trying to do it concurrently). Try disabling the option in the integration config - Connected devices. Just uncheck it and restart your router (so that you start monitoring from a clean state, not from one which is already stuck)

image

Vaskivskyi commented 6 months ago

Thanks but I do not have or want device tracking on my hue bridges or a IR remote blaster and these are the three additional devices that are identified when I install the integration. I have loads of other devices that are not identified and added like this so there is something weird with how this is working - but it's a different issue so let's park it for now

This is the default behaviour of Home Assistant of how to work with device_trackers. From my side, AsusRouter now (from 0.28.0) allows filtering for which devices the integration created device_tracker entities. But please note, that all of the in-built router integrations (as well as those custom I saw) just add all the device_trackers

jata1 commented 6 months ago

It looks like sometimes forcing clients to update can interfere with the Web UI (because Web UI and the integration are trying to do it concurrently). Try disabling the option in the integration config - Connected devices. Just uncheck it and restart your router (so that you start monitoring from a clean state, not from one which is already stuck)

image

Thank you. I have changed the setting for connected devices and rebooted the router then installed 0.28.0. I will now monitor

jata1 commented 6 months ago

@Vaskivskyi - just an update for you. I have had an internet outage for the last 2-3 days so have not been monitoring this closely.

Overall I think device tracking is working better and I have not seen any devices stuck in the ASUS web GUI with 'force clients update' disabled.

Will update you again in a few days.

jata1 commented 6 months ago

@Vaskivskyi - I have been monitoring for the last week and this issue has been resolved by disabling 'force clients update'

I can also confirm that v0.28 has massively improved the home/away device tracking issue. Everything is working well for me at the moment.

Thanks for all the effort on this project.

Vaskivskyi commented 6 months ago

Hey, @jata1, thanks for your confirmation.

The force client feature will be adjusted in the integration to prevent such issues for users. Instead of just forcing it with each client poll, it will become an optional button entity, which can be triggered by the user whenever needed and with any custom time interval

Vaskivskyi commented 6 months ago

With PR #777 this will be handled properly now as described above

The release will be available shortly