Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work on RT-AX88U #16

Closed
leonidfeldman1977 opened this issue May 7, 2022 · 13 comments
Closed

Not work on RT-AX88U #16

leonidfeldman1977 opened this issue May 7, 2022 · 13 comments
Labels
aimesh [Feature] AiMesh bug Something isn't working dependencies Dependencies

Comments

@leonidfeldman1977
Copy link

Log file:

Logger: homeassistant.config_entries
Source: custom_components/asusrouter/bridge.py:201
Integration: ASUS Router (documentation, issues)
First occurred: 19:15:18 (1 occurrences)
Last logged: 19:15:18

Error setting up entry 10.10.20.2 for asusrouter
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/asusrouter/init.py", line 17, in async_setup_entry
await router.setup()
File "/config/custom_components/asusrouter/router.py", line 264, in setup
self._mac = await self._api.get_mac()
File "/config/custom_components/asusrouter/bridge.py", line 234, in get_mac
await self._async_get_device_info()
File "/config/custom_components/asusrouter/bridge.py", line 201, in _async_get_device_info
await self._api.async_initialize()
File "/usr/local/lib/python3.9/site-packages/asusrouter/asusrouter.py", line 600, in async_initialize
await self.async_monitor_devices()
File "/usr/local/lib/python3.9/site-packages/asusrouter/asusrouter.py", line 503, in async_monitor_devices
value = await helpers.async_transform_connection_time(data[mac]["wlConnectTime"])
File "/usr/local/lib/python3.9/site-packages/asusrouter/helpers.py", line 121, in async_transform_connection_time
delta = timedelta(hours = int(part[0]), minutes = int(part[1]), seconds = int(part[2]))
ValueError: invalid literal for int() with base 10: ''

@Vaskivskyi
Copy link
Owner

Vaskivskyi commented May 7, 2022

Hi @leonidfeldman1977 ,

First of all, thank you for your feedback! 👍🏻

Seems like this is a problem with parsing data by the AsusRouter library which is used in this integration. I've opened an issue there Vaskivskyi/asusrouter#20 to keep track of the bugfix.

It could take some time, but the problem will be fixed.

Meanwhile, can you try running this python snippet to see what kind of data your device is sending as "wlConnectTime"? You would need to run it from the environment with the AsusRouter library being installed (e.g. from Home Assistant venv, since there it was already installed by the integration)

"""Small test for available data from your AsusRouter"""

from asusrouter import AsusRouter
import asyncio


async def gather_data(host, username, password, use_ssl):
    """Method to gether all the known data"""

    # Initialize
    router = AsusRouter(host = host, username = username, password = password, use_ssl = use_ssl)

    # Connect
    await router.connection.async_connect()

    # Get wlConnectTime data in raw
    data = await router.async_hook("get_clientlist()")
    for device in data["get_clientlist"]:
        try:
            info = data["get_clientlist"][device]
            print(info["wlConnectTime"])
        except Exception as ex:
            break

    # Disconnect
    await router.connection.async_disconnect()


loop = asyncio.get_event_loop()

# Please, put your values in here
_host = "IP_or_hostname_here"
_username = "admin"
_password = "password"
_use_ssl = True

loop.run_until_complete(gather_data(_host, _username, _password, _use_ssl))

loop.close()

Just put the code to some local script.py (without forgetting to put in your values for _host and _password in it). Then run it with python3 script.py.

The output will look like this:

24:44:45
152:40:48
152:40:44

@leonidfeldman1977
Copy link
Author

I'm not sure I understand what do you need can you explain step by step

@Vaskivskyi
Copy link
Owner

Hey, @leonidfeldman1977 ,

Do you mind checking if the new version 0.2.0 of the integration does work for you?

@leonidfeldman1977
Copy link
Author

leonidfeldman1977 commented May 9, 2022

Hello,
First off all it work. Thank You
But I don't understand wat is my WAN interface ... ?
1

and no update from connected devices sensor.
11

@Vaskivskyi
Copy link
Owner

Hey @leonidfeldman1977 ,

