zachcheatham / ha-omada

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

Unable to setup intergration with Omada 4.4.4 #2

Closed boywiz closed 3 years ago

boywiz commented 3 years ago

Hi,

love the idea of this so far, would love to get it working, steps to repeat

    • add the repository to Hass ( this is a relatively clean build)
    • reboot
    • add new integration
    • enter the details shown below

receive Unable to connect to service,

image

The log output below, puls the compose file for Omada are below Hass is running on a separate device in the same subnet. I can log into and use the Hass and Omada controller normally. Hass can see and connect to other devices including other Hass boxes

services:
  omada-controller:
    container_name: omada-controller
    image: mbentley/omada-controller:4.4
    restart: unless-stopped
    network_mode: host
    volumes:
      - omada-data:/opt/tplink/EAPController/data
      - omada-work:/opt/tplink/EAPController/work
      - omada-logs:/opt/tplink/EAPController/logs
    environment:
      - TZ=Etc/UTC
      - MANAGE_HTTP_PORT=8088
      - MANAGE_HTTPS_PORT=8043
      - PORTAL_HTTP_PORT=8088
      - PORTAL_HTTPS_PORT=8043
      - SHOW_SERVER_LOGS=true
      - SHOW_MONGODB_LOGS=false
      - SSL_CERT_NAME="tls.crt"
      - SSL_KEY_NAME="tls.key"

volumes:
  omada-data:
  omada-work:
  omada-logs:

Home Assistant info

Version | core-2021.8.7
-- | --
Installation Type | Home Assistant Container
Development | false
Supervisor | false
Docker | true
user | root
Virtual Environment | false
Python Version | 3.9.6
Operating System Family | Linux
Operating System Version | 5.11.0-1016-raspi
CPU Architecture | aarch64
Timezone | Europe/London

Error, seen in Home Assistant

