Vaskivskyi / ha-asusrouter

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

[Bug] Device trackers are stuck #570

Closed Vaskivskyi closed 9 months ago

Vaskivskyi commented 1 year ago

The problem

Some devices are experiencing problems with device trackers. The symptoms are the following:

If you are experiencing a similar problem, please add your device MODEL and FIRMWARE VERSION in the comments. Also, add AsusRouter version you are using

If you see any errors or warnings in the HA log from AsusRouter, please add them as well.

Please, don't post "the same error" without any details about your device. This does not help. In order to find and fix the issue, information is needed.

P.S. All other issues with the same problem will be closed. Please, report this problem here and only

Your device model

RT-AX88U

Firmware type

Merlin

Firmware version

3.0.0.4.388.1

Integration version with the issue

0.22.0

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Core 2023.3.0

Is there anything useful in the logs?

No response

Diagnostics information

No response

Additional information

No response

auanasgheps commented 1 year ago

@alhemicar86 not in my case, all my entities do not have a space at the end

alhemicar86 commented 1 year ago

An update: never had an issue since I fixed the naming problem. Just to be clear, it is not the names you can give to an entity, as the HA will prevent you from adding space, but any integration can do it, and as it was my case it affected function of other integrations, without me being able to see the cause, and without anything in logs. So to shorten it, I extracted list of all entities with their names, found the one with extra space using regex search in n++, fixed it and after that two integrations were working flawless. So if stat was a problem with mine, steps to reproduce it would be to use some non GUI method to inject entity with space at the end into the system and it should go haywire from there, and shouldn't show logs.

TeddyLafrite commented 1 year ago

Hi

For information :

ASUS WRT ASUS Router

Asus WRT vs Asus Router

Asus WRT = SSH Asus Router = no SSH

TeddyLafrite commented 1 year ago

Asus Router is compeletey inexploitable

kramttocs commented 1 year ago

Asus Router is compeletey inexploitable

Can you explain what you are meaning?

Delphius7 commented 1 year ago

Your device model

RT-AX86U

Firmware type

Merlin

Firmware version

3.0.0.4.388.2_2

Integration version with the issue

0.22.0

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Container 2023.9.2

Is there anything useful in the logs?

No response

Diagnostics information

No response

Additional information

No response

gregoriusus commented 1 year ago

This is a widespread issue. Does it work for anyone? If yes, which router and firmware do you have? I will buy a new router, if it is router dependand problem.

gregoriusus commented 1 year ago

@Vaskivskyi Can I buy you a few coffee, if you can solve this issue. This is main feature of this addon.

Vaskivskyi commented 1 year ago

@gregoriusus,

I can only wish, this issue could be fixed in such a simple way.

Ongoing work, unfortunately, but I hope to eventually fix it

The main issue is that exactly the same model with the same FW might work for some users and not work for others, which makes everything even more complicated

alhemicar86 commented 1 year ago

Hey, I set it somehow to work since last time. Left it running and forgot about it. Checked logs now it seems to report accurately. What I did was to login into each mesh node separately (not just router), and to check all three events to track (default is just reporting new connections). Don't know what fixed the problem, but it may be related to a fact that device leaves network when attached ro another node, so the main node doesn't report it, but the node it left does? Not sure that is the case, but it works after configuring it like that.

gregoriusus commented 1 year ago

I am also using mesh node. @Vaskivskyi, do you think that could be something because of mesh nodes? How can I enable and see logs? I am that versatile in HA yet.

alhemicar86 commented 1 year ago

Try manually adding all nodes by their IP addresses, and be sure that they won't change (bind them to node mac addresses in router). Be sure to set integration for each node to report all state changes (not just connections which is default).

gregoriusus commented 1 year ago

Just done and suddenly my phone shows event after two days. Will also fix DHCP of node in router. Cross my fingers that this is it 🤞

Vaskivskyi commented 1 year ago

That's good if your case was solved this way.

There are several semi-independent parts of the tracking problem:

Unfortunately, they are only semi-independent and work differently for each use-case

gregoriusus commented 1 year ago

@Vaskivskyi, which Asus router do you use? Or anyone, which Asus router do you have that works great with Mesh network?

Vaskivskyi commented 1 year ago

@gregoriusus,

I have only a single RT-AX88U, so cannot say a lot about AiMesh. My apartment is not too large, so no need for an additional router.

I temporarily had RT-AX92U for tests when adding AiMesh support, but I had to forcibly connect some devices to this node, otherwise, they would have stayed with the main device. So my experience won't be of a large help