It seems that some of the devices do not report WAN traffic at all. I am currently looking into this problem. There is a new issue about it #30, collecting all the known data, models and firmware versions to find out what exactly is the reason.

As for the Connected Devices sensor, I am not yet sure what could be a reason for such behaviour. It could be related to how the AiMesh works or something else.

I am currently expecting to get access to one RT-AX88U (hopefully, this week). As soon as I get the device, I'll be able to check what could cause such a difference between the web panel number of clients and the sensor in the integration

@Vaskivskyi
Copy link
Owner

I've got an RT-AX88U, that does not have any problems with the WAN data - it just reports as usual and as I had on the much older router. So still don't have any idea, why that could happen with some of the routers.

Maybe it could be somehow connected to the AiMesh? Unfortunately, this is something I cannot try since the older device does not support this feature.

As for the discrepancy in the number of devices, I didn't notice it yet. But that was only after a couple of hours with the router. I'll let you know if I will find a fix for any of these two issues.

@robertoleonardo
Copy link

i assume this is the same issue i mentioned in the other thread that i'm having. so, on my AX XT8 - i'm getting the following:

34:09:28

34:09:21
03:04:51
00:44:59
34:09:22

12:34:18

34:08:53
25:03:35
34:09:26
34:09:28
25:11:16

27:35:30
34:09:27
34:09:25
34:09:26

34:09:22
34:09:21

34:09:21
34:09:13
34:09:25
00:38:40
34:09:22
32:09:51
34:09:23
08:32:46
34:09:20
34:09:22
24:53:40
03:33:59
34:09:18
34:09:17
00:00:03
34:09:15

34:03:47

00:00:37

i don't think it makes a difference but btw - the script ends with an error for me:

Traceback (most recent call last):
File "D:\Dropbox\Desktop\test.py", line 34, in
loop.run_until_complete(gather_data(_host, _username, _password, _use_ssl))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "D:\Dropbox\Desktop\test.py", line 20, in gather_data
print(info["wlConnectTime"])
TypeError: list indices must be integers or slices, not str
Unclosed client session

@Vaskivskyi
Copy link
Owner

@robertoleonardo,

Yes, it crashed on the last element in the array, since that is not a real device, but some other thing. I've edited the code, so it won't crash if someone tries it again.

In any case, did you get the same

File "/usr/local/lib/python3.9/site-packages/asusrouter/helpers.py", line 121, in async_transform_connection_time
delta = timedelta(hours = int(part[0]), minutes = int(part[1]), seconds = int(part[2]))
ValueError: invalid literal for int() with base 10: ''

in your log? This method was fixed earlier and there is no such line in the code of the current version. For any other exceptions or errors, other data should be checked.

@robertoleonardo
Copy link

yea sorry - shouldn't have assumed it was the same issue. i'll respond to your other comment - but i actually just got it working. i'm up and running now.

@Vaskivskyi
Copy link
Owner

Hey, @leonidfeldman1977 ,

Can you check if with the new version 0.2.4 sensor Connected devices shows the same as the web panel?

@leonidfeldman1977
Copy link
Author

Hi, After last update sensor change the value .. BUT sensor is show always the value + 2 :)
Screenshot 2022-05-16 185452

@Vaskivskyi
Copy link
Owner

That is something I am trying to figure out. Other devices were my mistake in the code of the integration. But this seems to be connected to the AiMesh (you have 2 nodes, as far as it was shown in out of comments (#16 (comment)). That would explain the +2 in the Connected devices sensor.

I will continue digging

@Vaskivskyi Vaskivskyi added the aimesh [Feature] AiMesh label Aug 28, 2022
@Vaskivskyi
Copy link
Owner

It took quite a long, but I can now finally confirm, that the connected devices sensor is supposed to show the sum of the clients and AiMesh nodes. That is the expected behaviour and is not a bug. Also the devices attribute shows both clients and other nodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aimesh [Feature] AiMesh bug Something isn't working dependencies Dependencies
Projects
None yet
Development

No branches or pull requests

3 participants