Skip to content

Fix incorrect validation model for charger update#352

Merged
sveinse merged 2 commits intocustom-components:masterfrom
steinmn:fix-wrong-validation-model-for-charger-update
Nov 4, 2025
Merged

Fix incorrect validation model for charger update#352
sveinse merged 2 commits intocustom-components:masterfrom
steinmn:fix-wrong-validation-model-for-charger-update

Conversation

@steinmn
Copy link
Contributor

@steinmn steinmn commented Nov 4, 2025

api/chargers/{id}/update only returns an empty response (with a 200/401/403 response code). Not sure if this is due to a change in the API or if it's just a sleeper-bug that was introduced in #183 and never triggered because the validation code was not executed previously.

Fixes #351

api/chargers/{id}/update only returns an empty response (with a 200/401/403 response code). Not sure if this is due to a change in the API or if it's just a sleeper-bug that was introduced in custom-components#183 and never triggered because the validation code was not executed.
@sveinse
Copy link
Collaborator

sveinse commented Nov 4, 2025

LGTM

This is a dilemma. We need input validation so it doesn't crash deeper into the integration. However, it's a merry chase if Zaptec keep changing the data.

@sveinse
Copy link
Collaborator

sveinse commented Nov 4, 2025

Does the code handle getting empty responses to update?

@steinmn
Copy link
Contributor Author

steinmn commented Nov 4, 2025

Yeah, we don't use the return value for anything as far as I can tell (and it works just fine in 0.8.3).

I'm leaning more towards this being an artifact of switching from the old internal settings-api to the charger/update-api and not changing the validation model used. In my defense, that was my first commit here, so I didn't really know what I was doing yet 😛

@steinmn
Copy link
Contributor Author

steinmn commented Nov 4, 2025

(adding full test coverage of the api-functionality to my Christmas wish list)

@sveinse
Copy link
Collaborator

sveinse commented Nov 4, 2025

Can you update a new draft section in CHANGELOG.md for the upcoming 0.8.5, please? So we don't forget. I'm a bit on and off this project these weeks.

@steinmn
Copy link
Contributor Author

steinmn commented Nov 4, 2025

Included a reference to the HA Core 2025.11+-compatibility in the changelog entry, since we may need to push this out rather quickly. I think setting the min/max current values on the charger with 0.8.4 will work, it's only the return response that triggers an error (but I think that's bad enough).

@sveinse
Copy link
Collaborator

sveinse commented Nov 4, 2025

LGTM.

I'm happy to push a 0.8.5 tonight if you are up for prepping the release PR.

@sveinse sveinse merged commit d976f32 into custom-components:master Nov 4, 2025
6 checks passed
@sveinse sveinse added this to the v0.8.5 milestone Nov 4, 2025
@steinmn
Copy link
Contributor Author

steinmn commented Nov 4, 2025

I'm happy to push a 0.8.5 tonight if you are up for prepping the release PR.

#353

@steinmn steinmn deleted the fix-wrong-validation-model-for-charger-update branch November 4, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to validate chargers/xxxxxxx-bc0c-4a92-b0f0-xxxxxx/update

2 participants