mbillow / ha-chargepoint

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

Integration breaks after updating to HA 2023.3 #23

Closed SeanPM5 closed 1 year ago

SeanPM5 commented 1 year ago

Have been using this integration for a couple days now after the (much appreciated!) v0.5.0 fix and it was working flawlessly, but immediately after updating to Home Assistant 2023.3 beta, the integration breaks and all entities become unavailable. I get the following error in logs:

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/chargepoint/__init__.py:107
Integration: ChargePoint (documentation, issues)
First occurred: 9:44:50 PM (2 occurrences)
Last logged: 10:07:32 PM

Error setting up entry SeanMooney for chargepoint
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, 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.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/client.py", line 78, in __init__
    self._global_config = self._get_configuration(username)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/client.py", line 177, in _get_configuration
    config = ChargePointGlobalConfiguration.from_json(response.json())
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 116, in from_json
    supported_ctr = [
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 117, in <listcomp>
    ChargePointCountry.from_json(country)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 45, in from_json
    zoom_bounds=ChargePointZoomBounds.from_json(json["zoomBounds"]),
KeyError: 'zoomBounds'
This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/chargepoint/config_flow.py:28
Integration: ChargePoint (documentation, issues)
First occurred: 10:08:56 PM (1 occurrences)
Last logged: 10:08:56 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, 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 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 241, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *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 271, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/chargepoint/config_flow.py", line 110, in async_step_user
    return await self._update_options()
  File "/config/custom_components/chargepoint/config_flow.py", line 126, in _update_options
    session_token = await self._test_credentials(
  File "/config/custom_components/chargepoint/config_flow.py", line 28, in _test_credentials
    client = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/client.py", line 78, in __init__
    self._global_config = self._get_configuration(username)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/client.py", line 177, in _get_configuration
    config = ChargePointGlobalConfiguration.from_json(response.json())
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 116, in from_json
    supported_ctr = [
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 117, in <listcomp>
    ChargePointCountry.from_json(country)
  File "/usr/local/lib/python3.10/site-packages/python_chargepoint/global_config.py", line 45, in from_json
    zoom_bounds=ChargePointZoomBounds.from_json(json["zoomBounds"]),
KeyError: 'zoomBounds'

The official stable release for 2023.3 is in just a couple days on Wednesday March 1st, so just wanted to give an early heads up.

rickytenzer commented 1 year ago

Same problem for me, I tried removing the integration altogether and now I get an unknown error when trying to login.

image
MattFromTheFuture commented 1 year ago

I believe I have the same error as well, though I'm running: 2023.2.5

mbillow commented 1 year ago

Make sure you are on v0.6.0. This should be resolved.

SeanPM5 commented 1 year ago

Confirming that v0.6.0 fixes this (and the new switch entity for starting/stopping charge is great too). Thanks @mbillow !

mbillow commented 1 year ago

Awesome, glad the fix worked for you. I noticed it while I was testing the switch entity work and tackled it as a part of that release. Thanks again for reporting the issue!