Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
427 stars 85 forks source link

Integration does not work for EV6 (Kia Connect) in Sweden (EU) #266

Closed a94marbo closed 2 years ago

a94marbo commented 2 years ago

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md Region and Brand of car Kia EV6

Describe the bug A clear and concise description of what the bug is. Cannot log in, Debug logs if an error occurred

Outlined here: https://github.com/fuatakgun/kia_uvo/blob/master/README.m

To Reproduce Steps to reproduce the behavior: Error message "Login failed into Kia Uvo / Hyundai Bluelink Servers. Please use official Kia Uvo app to logout and log back in and try again!"

If I follow instructions, no change. I have reinstalled the integration from HACS.

Expected behavior A clear and concise description of what you expected to happen. When logging in from GUI an error message pop up.

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context Add any other context about the problem here. Pulled from the log

Logger: custom_components.kia_uvo.config_flow Source: custom_components/kia_uvo/config_flow.py:170 Integration: Kia Uvo / Hyundai Bluelink (documentation, issues) First occurred: 17:20:01 (1 occurrences) Last logged: 17:20:01

kia_uvo Exception in kia_uvo login : HTTPSConnectionPool(host='prd.eu-ccapi.kia.com', port=8080): Max retries exceeded with url: /api/v1/spa/notifications/register (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5547a10760>: Failed to establish a new connection: [Errno 110] Operation timed out')) - traceback: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn conn.connect() File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect conn = self._new_conn() File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f5547a10760>: Failed to establish a new connection: [Errno 110] Operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='prd.eu-ccapi.kia.com', port=8080): Max retries exceeded with url: /api/v1/spa/notifications/register (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5547a10760>: Failed to establish a new connection: [Errno 110] Operation timed out')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/kia_uvo/config_flow.py", line 155, in async_step_user self.token = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 101, in login self.device_id, self.stamp = self.get_device_id() File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 167, in get_device_id response = requests.post(url, headers=headers, json=payload) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='prd.eu-ccapi.kia.com', port=8080): Max retries exceeded with url: /api/v1/spa/notifications/register (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5547a10760>: Failed to establish a new connection: [Errno 110] Operation timed out'))

fuatakgun commented 2 years ago

Please double check if you have an internal firewall blocking this call, in essence, your home assistant instance is failing to reach kia/hyundai servers.

a94marbo commented 2 years ago

Hmm, cant be that. I can ping the server from Terminal i HomeAssistant,

image Port 8080 as well: image

cdnninja commented 2 years ago

Ping confirms routing not connectivity. Please try telnet. Also try the mobile app while on wifi or the same network.

On Jan 25, 2022, at 10:46 AM, a94marbo @.***> wrote:

 Hmm, cant be that. I can ping the server from Terminal i HomeAssistant,

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

a94marbo commented 2 years ago

Hmm.. ok from WIFI it does not work from the app. Had som old port forwarding rules for port 8080, but still does not work after that I have removed them. But something is fishy... thanks... I will have to keep hunting.

a94marbo commented 2 years ago

Sorry for reopening this issue. I realize that my router is causing this, but I cannot get it to work. I have port forwarded port 8080 to the home assistant computer, but I still get this problem. I have experimented a bit with the phone app, On mobile network it works, on WIFI it does not work, on WIFI with VPN on it works, Is only communication on port 8080?

fuatakgun commented 2 years ago

We don't have control of kia servers and their port requirements, we need to hit their 8080 port.

a94marbo commented 2 years ago

I understand that. So it should be enough to port forward 8080 to home assistant?

cdnninja commented 2 years ago

No this is the wrong traffic direction - home assistant (and the app) do an outbound connection to Kia/hyundai. You should not need any inbound port forwarding configured. What it sounds like is happening is port 8080 is being blocked outbound. This is separate from port forwarding. I am concerned for your networks security as port forwarding has significant risk if not used correctly.

Read up on the concept of a NAT as I assume you are using that. A default consumer device will allow all outbound communication and this will work for this integration. Port forwarding in a consumer circumstance is only ever used when you are hosting something that you want everyone on the internet to access. Including strangers.

cdnninja commented 2 years ago

If you have more questions feel free to comment. For now I will close this.