leeyuentuen / polestar_api

Polestar Api - Home Assistant Component
MIT License
112 stars 18 forks source link

Error while setting up polestar_api platform for sensor #130

Closed heimwege closed 2 months ago

heimwege commented 2 months ago

Hey guys,

I currently get the following error from the polestar API:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/polestar_api/sensor.py", line 504, in async_setup_entry
    PolestarSensor(device, description) for description in POLESTAR_SENSOR_TYPES
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/polestar_api/sensor.py", line 523, in __init__
    unique_id = device.vin[-4:]
                ~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

and

Traceback (most recent call last):
  File "/config/custom_components/polestar_api/pypolestar/polestar.py", line 43, in init
    await self.auth.get_token()
  File "/config/custom_components/polestar_api/pypolestar/auth.py", line 32, in get_token
    code = await self._get_code()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/polestar_api/pypolestar/auth.py", line 97, in _get_code
    raise PolestarAuthException("Error getting code", result.status_code)
custom_components.polestar_api.pypolestar.exception.PolestarAuthException: Error getting code

I did not change my setup. HA and the polestar API are up to date. Any idea where this comes from? Is it maybe related to the 2FA being enabled for my account now so that a token can no longer be retrieved with just polestarID/password?

heimwege commented 2 months ago

I'll quickly close this one before anybody finds out 🙈 Of course it was my fault. Because of the 2FA I changed my polestar ID and totally forgot about it 🤣