Make Fronius inverter and controller IDs configurable#239
Conversation
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
|
@copilot please add a verification of the given ids against the urls (do a test call to the method) to the Fronius class. If there is an issue, please create some code, that outputs the complete json result of the corresponding call. |
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Added ID verification in commit 0716062. The
Tests added for both valid and invalid ID scenarios. |
There was a problem hiding this comment.
Pull request overview
This PR makes Fronius inverter and controller IDs configurable instead of hardcoded, addressing issue #238. The implementation includes configuration parameters with sensible defaults, ID verification during initialization, and comprehensive test coverage.
Key Changes:
- Added configurable
fronius_inverter_id(default: '1') andfronius_controller_id(default: '0') parameters - Implemented ID verification method that validates configured IDs against actual API responses
- Updated
get_SOC()andget_capacity()methods to use configurable IDs
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| config/batcontrol_config_dummy.yaml | Added optional configuration parameters for Fronius inverter_id and controller_id with defaults documented |
| src/batcontrol/inverter/fronius.py | Implemented configurable IDs with string conversion, added _verify_fronius_ids() validation method, updated ID usage in get_SOC() and get_capacity(), minor code formatting improvements |
| tests/batcontrol/inverter/test_fronius_ids.py | Comprehensive test suite covering default values, custom IDs, type conversion, ID verification in methods, and error handling for invalid IDs |
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.