Vaskivskyi / ha-asusrouter

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

[Bug] Can't setup integration after a reboot #847

Open neekul opened 1 month ago

neekul commented 1 month ago

The problem

recently turned off (safe shutdown and disconnect from power) the RPi running HA, and my router to move stuff around.

Once I got it all back up and running the integration stopped working. I removed it, rebooted the router, and tried adding the integration again. I also updated the firmware and tried again. No luck.

Error log from HA and device info below. I can't see anything in my Router logs. Any ideas what might be the cause?

Logger: custom_components.asusrouter.config_flow
Source: custom_components/asusrouter/config_flow.py:269
integration: AsusRouter (documentation, issues)
First occurred: 22:44:40 (1 occurrences)
Last logged: 22:44:40

Unknown error of type '<class 'asusrouter.error.AsusRouterTimeoutError'>' during connection to `192.168.1.1`: ('Reached maximum allowed timeout for a single connection attempt: 425.0. The last error: ("Cannot connect to `192.168.1.1` on port `8443`. Failed in `_send_request` with error: `Cannot connect to host 192.168.1.1:8443 ssl:False [Connect call failed (\'192.168.1.1\', 8443)]`", None)', None)

Router

RT-AC68U
Merlin 386.14

HA

Core
2024.8.0
Supervisor
2024.08.0
Operating System
12.4
Frontend
20240806.1

Your device model

RT-AC68U

Firmware type

Merlin

Firmware version

386.14

Integration version with the issue

0.32.1

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Core 2024.8.0

Is there anything useful in the logs?

No response

Diagnostics information

No response

Additional information

No response

Vaskivskyi commented 1 month ago

Hey, @neekul,

The log message is saying, you are trying to connect on port 8443 (HTTPS port) with the SSL option set to false. Can you please check this? Just click reconfigure for the integration and make sure that in the connection settings it's set properly

image

The defaults are: 8443 with SSL on and 80 with SSL off. The defaults will also be chosen if HA integration port is set to 0.

In case the settings on the HA side are fine, please make sure you can access the Web UI in your browser by force specifying the needed protocol (http or https and port, e.g. https://192.168.1.1:8443) corresponding to the settings in the integration

neekul commented 1 month ago

Thanks for getting back.

That's odd as the config box had SSL ticked and Port left to 0.

I tried with SSL unticked and updated the port to 80, but immediately got "Unknown error" with the below log in HA

Unknown error of type '<class 'asusrouter.error.AsusRouterConnectionError'>' during connection to192.168.1.1: ('Cannot connect to192.168.1.1on port80. Failed in_send_requestwith error:Server disconnected', None)

neekul commented 1 month ago

IMG_5593

neekul commented 1 month ago

FYI, tried the ASUSWRT integration with the same (HTTP) and connected straight away.

mflamedo commented 3 weeks ago

Hi, I have the same bug since updating to 2024.08.x (Tried on 08.0 and 08.2). I haven't updated or changed configuration on asusrouter in probably at least a few months by this point. I did update my router's firmware to "3.0.0.6.102_35186-g066dc12_396-gdbdcb" on my ZenWiFi_Pro_XT12 a few weeks back, but there were no errors from the ASUSrouter integration until the HASS update.

The AsusWRT integration has had no issues with these changes.

My router logs when trying to initiate the integration show this very frequently:

Aug 19 09:22:50 watchdog: start httpd
Aug 19 09:22:50 rc_service: watchdog 2613:notify_rc start_httpd
Aug 19 09:22:50 ZenWiFi_Pro_XT12: start https:8443
Aug 19 09:22:50 ZenWiFi_Pro_XT12: start httpd:80
Aug 19 09:22:50 httpd: Restore saved SSL certificate...8443
Aug 19 09:22:50 httpd: Generating SSL certificate...8443
Aug 19 09:22:50 httpd: Failed to initialize SSL, generating new key/cert...8443
Aug 19 09:22:50 httpd: Restore saved SSL certificate...8443
Aug 19 09:22:50 httpd: Generating SSL certificate...8443
Aug 19 09:22:50 httpd: Failed to initialize SSL, generating new key/cert...8443
Aug 19 09:22:50 httpd: Unable to start in SSL mode, exiting! 8443

I tried switching to port 80, and unchecked "use SSL connection" but the configuration changes don't seem to persist while the integration is not initializing successfully. I eventually had to delete the ASUSrouter integration and reconfigure it with the port 80 and unchecked ssl. This corrected the issue.

Hope this helps!

magicus commented 2 days ago

I got the same problem. I have, however, tried removing and reinstalling the integration, to no avail. I still just get "Unknown error".

magicus commented 1 day ago

Or, then again, it might be another problem. I get this in my log:

Unknown error of type '<class 'asusrouter.error.AsusRouterConnectionError'>' during connection to `192.168.7.1`: ('Cannot connect to `192.168.7.1` on port `80`. Failed in `_send_request` with error: `Server disconnected`', None)

I am not using SSL. I logged in to my Home Assistant machine and tried running curl http://192.168.7.1/ and it seems to work, so I have no clue why the AsusRouter fails to connect.