zaptec icon indicating copy to clipboard operation
zaptec copied to clipboard

Cannot connect when not being owner of charger

Open gabrielg478 opened this issue 1 month ago • 14 comments

Hi,

Since a few days I cannot connect to Zaptec anymore:

Image

I checked my credentials many times, tried to download another version, but nothing changed. Many things changed at the same time (component update to 0.8.5, HAOS update to 2025.11, and security update on Zaptec side). To be honest I can not says which one may be involved.

Error log:

Enregistreur: custom_components.zaptec.zaptec.validate Source: custom_components/zaptec/zaptec/validate.py:167 intégration: Zaptec EV charger (documentation, problèmes) S'est produit pour la première fois: 08:36:54 (1 occurrence) Dernier enregistrement: 08:36:54

Failed to validate installation (pattern installation): 1 validation error for Installations Data.0.AuthenticationType Field required [type=missing, input_value={'Id': '5cc6e035-ad6b-45d...utomaticUpdates': False}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

gabrielg478 avatar Nov 07 '25 07:11 gabrielg478

I have the same issue

codeingreindeeer avatar Nov 07 '25 18:11 codeingreindeeer

Same here

dawsonyt82 avatar Nov 08 '25 17:11 dawsonyt82

I think I found the issue, can you please confirm that your Zaptec-user has one or more chargers where you only have User access, not Owner? @gabrielg478 @codeingreindeeer @dawsonyt82

While you wait for 0.8.6, here are a couple of quickfix-options (assuming I've identified the issue correctly):

  • Adjust Roles in Zaptec portal so that you don't have any chargers with only the User role. This could mean either
    • Create a separate HA-user that only has access to the charger(s) you want, but has both Owner+User role, or
    • Remove the User role for the chargers where you only have that Role, or
    • Add Owner role for the chargers where you only have that Role
  • Edit the custom integration files using the File Editor addon:
    • Make sure you backup your HA instance and know where your encryption key is stored before doing this
    • Comment out the AuthenticationType-line(20) seen in the image below, save the file, then restart HA Image

Not sure when 0.8.6 will be released, especially since I don't have access to push out new releases myself, but hopefully we can get something out fairly soon.

steinmn avatar Nov 08 '25 19:11 steinmn

That is correct, i have Chargers in my Zaptec Account with only User role. I think i‘ll wait for the Update. Thank you

dawsonyt82 avatar Nov 08 '25 19:11 dawsonyt82

Correct for me as well, I have one as Owner, and one as User. Nice job.

Back in the days I had difficulties to configure the Zaptec app, I may also wait for the update ;-)

gabrielg478 avatar Nov 08 '25 20:11 gabrielg478

I was experiencing the same problem. Can confirm commenting out AuthenticationType works as a workaround.

Kahera avatar Nov 08 '25 21:11 Kahera

I created a new Zaptec user with only the charger for which I have Owner+User role, and it worked. For the moment I'm fine like this, many thanks.

gabrielg478 avatar Nov 09 '25 09:11 gabrielg478

Version v0.8.6 has been released that incorporates a fix for this issue: https://github.com/custom-components/zaptec/releases/tag/v0.8.6

sveinse avatar Nov 09 '25 15:11 sveinse

I have four chargers and have the owner on all of them, but I'm still facing issues when trying to set them up. All worked fine until a couple of days ago. I have just installed the ne version v0.8.6

This is the error i get: Failed to set up: POST request to https://api.zaptec.com/oauth/token failed with status 503: <ClientResponse(https://api.zaptec.com/oauth/token) [503 Service Temporarily Unavailable]> <CIMultiDictProxy('Server': 'nginx/1.29.0', 'Date': 'Sun, 09 Nov 2025 15:58:54 GMT', 'Content-Type': 'text/html', 'Content-Length': '197', 'Connection': 'keep-alive')>

I also get this: Failed setup, will retry: Failed to validate data: 1 validation error for list[ChargerFirmware] 0.IsOnline Field required [type=missing, input_value={'ChargerId': 'd59c50bf-6...: 4, 'IsUpToDate': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

This happens eve after i have made a new account that is only set as Owner and User

codeingreindeeer avatar Nov 09 '25 16:11 codeingreindeeer

The 503 error is an unexpected response from Zaptec. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503 - The _refresh_token() function fails immediately on all non OK responses. Maybe it helps if we retry the request several times on 503?

The IsOnline field should according to the Zaptec documentation be present, so something strange is going on.

Are these two correlated I wonder? Getting a 503 on token refresh and not all data present in the data from Zaptec?

sveinse avatar Nov 09 '25 17:11 sveinse

Could the missing IsOnline-field be related to the issue described in #324?

steinmn avatar Nov 09 '25 21:11 steinmn

Ill add the full logs if this will help

`This error originated from a custom integration.

Logger: custom_components.zaptec.zaptec.validate Source: custom_components/zaptec/zaptec/validate.py:152 Integration: Zaptec EV charger (documentation, issues) First occurred: 23:27:29 (2 occurrences) Last logged: 23:27:35

Failed to validate chargerFirmware/installation/[UUID_INSTALLATION] (pattern chargerFirmware/installation/[0-9a-f-]+): 1 validation error for list[ChargerFirmware] 0.IsOnline Field required [type=missing, input_value={'ChargerId': '[UUID_CHARGER]', 'CurrentVersion': '...', 'AvailableVersions': 4, 'IsUpToDate': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

This error originated from a custom integration.

Logger: custom_components.zaptec.coordinator Source: custom_components/zaptec/coordinator.py:116 Integration: Zaptec EV charger (documentation, issues) First occurred: 23:27:29 (2 occurrences) Last logged: 23:27:35

Fetching data failed Traceback (most recent call last): File "/config/custom_components/zaptec/zaptec/api.py", line 1149, in request validate(json_result, url=url) File "/config/custom_components/zaptec/zaptec/validate.py", line 149, in validate model.validate_python(data, strict=True) File "/usr/local/lib/python3.13/site-packages/pydantic/type_adapter.py", line 441, in validate_python return self.validator.validate_python(object) pydantic_core._pydantic_core.ValidationError: 1 validation error for list[ChargerFirmware] 0.IsOnline Field required [type=missing, input_value={'ChargerId': '[UUID_CHARGER]', 'CurrentVersion': '...', 'AvailableVersions': 4, 'IsUpToDate': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/zaptec/coordinator.py", line 116, in _async_update_data await self.zaptec.poll() File "/config/custom_components/zaptec/zaptec/api.py", line 1305, in poll await obj.poll_firmware_info() File "/config/custom_components/zaptec/zaptec/api.py", line 315, in poll_firmware_info firmware_info = await self.zaptec.request(f"chargerFirmware/installation/[UUID_INSTALLATION]") File "/config/custom_components/zaptec/zaptec/api.py", line 1151, in request raise log_exc(RequestDataError(f"Failed to validate data: {err}")) from err custom_components.zaptec.zaptec.exceptions.RequestDataError: Failed to validate data: 1 validation error for list[ChargerFirmware] 0.IsOnline Field required [type=missing, input_value={'ChargerId': '[UUID_CHARGER]', 'CurrentVersion': '...', 'AvailableVersions': 4, 'IsUpToDate': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

This error originated from a custom integration.

Logger: custom_components.zaptec Source: custom_components/zaptec/init.py:90 Integration: Zaptec EV charger (documentation, issues) First occurred: 23:27:45 (1 occurrence) Last logged: 23:27:45

Zaptec API error: POST request to https://api.zaptec.com/oauth/token failed with status 503: <ClientResponse(https://api.zaptec.com/oauth/token) [503 Service Temporarily Unavailable]> <CIMultiDictProxy('Server': 'nginx/1.29.0', 'Date': 'Sun, 09 Nov 2025 22:27:45 GMT', 'Content-Type': 'text/html', 'Content-Length': '197', 'Connection': 'keep-alive')>

Logger: homeassistant.config_entries Source: config_entries.py:761 First occurred: 23:27:45 (1 occurrence) Last logged: 23:27:45

Error setting up entry Zaptec for zaptec: POST request to https://api.zaptec.com/oauth/token failed with status 503: <ClientResponse(https://api.zaptec.com/oauth/token) [503 Service Temporarily Unavailable]> <CIMultiDictProxy('Server': 'nginx/1.29.0', 'Date': 'Sun, 09 Nov 2025 22:27:45 GMT', 'Content-Type': 'text/html', 'Content-Length': '197', 'Connection': 'keep-alive')>

Traceback (most recent call last): File "/config/custom_components/zaptec/init.py", line 82, in async_setup_entry await zaptec.login() File "/config/custom_components/zaptec/zaptec/api.py", line 1047, in login await self._refresh_token() File "/config/custom_components/zaptec/zaptec/api.py", line 1094, in _refresh_token raise log_exc(RequestError("POST request to Zaptec token endpoint failed with status 503")) from err custom_components.zaptec.zaptec.exceptions.RequestError: POST request to https://api.zaptec.com/oauth/token failed with status 503: <ClientResponse(https://api.zaptec.com/oauth/token) [503 Service Temporarily Unavailable]> <CIMultiDictProxy('Server': 'nginx/1.29.0', 'Date': 'Sun, 09 Nov 2025 22:27:45 GMT', 'Content-Type': 'text/html', 'Content-Length': '197', 'Connection': 'keep-alive')>`

I am not a experienced coder, so i dont really know what this means, and what i should do to fix it

codeingreindeeer avatar Nov 09 '25 22:11 codeingreindeeer

@codeingreindeeer According to feedback from Zaptec in #360 the 503 error is an error on their side. They recommend you to reach out to Zaptec support to resolve the problem.

sveinse avatar Nov 10 '25 08:11 sveinse

Regarding missing "isOnline". What is the serial of the problematic charger? It will be helpful to know, since this is a behavior that should be compatible with the previous.

@codeingreindeeer

thecoldwine avatar Nov 10 '25 21:11 thecoldwine