Implement SHA256 authentication for Fronius firmware 1.38.6-1+#179
Implement SHA256 authentication for Fronius firmware 1.38.6-1+#179
Conversation
|
@MaStr 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
|
This fix needs some more changes. Old passwords needs to be hashed with MD5. On the same time the complete digest needs to be sha256 now. |
There was a problem hiding this comment.
Pull Request Overview
Implements version-dependent SHA256 authentication for Fronius firmware 1.38.6-1+ while maintaining backward compatibility with MD5 for older versions. The authentication method is automatically selected based on firmware version.
- Enhanced authentication system with algorithm parameter supporting both MD5 and SHA256
- Split API configuration to handle version-specific authentication requirements
- Added comprehensive test coverage for authentication boundary conditions
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/batcontrol/inverter/fronius.py | Core authentication implementation with enhanced hash function, API config updates, and multi-method login logic |
| tests/batcontrol/inverter/test_fronius_auth.py | Comprehensive test suite covering hash algorithms, version boundaries, and authentication behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fronius firmware version 1.38.6-1 changed the login encryption from MD5 to SHA256. This PR implements version-dependent authentication to support both old and new firmware versions.
Changes Made
Core Authentication Updates
hash_utf8()function: Added algorithm parameter supporting both "MD5" and "SHA256" with backward-compatible MD5 defaultget_auth_header()method: Now uses version-appropriate algorithm from API config and includes correct algorithm in digest auth headerFroniusApiConfigdataclass: Addedauth_algorithmfield with MD5 default for backward compatibilityVersion Configuration
Testing
Example Usage
The implementation maintains full backward compatibility while adding support for the new SHA256 authentication requirement in newer firmware versions.
Fixes #178.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.