zachcheatham / ha-omada

Home Assistant TP-Link Omada Integration
191 stars 26 forks source link

Controller upgrade from 5.9.31 to 5.12.7 breaks integration #80

Closed TommySharpNZ closed 8 months ago

TommySharpNZ commented 1 year ago

I wonder if the new API options introduced in 5.12.7 has completely broken stuff because mine is not working since I upgraded my controller... :-(

zachcheatham commented 1 year ago

Are you seeing any specific errors in the log? I just upgraded mine this morning and everything appears to be working as usual.

TommySharpNZ commented 1 year ago

It has been connected and working for ages... Then broke in the last few days at the same time I had upgraded the software Omada controller. I can still log into and use the Omada controller no problem on the same IP address.

This error originated from a custom integration.

Logger: custom_components.omada.controller Source: custom_components/omada/controller.py:308 Integration: TP-Link Omada (documentation) First occurred: 30 September 2023 at 11:48:32 (8 occurrences) Last logged: 09:16:44

Unable to connect to Omada at https://192.168.11.10:8043: Error connecting to https://192.168.11.10:8043/api/info: Cannot connect to host 192.168.11.10:8043 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1006)')] Unable to connect to Omada at https://192.168.11.10:8043: Call to https://192.168.11.10:8043/36afb31fawww151782ede3a4a89cb0b8/api/v2/login received status code 500 Unable to connect to Omada at http://192.168.11.10:8043: Call to http://192.168.11.10:8043/api/info received status code 400

image

csababalogh commented 1 year ago

Hello, My setup is not working anymore... since the new Controller update (5.12.7). if I wanted to set up it again, I get the same error message as TommySharpNZ.

csababalogh commented 1 year ago

I don't know if it helps, but the official integration is not working as well: https://www.home-assistant.io/integrations/tplink_omada/

image

liveware-problems commented 1 year ago

@zachcheatham there was a breaking change mentioned in the 5.12.7 release notes:

  1. New Features & Enhancements Notice: If you are using Web API, please take note that Cookie name has been changed from TPEAP_SESSIONID to TPOMADA_SESSIONID.
zachcheatham commented 1 year ago

I'm not sure why the API is still working for me on this version. I'm using the docker image of 5.12.7 from mbentley and connecting to the controller through Traefik. I'll spend some time later today connecting directly to the controller instead of through Traefik and see if that gives me anything to work off of.

This integration doesn't make use of cookies explicitly when communicating with the API. On login, it obtains a token that is then passed back to the API as a GET param for any authenticated requests that need to be made. It might help to turn on debug logging for custom_components.omada and provide any additional info that may be being returned by the API.

liveware-problems commented 1 year ago

I use a NodeRed function to poll the API for stats and use both the token and the cookie to authenticate:

var token = msg.payload.result.token;
msg.url="https://x.x.x.x:8043/325ecb1dd4a70c36a7b023xxxxx/api/v2/sites/627b8a66686dac35b3xxxxx/dashboard/overviewDiagram?token=".concat(token);
msg.cookies = {"TPOMADA_SESSIONID": msg.responseCookies.TPOMADA_SESSIONID};
msg.headers = {"Csrf-Token": token}
return msg;

I had to update the SESSIONID cookie name above

zachcheatham commented 1 year ago

I'll spend some time later today connecting directly to the controller instead of through Traefik and see if that gives me anything to work off of.

Following up: I'm not able to reproduce the issue this way either. Connecting directly to my SDN via https://192.168.x.x:8043 is working as well.

TommySharpNZ commented 1 year ago

Anything else I could add to help identify the issue? My Omada controller runs on a dedicated NUC runing Ubuntu. Both the custom and standard Omada integrations were working before the upgrade so it must be something that somehow your setup is not affected?

csababalogh commented 12 months ago

Hi, Maybe it helps. This is my log:

Logger: homeassistant.config_entries Source: config_entries.py:399 First occurred: 19:04:33 (3 occurrences) Last logged: 22:05:40

Error setting up entry VM - Ubuntu Server for tplink_omada Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink_omada/init.py", line 31, in async_setup_entry await client.login() File "/usr/local/lib/python3.11/site-packages/tplink_omada_client/omadaclient.py", line 58, in login return await self._api.login() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/tplink_omada_client/omadaapiconnection.py", line 106, in login response = await self._do_request( ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/tplink_omada_client/omadaapiconnection.py", line 204, in _do_request self._check_application_errors(content) File "/usr/local/lib/python3.11/site-packages/tplink_omada_client/omadaapiconnection.py", line 230, in _check_application_errors if response["errorCode"] == 0:


KeyError: 'errorCode'
martinhrpi commented 11 months ago

I was able to set up the integration (as new) but I can only see a limited number of settings: Device tracker for clients -yes Client and device bandwidth sensors - no Client and device statistics sensors -no WLAN Radio controls -no WLAN SSID controls -no Client blocking toggles - no SSID filter - no

If I click on Next in the Omada Options Popup (just a guess, in German the Button is called "Weiter", I get the error "Unknown Error". If I click again on "Next", I get another error: "User input malformed: extra keys not allowed @ data['track_clients']"

Is this related? Omada via Docker 5.12 and an EAP235 for Wifi...

zachcheatham commented 11 months ago

@martinhrpi I'm not sure if the error you're getting is related to the new version, but you are correct in that you won't see entities for things such as bandwidth until they are enabled in the options. Could you open a new issue for this?

TommySharpNZ commented 11 months ago

Anything else I could be doing to help identify the issue here?

CAP-Team commented 10 months ago

Still broken with Omada v5.13.22 😪

svptje commented 10 months ago

When checking the URL's it seems the Api Version is now 3, maybe that could be the issue as the logging searches for V2? Source: https://192.168.X.X/api/info

{"errorCode":0,"msg":"Success.","result":{"controllerVer":"5.13.24","apiVer":"3","configured":true,"type":10,"supportApp":true,"omadacId":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","registeredRoot":true,"mspMode":false}}

CAP-Team commented 10 months ago

This may be the case. Here the version info from my local api:

https://server:8043/api/info

{
    "errorCode": 0,
    "msg": "Success.",
    "result": {
        "controllerVer": "5.13.22",
        "apiVer": "3",
        "configured": true,
        "type": 0,
        "supportApp": true,
        "omadacId": "<id>",
        "registeredRoot": true,
        "omadacCategory": "advanced",
        "mspMode": false
    }
}

And in Omada\API\controller.py API_PATH = "/api/v2"

svptje commented 10 months ago

Installed the latest 0.5.0 version yesterday without a problem, all seems to be working again!

Thanks!

Kaot93 commented 10 months ago

Had the same problems as started here after controller update but a redownload of the integration solved it. Just got everyones info

florianru1984 commented 9 months ago

I have the same problem. Cant connect to omada controller.

{"errorCode":0,"msg":"Success.","result":{"controllerVer":"5.13.22","apiVer":"3","configured":true,"type":1,"supportApp":true,"omadacId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","registeredRoot":true,"mspMode":true}}

csababalogh commented 9 months ago

Sure, I not found something, but works this integration with 2FA?

TommySharpNZ commented 8 months ago

YAY! Removed the integration today and readded it and everything is working again!!!!! Great work!