gregoriusus commented 1 year ago

Unfortunately, adding node configuration, didn't help. Still no reporting of state in 2 days. I like Asus router, but integration to home assistant is more important. Guess will have to find a router that works with HA flawlessly. @Vaskivskyi, your work with integration and for community is amazing.

Vaskivskyi commented 1 year ago

The main issue I see with Asus - is tons of legacy. Their API, which is also used by the integration is a Frankenstein's monster of many years of work. This creates lots of complications. Maybe they'll improve it eventually. Or I'll manage to make it all work. We'll see what comes first. But the devices themself are not bad. Also, for an average user, they are quite easy to set up and forget

deepansteven commented 1 year ago

When reloading the integration, then it will update the devices correctly in my case. I will now try to enable this as reoccurring automation, until the bug is fixed. I also have a mesh network, and adding the node did not help either. I have an Asus RT-AX88U + AC68U (node). image

Direct Link to the service call: https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.reload_config_entry

In any case a restart of home assistant is also solving this is issue, so restart at night until the bug is fixed is another approach.

gregoriusus commented 1 year ago

@Vaskivskyi, if reload helps, could it be something in code that could solve an issue?

deepansteven commented 1 year ago

@Vaskivskyi, if reload helps, could it be something in code that could solve an issue?

Agree, but could you also confirm that reloading through the UI helps, then we can near it down to code level rather than router or device specific error. In my case the router network page is showing correctly after connect and disconnect.

gregoriusus commented 1 year ago

Can someone point me how to reload configuration of AsusRouter?

gregoriusus commented 1 year ago

I found out. Yes, at the moment when configuration was reloaded, my phone on wifi got status. @Vaskivskyi, could be something on this 👍

kramttocs commented 1 year ago

When reloading the integration, then it will update the devices correctly in my case. I will now try to enable this as reoccurring automation, until the bug is fixed. I also have a mesh network, and adding the node did not help either. I have an Asus RT-AX88U + AC68U (node). image

Direct Link to the service call: https://my.home-assistant.io/redirect/developer_call_service/?service=homeassistant.reload_config_entry

In any case a restart of home assistant is also solving this is issue, so restart at night until the bug is fixed is another approach.

Been using this approach for awhile myself as a band-aid https://community.home-assistant.io/t/custom-component-asusrouter-integration/416111/576?u=kramttocs

deepansteven commented 1 year ago

Ok, the next debugging could be from the other post:
Remove the node for few days to see if that helps Reset the router fully and setup from ground up in home-assistant Only have Merlin firmware on the router and stock firmware on the node

Vaskivskyi commented 1 year ago

Hey, guys. I'll look into this.

The only device I saw a problem by myself is an old RT-AC66U - on that one devices are not tracked correctly in the Web UI of the router as well and nothing was changing when the integration is reload

deepansteven commented 1 year ago

Hey, guys. I'll look into this.

The only device I saw a problem by myself is an old RT-AC66U - on that one devices are not tracked correctly in the Web UI of the router as well and nothing was changing when the integration is reload

@Vaskivskyi : Great to hear. Does it mean you don't need more debugging, and know where in code that has an issue?

Vaskivskyi commented 1 year ago

There is a new version of the integration coming soon with a new backend. Hopefully, the issue will be solved already there, since the communication methods were completely changed. But there is still some more work to be done before it's ready

gregoriusus commented 1 year ago

If there is a way, I can test it, before you submit. Or I can open you a VPN to my router. I would really like to see that this integration works. Device tracker is most used feature for router integration.

Vaskivskyi commented 1 year ago

I seem to miss this question, so please let me know whether the issue is (in your case):

It only matters how the router considers the device (e.g., in Web UI). So if you have additional devices in between the end device and the router, please check the Web UI

gregoriusus commented 1 year ago

For me, all enteties are not refreshed. But everytime I reload configuration, also devices get refreshed. Are devices cleared when configuration is reloaded?

Vaskivskyi commented 1 year ago

Hello, guys. If anyone is up to new tries, you can check the latest beta release 0.23.0b1 and let me know if anything changed for you

deepansteven commented 1 year ago

Hi @Vaskivskyi , thanks already on it as soon as I saw your beta version 😀. Will let you know in couple of days, as it normally takes 12-24 hours before the issue was showing up and not updating, after a restart.

jata1 commented 1 year ago

