Closed 4integration closed 9 months ago
this beta should fix this problem. let try the last beta 1.2.8: https://github.com/leeyuentuen/polestar_api/releases/tag/1.2.8
@4integration ,☝️
Been running 1.2.8 since release but still problems (just noted 1.2.9 though, will update)
Did a system reboot right now:
and
2024-01-02 08:15:02.654 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Polestar EV for polestar_api
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
await event.wait()
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1621, in wait
await self._event.wait()
File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 63760ab0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 115, in fail_after
yield cancel_scope
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 217, in connect_tcp
async with create_task_group() as tg:
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 654, in __aexit__
await asyncio.wait(self.cancel_scope._tasks)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 428, in wait
return await _wait(fs, timeout, return_when, loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 535, in _wait
await waiter
asyncio.exceptions.CancelledError: Cancelled by cancel scope 63760a30
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
with anyio.fail_after(timeout):
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 118, in fail_after
raise TimeoutError
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/__init__.py", line 42, in async_setup_entry
await polestarApi.init()
File "/config/custom_components/polestar_api/polestar.py", line 32, in init
await self.polestarApi.init()
File "/config/custom_components/polestar_api/pypolestar/polestar.py", line 31, in init
await self.auth.get_token()
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 29, in get_token
code = await self._get_code()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 67, in _get_code
query_params = await self._get_resume_path()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 122, in _get_resume_path
result = await self._client_session.get("https://polestarid.eu.polestar.com/as/authorization.oauth2", params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout
Same issue with 1.2.9
Reloading the integration makes it work
have you tried to remove the entity and readd them? could be the old config issue
second thing, could you go to this link? https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write
if not maybe it should something with firewall related on your network? @4integration
@leeyuentuen Removed everything related to Polestar integration and reinstalled från HACS etc Rebooted, same issue Reloaded integration and it starts fine
Link with web browser works fine and I am logged in.
Firewall, I doubt it...
Do have any handy curl requests I can try from the terminal?
@4integration
from the log that you gave me above, the integration got a timeout on the following URL:
result = await self._client_session.get("https://polestarid.eu.polestar.com/as/authorization.oauth2", params=params)
this call should be timeout when you also try with following curl command:
curl -v https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write
if it works correctly, on that curl command, you should get a 303 response code that include a resume_path on it.
so you can reproduce this issue everytime when you just reboot HA, and it solved when you reload the integration?
maybe provide me again with new logs, so I can see if I see something strange on it.
so you can reproduce this issue everytime when you just reboot HA, and it solved when you reload the integration?
Yes, every time I reboot
Curl call result looks like:
[core-ssh ~]$ curl -v https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=op
enid%20profile%20email%20customer:attributes%20customer:attributes:write
[1] 208
[2] 209
[3] 210
[2]- Done client_id=polmystar
[core-ssh ~]$ * Trying 172.64.155.161:443...
* Connected to polestarid.eu.polestar.com (172.64.155.161) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=polestar.com
* start date: Feb 24 00:00:00 2023 GMT
* expire date: Feb 24 23:59:59 2024 GMT
* subjectAltName: host "polestarid.eu.polestar.com" matched cert's "polestarid.eu.polestar.com"
* issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
* SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: polestarid.eu.polestar.com]
* [HTTP/2] [1] [:path: /as/authorization.oauth2?response_type=code]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /as/authorization.oauth2?response_type=code HTTP/2
> Host: polestarid.eu.polestar.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 303
< date: Tue, 02 Jan 2024 09:19:14 GMT
< content-type: text/html;charset=utf-8
< content-length: 83
< location: https://polestarid.eu.polestar.com/PolestarLogin/error?errorCode=ERR020
< x-frame-options: SAMEORIGIN
< referrer-policy: origin
< pragma: no-cache
< set-cookie: PF=SQPaCQ6V4hQQQSRwuYQjkh; Path=/; Expires=Tue, 02-Jan-2024 10:19:13 GMT; Max-Age=3600; Secure; HttpOnly; SameSite=None
< cache-control: must-revalidate,no-cache,no-store
< cf-cache-status: DYNAMIC
< server: cloudflare
< cf-ray: 83f1eb503f95abd4-CPH
<
<!DOCTYPE html>
<!-- template name: http.error.page.template.html -->
* Connection #0 to host polestarid.eu.polestar.com left intact
[core-ssh ~]$
Full log after system reboot (before reloading Polestar integration and reload doesn't log anything):
2024-01-02 10:17:14.768 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration polestar_api which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-02 10:17:14.773 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-02 10:17:14.777 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration chargeamps which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-02 10:17:56.642 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Polestar EV for polestar_api
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
await event.wait()
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1621, in wait
await self._event.wait()
File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 63d4c9d0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 115, in fail_after
yield cancel_scope
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 217, in connect_tcp
async with create_task_group() as tg:
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 654, in __aexit__
await asyncio.wait(self.cancel_scope._tasks)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 428, in wait
return await _wait(fs, timeout, return_when, loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 535, in _wait
await waiter
asyncio.exceptions.CancelledError: Cancelled by cancel scope 636992d0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
with anyio.fail_after(timeout):
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/anyio/_core/_tasks.py", line 118, in fail_after
raise TimeoutError
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
with map_exceptions(exc_map):
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/__init__.py", line 42, in async_setup_entry
await polestarApi.init()
File "/config/custom_components/polestar_api/polestar.py", line 32, in init
await self.polestarApi.init()
File "/config/custom_components/polestar_api/pypolestar/polestar.py", line 31, in init
await self.auth.get_token()
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 29, in get_token
code = await self._get_code()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 67, in _get_code
query_params = await self._get_resume_path()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/polestar_api/pypolestar/auth.py", line 122, in _get_resume_path
result = await self._client_session.get("https://polestarid.eu.polestar.com/as/authorization.oauth2", params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout
2024-01-02 10:18:12.055 INFO (MainThread) [homeassistant.components.mysensors] Adding new devices: [<Entity Heater Energy 5 0>, <Entity Garage + Out Temp Sensor 3 0>, <Entity Garage + Out Temp Sensor 3 1>, <Entity Laundry Sensor 4 2>, <Entity Laundry Sensor 4 0>, <Entity Laundry Sensor 4 1>, <Entity Vrum Temp+Light Sensor 2 0>, <Entity Vrum Temp+Light Sensor 2 1>, <Entity Bedroom Temp Sensor 1 0>, <Entity Energy Meter 7 1>, <Entity Energy Meter 7 2>, <Entity Heater Meter 6 2>, <Entity Heater Meter 6 1>, <Entity Laundry Sensor 8 3>, <Entity Laundry Sensor 8 2>, <Entity Laundry Sensor 8 0>, <Entity Laundry Sensor 8 1>, <Entity Mobile Temp Sensor 11 0>]
2024-01-02 10:18:12.056 INFO (MainThread) [mysensors.gateway_tcp] Trying to connect to ('192.168.1.11', 5003)
2024-01-02 10:18:13.286 INFO (MainThread) [mysensors.transport] Connected to <_SelectorSocketTransport fd=33 read=idle write=<idle, bufsize=0>>
2024-01-02 10:18:13.300 WARNING (MainThread) [homeassistant.setup] Setup of chargeamps is taking over 10 seconds.
2024-01-02 10:18:23.427 INFO (MainThread) [mysensors.handler] n:0 c:255 t:3 s:14 p:Gateway startup complete.
2024-01-02 10:19:31.216 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.polestar_1084_average_speed_km_per_hour (km/h) cannot be converted to the unit of previously compiled statistics (km). Generation of long term statistics will be suppressed unless the unit changes back to km or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2024-01-02 10:19:31.728 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.polestar_1084_estimate_distance_to_empty_miles (mi) cannot be converted to the unit of previously compiled statistics (miles). Generation of long term statistics will be suppressed unless the unit changes back to miles or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2024-01-02 10:19:31.729 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.polestar_1084_average_energy_consumption_kwh_per_100_km (kWh/100km) cannot be converted to the unit of previously compiled statistics (Kwh/100km). Generation of long term statistics will be suppressed unless the unit changes back to Kwh/100km or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2024-01-02 10:19:31.730 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.polestar_1084_estimate_full_charge_range_miles (mi) cannot be converted to the unit of previously compiled statistics (miles). Generation of long term statistics will be suppressed unless the unit changes back to miles or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
seems your curl request got a 303, but didn't got the correct response resumePath
* Trying 104.18.32.95:443...
* Connected to polestarid.eu.polestar.com (104.18.32.95) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=polestar.com
* start date: Feb 24 00:00:00 2023 GMT
* expire date: Feb 24 23:59:59 2024 GMT
* subjectAltName: host "polestarid.eu.polestar.com" matched cert's "polestarid.eu.polestar.com"
* issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
* SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: polestarid.eu.polestar.com]
* [HTTP/2] [1] [:path: /as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write HTTP/2
> Host: polestarid.eu.polestar.com
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 303
< date: Tue, 02 Jan 2024 09:30:57 GMT
< content-type: text/html;charset=utf-8
< content-length: 15
< location: https://polestarid.eu.polestar.com/PolestarLogin/login?resumePath=goFOkKdIoU&client_id=polmystar
< x-frame-options: SAMEORIGIN
< referrer-policy: origin
< cache-control: no-cache, no-store
< pragma: no-cache
< expires: Thu, 01 Jan 1970 00:00:00 GMT
< set-cookie: PF=cEpSJuMDewd5jN1chisCUU; Path=/; Expires=Tue, 02-Jan-2024 10:30:57 GMT; Max-Age=3600; Secure; HttpOnly; SameSite=None
< cf-cache-status: DYNAMIC
< server: cloudflare
< cf-ray: 83f1fc7fdfe4b9a8-BRU
you got
https://polestarid.eu.polestar.com/PolestarLogin/error?errorCode=ERR020
but it should something like this:
https://polestarid.eu.polestar.com/PolestarLogin/login?resumePath=goFOkKdIoU&client_id=polmystar
maybe try run this
curl -v 'https://polestarid.eu.polestar.com/as/authorization.oauth2?response_type=code&client_id=polmystar&redirect_uri=https%3A%2F%2Fwww.polestar.com%2Fsign-in-callback&scope=openid%20profile%20email%20customer:attributes%20customer:attributes:write' because on linux it has separated the & in different lines
i think i notice the issue: the server that you have connect is 172.64.155.161 and mine is 104.18.32.95
I've put the DNS record on my pihole and I can also reproduce this issue.
maybe you can try to force your dns to use the other IP polestarid.eu.polestar.com as 104.18.32.95 and see if this still exists this issue
@4integration I've created a new beta 1.3.1: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.1 I've put the timeout of a GET request longer. default it is on 5s, but maybe the first call (before in cache) takes a longer time. let's take a try and see if there is some improvement.
1.3.1 have been working after 2 reboots, no issues :) .
Tried another SSH addon (with webui) and also remote SSH session and the second curl command works.
Regarding the IP it seems that it resolves to the two IPs
$ dig polestarid.eu.polestar.com
; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> polestarid.eu.polestar.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12738
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;polestarid.eu.polestar.com. IN A
;; ANSWER SECTION:
polestarid.eu.polestar.com. 22 IN A 104.18.32.95
polestarid.eu.polestar.com. 22 IN A 172.64.155.161
;; Query time: 0 msec
;; SERVER: 192.168.1.1#53(192.168.1.1) (UDP)
;; WHEN: Tue Jan 02 14:27:14 CET 2024
;; MSG SIZE rcvd: 87
thanks @leeyuentuen
For now i have blocked 172.64.155.161, so that the integrations communication uses 104.18.32.95 only. We will se if the new beta 1.3.1 works now for some days.
@leeyuentuen: Thank you for this great work!
Today the values are again "unkonwn".
Log:
2024-01-02 18:32:37.974 ERROR (MainThread) [custom_components.polestar_api.pypolestar.polestar] 403: Forbidden
2024-01-03 00:38:40.926 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 350, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message:
Data after Connection: close
:
b'HELP'
^
2024-01-03 07:10:47.795 WARNING (MainThread) [custom_components.polestar_api.polestar] Read Timeout on update data
if you ping polestarid.eu.polestar.com which ip do you get?
which country are you located?
@Ottmar0815 take a look at this beta version: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.2
if you ping polestarid.eu.polestar.com which ip do you get?
which country are you located?
Located in germany.
I have blocked the old ip, so only the new ip should be resolved. I will check later.
@Ottmar0815 take a look at this beta version: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.2
I have installed this beta now.
And again all entities "unkown". API-Status says "API OK".
if you ping polestarid.eu.polestar.com which ip do you get?
It switches between both ip´s. Checked over the router-interface.
maybe i found something. let me investigate
just forget the previous logic about DNS try the new beta: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.6
here is the logic, once it got an exception, the code stopped fetching data. so we need to reload to get them to work because I mark them that I'm still updating. I've changed the value, once we get an exception, the next time he can fetch again the data @Ottmar0815
Okay, thank you. I have installed 1.3.6 some minutes ago (corrected some entity-naming) and will test it.
By the way: An installation directly with 1.3.6 doesn't work (Authentification with user and password doesn't work) - you have to install 1.3.0 first, set it up and then install 1.3.6. Only for your information when going into main branch.
Okay, thank you. I have installed 1.3.6 some minutes ago (corrected some entity-naming) and will test it.
By the way: An installation directly with 1.3.6 doesn't work (Authentification with user and password doesn't work) - you have to install 1.3.0 first, set it up and then install 1.3.6. Only for your information when going into main branch.
config flow should be fix with the authentication on this beta version: https://github.com/leeyuentuen/polestar_api/releases/tag/1.3.8
still got issue here with the latest release? @Ottmar0815 @4integration
Since i had updated to 1.3.6 no issue.
Thank you very much!
When rebooting HA I get a lot of errors.
After reloading the plugin it starts to work.
Runnig the latest HA