mbillow / ha-chargepoint

Home Assistant ChargePoint EV Charger Integration
MIT License
44 stars 6 forks source link

Can’t set up integration #8

Closed danswett closed 2 years ago

danswett commented 2 years ago

I just downloaded the repo via HACS, and every time I try to add the integration it errors out creating the account.

The password is correct (I’ve tried this over and over again, and when I use the wrong password it says “invalid credentials” which isn’t the error here).

I’ve tried deleting and re-setting up the integration and redownloading the repo. I’ve also tried setting up the account with my email and with the username (same issue occurs).

There are three entries written into the logs:

  1. Authenticating
  2. Getting session token
  3. This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/chargepoint/init.py:107 Integration: ChargePoint (documentation, issues) First occurred: 2:26:04 PM (1 occurrences) Last logged: 2:26:04 PM

Error setting up entry danswett for chargepoint Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/chargepoint/init.py", line 107, in async_setup_entry client: ChargePoint = await hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "/usr/local/lib/python3.9/site-packages/python_chargepoint/client.py", line 84, in init account: ChargePointAccount = self.get_account() File "/usr/local/lib/python3.9/site-packages/python_chargepoint/client.py", line 42, in check_login return func(args, **kwargs) File "/usr/local/lib/python3.9/site-packages/python_chargepoint/client.py", line 218, in get_account return ChargePointAccount.from_json(account) File "/usr/local/lib/python3.9/site-packages/python_chargepoint/types.py", line 85, in from_json user = ChargePointUser.from_json(json["user"]) File "/usr/local/lib/python3.9/site-packages/python_chargepoint/types.py", line 54, in from_json phone_country_id=json["phoneCountryId"], KeyError: 'phoneCountryId'

I didn’t see this issue listed on the repo here - is there something I’m doing wrong?

Thanks!

mbillow commented 2 years ago

Hmmm, I wonder if your account just doesn't have a phone number associated with it. I went ahead and published v0.2.2 of the integration which makes that field an Optional[int]. We don't use it anywhere and it seems to be some form of internal country ID. The US is 40. 🤷🏼

Let me know if you run into anything else.

danswett commented 2 years ago

Thanks! I suspected it was something like that and dug around in the profile settings in the app. Couldn’t find any way to add a phone number to my account (or even an address). I wonder if it’s because my payment method is only configured as “Apple Pay”, and as such doesn’t have a billing address/phone number?

Who knows. Thanks for the fix!

mbillow commented 2 years ago

Yah, the API knows my phone number but I can’t get the app to show it to me anywhere. More or less in a way that I could update it. 🙃