I have installed latest beta and now I have issues with device tracking. device tracking was working correctly before installing the beta. My router is a RT-AX86S running the latest merlin 3004.388.4.

Easy to reproduce as all of the devices that I track are not working correctly anymore. I have updated the integration config to stop tracking, deleted the entities and re-enabled them but I have the same issue.

Happy to help troubleshoot/debug if helpful so let me know what I can do. See below. This device letf home at 7.30am but continues to update the connected and last activity fields. Other fields remain populated with incorrect data e.g. rssi

image

Vaskivskyi commented 1 year ago

@jata1,

Can you please check the connected_devices sensor? Does it also show number of the active devices higher than the Web UI of the device?

jata1 commented 1 year ago

not quite sure what you are asking but I can confirm that all three of the devices I track are reported as connected in the attributes for the connected_devices sensor. Interestingly, these devices are at the very bottom of thee list and have node set to null - see below.

edit - note that these three devices are all not connected to the wifi!

image

TeddyLafrite commented 1 year ago

Hi there,

I'm testing for 24h the beta 0.23.0b1 and devices tracker seems to work :

AsusRouter vs AsusWRT : image

As a reminder : ASUS model RT-AX55

I'm installing 0.23.0b3 and will post results here in 2 ou 3 days

Vaskivskyi commented 1 year ago

@jata1, please check version 0.23.0b4

jata1 commented 1 year ago

Sorry - still not working. Same issue but all three devices were away when I installed the update so not sure if that could impact.

Vaskivskyi commented 1 year ago

@jata1, a couple more questions. Does it happen only with Apple devices? If so, let me know the iOS version so I can try to search for a device to reproduce the issue. Also, does it happen the same when the device leaves the Wifi coverage zone and when you just toggle flight mode in the phone? I would also need your HomeAssistant version and Python version

jata1 commented 1 year ago

I have updated to v0.23 from the beta but I still have the same issue. We all have iPhones and I am only interested in tracking them as they are are the family primary device that I use for location based automations (home / away). With v0.22 everything was working fine.

Version info: Home Assistant 2023.10.5 Frontend 20231005.0 - latest

I am running HA in a docker container - so latest stable release image: "ghcr.io/home-assistant/home-assistant:stable"

So the python version will be whatever shipped with this docker image. Just checked this and it is Python 3.9.2

Phones are all on ios 16 iphone 11 - ios 16 latest iphone 11 pro - ios 16 latest iphone 13 pro - ios 16 latest

From what I can see, these devices are all doing the same thing. When off my network whether wifi off or out of range the devices still think they are connected both at the device tracker entity and the connected_devices entity.

I can see that the connected attribute on the device tracker is updated when a device joins the network but is not cleared when it leaves and the last activity attribute continues to update even when the device is not on the network.

Hope this helps and you can fix this issue for me as all my location based automations are not working anymore...

Vaskivskyi commented 1 year ago

@jata1, I think we found the problem. Your installation still uses Python 3.9, which is not supported by Home Assistant already. It was actually dropped in 2023.2.0. With HA 2023.8.0 support for Python 3.10 was also dropped and HA Core requires Python 3.11 since then. The same is for the latest release of the AsusRouter backend library. That means, the backend was not updating when you installed any of the 0.23.0 beta or stable releases. Probably, this is the reason for at least part of the issues you are experiencing

jata1 commented 1 year ago

but python version is bundled in the official HA docker image

jata1 commented 1 year ago

how can I change this and if it is the problem then everyone using HA docker will be in trouble as it is using the wrong version of python...

jata1 commented 1 year ago

however - great news we are getting to the issue. I am wondering if any other users of this integration that also use docker can help test/validate...

jata1 commented 1 year ago

I'm so sorry - I gave you bad information. I just check again and the version of python for the HA docker is

Python 3.11.6

Vaskivskyi commented 1 year ago

Ok, good, then I would need to test this. I will try to get access to a device with iOS in the following days to reproduce the issue. I'll keep you informed

jata1 commented 1 year ago

Thanks and apologies again for giving you the wrong info earlier. Let me know if I can help test anything.

jata1 commented 1 year ago

Not sure if this helps but one thing i see with the devices that are not working correctly is they do not have a attribute for node when they are off the wifi - see below. I will check when they come back on the wifi to see if the node attribute returns.

image

TeddyLafrite commented 1 year ago

Hi,

Results for 0.23.0b3 version : devices tracker is OK !

image

Installing 0.23.0b4 and HA Core 2023.11.0 !

Edit : installing 0.23.1 version