zachcheatham / ha-omada

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

Unable to connect to service #3

Closed sreggy closed 1 year ago

sreggy commented 2 years ago

Dear all, I'm trying to enable integration in HA, but when I configure it I get the error 'Unable to connect to service.' As URL I'm using my controller, HTTPS, link .... like https://192.168.0.200, SIte in the one configured in the controller, like Home, and Verify SSL is checked.

Is there something of wrong in the above configuration, or I get an issue?

Thanks in advance Stefano

zachcheatham commented 2 years ago

I would say also try specifying the port. If you're able to access it with that link without a port, use :443. If that doesn't work, please include HA logs to help track down the issue.

sreggy commented 2 years ago

Hi, I did a test using :443 port on the link. Following the HA log

-- with Verify SSL flagged

021-10-27 21:55:44 WARNING (MainThread) [custom_components.omada.controller] Unable to connect to Omada at https://192.168.0.200:443: Error requesting data from https://192.168.0.200:443/api/v2/login: Cannot connect to host 192.168.0.200:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')]

-- with Verify SSL not flagged

2021-10-27 21:56:26 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 98, 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 136, in handle

result = await result

File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post

return await super().post(request, flow_id)

File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper

result = await method(view, request, *args, **kwargs)

File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post

result = await self._flow_mgr.async_configure(flow_id, data)

File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 198, 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 256, 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.

Thanks in advance for you support. Regards Stefano Regaglia

On Wed, Oct 27, 2021 at 7:40 PM Zach Cheatham @.***> wrote:

I would say also try specifying the port. If you're able to access it with that link without a port, use :443. If that doesn't work, please include HA logs to help track down the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zachcheatham/ha-omada/issues/3#issuecomment-953160658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIVIEAAS3PPMJDWVZ73NHZDUJA2QFANCNFSM5GQNXP2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ssummer commented 2 years ago

I think that you need to uncheck "Verify SSL" when you add the integration - sounds like you might be using a self signed SSL certificate for your controller and that won't be trusted by default. Do you get a certificate warning/error if you try and access your controller using a web browser?

sreggy commented 2 years ago

Hi, I did a test with 'Verify SSL' non flagged ... log is in the previous e-mail. About the certificate warning, yes I receive it using a web browser. On the device there is an invalid certificate. What should I do? thanks

On Thu, Oct 28, 2021 at 3:58 PM ssummer @.***> wrote:

I think that you need to uncheck "Verify SSL" when you add the integration

  • sounds like you might be using a self signed SSL certificate for your controller and that won't be trusted by default. Do you get a certificate warning/error if you try and access your controller using a web browser?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zachcheatham/ha-omada/issues/3#issuecomment-953871692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIVIEAC5Q2PUKWK7E7K23R3UJFQIBANCNFSM5GQNXP2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

sreggy commented 2 years ago

Hi, I did another test with Verify SSL non flagged, following the error: ''' 2021-11-09 10:16:57 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 98, 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 138, 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 157, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 246, 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 320, 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. '''

any suggestion? Thanks in advance Regards Stefano

GHRRGH commented 2 years ago

For me the issue was that I had to use "Default" as the site, instead of the custom site name I have set. With this change it worked like a charm :)

UnbridledGames commented 2 years ago

Same issue, doesn't matter what I use as the site, Unable to connect to service appears immediately upon clicking sumbit. Its too fast to be getting a response from the server.

PeterKalel commented 2 years ago

Hello idem for me Unable to connect to Omada at 192.168.55.9: Error requesting data from 192.168.55.9/api/v2/login: 192.168.55.9/api/v2/login Unable to connect to Omada at 192.168.55.9:8043: Error requesting data from 192.168.55.9:8043/api/v2/login: 192.168.55.9:8043/api/v2/login Unable to connect to Omada at https://192.168.55.9:8043: Error requesting data from https://192.168.55.9:8043/api/v2/login: Cannot connect to host 192.168.55.9:8043 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')]

rgutialo commented 2 years ago

Same issue here. I try to uncheck the SSL verification (because my browser shows an error) and I got the same error as @sreggy

Anyone could solve it?

zachcheatham commented 1 year ago

Closing this as it's been stale for over a year. Please let us know if you're still having this issue.

ssummer commented 1 year ago

Yes, I still have this issue everytime I restart and have an automation to reload it after a few minutes after startup. Possibly the same issue as:https://github.com/zachcheatham/ha-omada/issues/33StephenOn 1 Nov 2022, at 18:57, Zach Cheatham @.***> wrote: Closing this as it's been stale for over a year. Please let us know if you're still having this issue.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

KruseLuds commented 1 year ago

I still have the issue but only intermittently. Reloading the integration almost always fixes it.