Logger: aiohttp.server
Source: custom_components/omada/api/errors.py:23
Integration: TP-Link Omada (documentation)
First occurred: 11:58:35 AM (1 occurrences)
Last logged: 11:58:35 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/omada/config_flow.py", line 62, in async_step_user
    controller = await get_api_controller(
  File "/config/custom_components/omada/controller.py", line 166, in get_api_controller
    await controller.update_ssids()
  File "/config/custom_components/omada/api/controller.py", line 52, in update_ssids
    response = await self._site_request("get", "/setting/ssids")
  File "/config/custom_components/omada/api/controller.py", line 62, in _site_request
    return await self._request(method, url, params=tokened_params, json=json)
  File "/config/custom_components/omada/api/controller.py", line 91, in _request
    self._raiseOnResponseError(response)
  File "/config/custom_components/omada/api/controller.py", line 107, in _raiseOnResponseError
    raise_response_error(response)
  File "/config/custom_components/omada/api/errors.py", line 23, in raise_response_error
    raise OmadaApiException("API Error Code {}: {}".format(response["errorCode"], response["msg"]))
custom_components.omada.api.errors.OmadaApiException: API Error Code -1005: Operation forbidden.
zachcheatham commented 3 years ago

I just upgraded to 4.4 and am now seeing a similar issue. Currently investigating...

zachcheatham commented 3 years ago

My issue was due to my login expiring after restarting the controller. It started working after restarting HA.

Try adding https:// to the url.

boywiz commented 3 years ago

My issue was due to my login expiring after restarting the controller. It started working after restarting HA.

Try adding https:// to the url.

I had tried that the combinations I tried for the URL were:

I made sure every time it failed that I was still able to access the console

I also tried upper case and lower case HTTPS and this did not work either. i also changed the id to an admin account and it still did not work.

is there enhanced logging i can turn on to assist?

image

zachcheatham commented 3 years ago

You can crank up the log verbosity by adding this to the configuration.yaml:

logger:
  default: info
  logs:
    custom_components.omada: debug

This will spit out some additional details about what url it attempted to request before failing.

massive commented 3 years ago

I'm having the same issue. Here's the error that's generated in HA.

Here are the logs with debug enabled:

2021-09-08 09:35:36 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/login - Params: None - JSON: {'username': 'REDACTED', 'password': REDACTED}
2021-09-08 09:35:37 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/login) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Set-Cookie': 'TPEAP_SESSIONID=66ecef32-7e6e-4e75-926c-d454aaba0c92; Path=/; Secure; HttpOnly', 'Set-Cookie': 'rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 07-Sep-2021 06:35:37 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:35:37 INFO (MainThread) [custom_components.omada.api.controller] Login successful. Role type 0.
2021-09-08 09:35:37 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/maintenance/controllerStatus - Params: [('token', 'REDACTED')] - JSON: None
2021-09-08 09:35:37 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/maintenance/controllerStatus?token=REDACTED) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:35:37 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/sites/Home/setting/ssids - Params: [('token', 'REDACTED')] - JSON: None
2021-09-08 09:35:37 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/sites/Home/setting/ssids?token=REDACTED) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:35:37 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/omada/config_flow.py", line 62, in async_step_user
    controller = await get_api_controller(
  File "/config/custom_components/omada/controller.py", line 166, in get_api_controller
    await controller.update_ssids()
  File "/config/custom_components/omada/api/controller.py", line 52, in update_ssids
    response = await self._site_request("get", "/setting/ssids")
  File "/config/custom_components/omada/api/controller.py", line 62, in _site_request
    return await self._request(method, url, params=tokened_params, json=json)
  File "/config/custom_components/omada/api/controller.py", line 91, in _request
    self._raiseOnResponseError(response)
  File "/config/custom_components/omada/api/controller.py", line 107, in _raiseOnResponseError
    raise_response_error(response)
  File "/config/custom_components/omada/api/errors.py", line 23, in raise_response_error
    raise OmadaApiException("API Error Code {}: {}".format(response["errorCode"], response["msg"]))
custom_components.omada.api.errors.OmadaApiException: API Error Code -1005: Operation forbidden.
massive commented 3 years ago

I realized that I had incorrect value given for Site field. I have it named "Home" in Omada, but for some reason it's still identified as Default in the API. Nevertheless, changing that does not make the integration work. It crashes to something else.

(I verified this by checking what URLs a browser is calling. A browser used Default as site identifier, not the one I had set it to)

2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/login - Params: None - JSON: {'username': 'XXXX', 'password': 'XXXX'}
2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/login) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Set-Cookie': 'TPEAP_SESSIONID=1c74fa18-71f0-4331-a131-70f913ae4a95; Path=/; Secure; HttpOnly', 'Set-Cookie': 'rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 07-Sep-2021 06:54:15 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:54:15 INFO (MainThread) [custom_components.omada.api.controller] Login successful. Role type 0.
2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/maintenance/controllerStatus - Params: [('token', 'XXXX')] - JSON: None
2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/maintenance/controllerStatus?token=c1e708d08d1b43a2a66b3f4f4928d361) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.1.10:8043//api/v2/sites/Default/setting/ssids - Params: [('token', 'XXXX')] - JSON: None
2021-09-08 09:54:15 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.1.10:8043//api/v2/sites/Default/setting/ssids?token=XXXX) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 09:54:15 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/omada/config_flow.py", line 62, in async_step_user
    controller = await get_api_controller(
  File "/config/custom_components/omada/controller.py", line 166, in get_api_controller
    await controller.update_ssids()
  File "/config/custom_components/omada/api/controller.py", line 52, in update_ssids
    response = await self._site_request("get", "/setting/ssids")
  File "/config/custom_components/omada/api/controller.py", line 62, in _site_request
    return await self._request(method, url, params=tokened_params, json=json)
  File "/config/custom_components/omada/api/controller.py", line 91, in _request
    self._raiseOnResponseError(response)
  File "/config/custom_components/omada/api/controller.py", line 107, in _raiseOnResponseError
    raise_response_error(response)
  File "/config/custom_components/omada/api/errors.py", line 23, in raise_response_error
    raise OmadaApiException("API Error Code {}: {}".format(response["errorCode"], response["msg"]))
custom_components.omada.api.errors.OmadaApiException: API Error Code -1001: Invalid request parameters.
boywiz commented 3 years ago

You can crank up the log verbosity by adding this to the configuration.yaml:

logger:
  default: info
  logs:
    custom_components.omada: debug

This will spit out some additional details about what url it attempted to request before failing.

so this is what i got from the debug i have replaced the password with xxxx's


2021-09-08 11:25:47 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: 192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxx'}
2021-09-08 11:25:47 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at 192.168.146.95:8043: Error requesting data from 192.168.146.95:8043/api/v2/login: 192.168.146.95:8043/api/v2/login
2021-09-08 11:25:53 INFO (SyncWorker_4) [pychromecast] Querying device status
2021-09-08 11:26:13 INFO (SyncWorker_3) [pychromecast] Querying device status
2021-09-08 11:27:01 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxx'}
2021-09-08 11:27:01 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.146.95:8043: Error requesting data from https://192.168.146.95:8043/api/v2/login: Cannot connect to host 192.168.146.95:8043 ssl:default [Connect call failed ('192.168.146.95', 8043)]
boywiz commented 3 years ago

You can crank up the log verbosity by adding this to the configuration.yaml:

logger:
  default: info
  logs:
    custom_components.omada: debug

This will spit out some additional details about what url it attempted to request before failing.

so this is what i got from the debug i have replaced the password with xxxx's


2021-09-08 11:25:47 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: 192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxx'}
2021-09-08 11:25:47 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at 192.168.146.95:8043: Error requesting data from 192.168.146.95:8043/api/v2/login: 192.168.146.95:8043/api/v2/login
2021-09-08 11:25:53 INFO (SyncWorker_4) [pychromecast] Querying device status
2021-09-08 11:26:13 INFO (SyncWorker_3) [pychromecast] Querying device status
2021-09-08 11:27:01 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxx'}
2021-09-08 11:27:01 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.146.95:8043: Error requesting data from https://192.168.146.95:8043/api/v2/login: Cannot connect to host 192.168.146.95:8043 ssl:default [Connect call failed ('192.168.146.95', 8043)]

so i changed my docker config to expose the ports but this did not fix the issue although it did provide more verbose output in the logs for has


2021-09-08 11:27:01 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:27:01 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.146.95:8043: Error requesting data from https://192.168.146.95:8043/api/v2/login: Cannot connect to host 192.168.146.95:8043 ssl:default [Connect call failed ('192.168.146.95', 8043)]
2021-09-08 11:47:31 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:47:32 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.146.95:8043/api/v2/login) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Set-Cookie': 'TPEAP_SESSIONID=6eba055b-0887-429e-8723-d9b46459b502; Path=/; Secure; HttpOnly', 'Set-Cookie': 'rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Tue, 07-Sep-2021 11:47:32 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 11:47:32 INFO (MainThread) [custom_components.omada.api.controller] Login successful. Role type 1.
2021-09-08 11:47:32 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/maintenance/controllerStatus - Params: [('token', '27d98eea4bec4bd496ba8c11af90c922')] - JSON: None
2021-09-08 11:47:32 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.146.95:8043/api/v2/maintenance/controllerStatus?token=27d98eea4bec4bd496ba8c11af90c922) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 11:47:32 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8043/api/v2/sites/Home/setting/ssids - Params: [('token', '27d98eea4bec4bd496ba8c11af90c922')] - JSON: None
2021-09-08 11:47:32 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.146.95:8043/api/v2/sites/Home/setting/ssids?token=27d98eea4bec4bd496ba8c11af90c922) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 11:47:32 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/omada/config_flow.py", line 62, in async_step_user
    controller = await get_api_controller(
  File "/config/custom_components/omada/controller.py", line 166, in get_api_controller
    await controller.update_ssids()
  File "/config/custom_components/omada/api/controller.py", line 52, in update_ssids
    response = await self._site_request("get", "/setting/ssids")
  File "/config/custom_components/omada/api/controller.py", line 62, in _site_request
    return await self._request(method, url, params=tokened_params, json=json)
  File "/config/custom_components/omada/api/controller.py", line 91, in _request
    self._raiseOnResponseError(response)
  File "/config/custom_components/omada/api/controller.py", line 107, in _raiseOnResponseError
    raise_response_error(response)
  File "/config/custom_components/omada/api/errors.py", line 23, in raise_response_error
    raise OmadaApiException("API Error Code {}: {}".format(response["errorCode"], response["msg"]))
custom_components.omada.api.errors.OmadaApiException: API Error Code -1005: Operation forbidden.
2021-09-08 11:47:48 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8088/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:47:48 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.146.95:8088: Error requesting data from https://192.168.146.95:8088/api/v2/login: Cannot connect to host 192.168.146.95:8088 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)]
2021-09-08 11:47:55 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: https://192.168.146.95:8088/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:47:55 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.146.95:8088: Error requesting data from https://192.168.146.95:8088/api/v2/login: Cannot connect to host 192.168.146.95:8088 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)]
2021-09-08 11:48:05 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: http://192.168.146.95:8088/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:48:05 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.146.95:8043/api/v2/login) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 11:48:05 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at http://192.168.146.95:8088: Unsupported request path.
2021-09-08 11:48:20 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: http://192.168.146.95:8088/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:48:20 DEBUG (MainThread) [custom_components.omada.api.controller] 200 application/json <ClientResponse(https://192.168.146.95:8043/api/v2/login) [200 OK]>
<CIMultiDictProxy('X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;charset=utf-8', 'Transfer-Encoding': 'chunked', 'Server': 'Jetty(9.4.15.v20190215)')>

2021-09-08 11:48:20 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at http://192.168.146.95:8088: Unsupported request path.
2021-09-08 11:48:33 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: 192.168.146.95:8088/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:48:33 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at 192.168.146.95:8088: Error requesting data from 192.168.146.95:8088/api/v2/login: 192.168.146.95:8088/api/v2/login
2021-09-08 11:48:58 DEBUG (MainThread) [custom_components.omada.api.controller] Requesting: 192.168.146.95:8043/api/v2/login - Params: None - JSON: {'username': 'hass', 'password': 'xxxxxxxxxxxxxx'}
2021-09-08 11:48:58 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at 192.168.146.95:8043: Error requesting data from 192.168.146.95:8043/api/v2/login: 192.168.146.95:8043/api/v2/login
boywiz commented 3 years ago

this may be something I am doing wrong but postman is failing to connect as well, when I try the URL ass HTTP it will redirect from http://192.168.146.95:8088/api/v2/login --> https://192.168.146.95:8043/api/v2/login

I can repeat this in both Chrome and Firefox

{"errorCode":-1600,"msg":"Unsupported request path."}

if i do http://192.168.146.95:8088/api/info or https://192.168.146.95:8043/api/info, i get

{"errorCode":0,"result":{"controllerVer":"4.4.4","apiVer":"2","configured":true,"type":1,"supportApp":true}}

massive commented 3 years ago

So, at least with me, the problem was trailing slash in the URL field. That caused the requests to fail.

{
    "errorCode": -1001,
    "msg": "Invalid request parameters."
}

After fixing that, I'm able to use the addon.

boywiz commented 3 years ago

Sorry for the lack of response I was trying something out, I rebooted the Hoameassiatant and the Omada controller that did not work. so I wondered if it was something in my Omada config or passwords. so to rule out the current environment i installed Omdad on my Windows Desktop configured it with the same admin accounts but no devices.

I tried to connect from Hass to the windows version and it worked. so I tried to then connect to my Docker controller and then that worked. I do not know if it was a user error or reboot timing or what, so we can close this problem but if you come up against this with anyone else ping me and I will be happy to try to help.

Sorry if you feel I have wasted your time

zachcheatham commented 3 years ago

No worries @boywiz. We can reopen this if the issue if it crops up again.