Fix date timezone, improve error codes and docstrings#138
Open
johanzander wants to merge 1 commit intoindykoning:masterfrom
Open
Fix date timezone, improve error codes and docstrings#138johanzander wants to merge 1 commit intoindykoning:masterfrom
johanzander wants to merge 1 commit intoindykoning:masterfrom
Conversation
New: - Add GrowattV1ApiErrorCode IntEnum with generic API error codes, exported from the package so callers can use GrowattV1ApiErrorCode.NO_PRIVILEGE instead of hardcoding magic numbers Bug fixes: - Fix base_api.py: legacy TLX method incorrectly raised GrowattV1ApiError (a V1-specific exception); changed to GrowattError (base class) - Fix default date handling: use local system timezone instead of UTC so Growatt API receives the correct calendar date for the plant location - Fix GrowattV1ApiError.__init__: error_code and error_msg were typed as optional but all V1 raise sites always provide them; made required Docs: - Add endpoint-specific error codes to all API method docstrings - Add References sections with API doc URLs to all API methods - Standardise GrowattV1ApiError docstring to reference GrowattV1ApiErrorCode Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
indykoning
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug fixes:
base_api.py: legacy TLX method incorrectly raisedGrowattV1ApiError(a V1-specific exception); changed toGrowattError(base class)GrowattV1ApiError.__init__:error_codeanderror_msgwere typed as optional but all V1 raise sites always provide them; made requiredNew:
GrowattV1ApiErrorCodeIntEnum with generic API error codes, exported from the package so callers (e.g. HA coordinator) can useerr.error_code == GrowattV1ApiErrorCode.NO_PRIVILEGEinstead of hardcoding magic numbersDocs:
Referencessections with API doc URLs to all API methodsGrowattV1ApiErrordocstring to referenceGrowattV1ApiErrorCodeFormatting:
🤖 Generated with Claude Code