Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(solaredge): Add active battery control with power limit setting #2108

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Xerolux
Copy link
Contributor

@Xerolux Xerolux commented Dec 31, 2024

  • Neue Funktionalität:
    • set_power_limit: Ermöglicht die dynamische Steuerung des Entladelimits.
      • Standardwert 5000 W bei None (Null-Punkt-Ausregelung).
      • Validierung von Werten (nur 0-5000 W erlaubt).
      • Schreibvorgänge erfolgen nur, wenn das bestehende Limit abweicht.

- Neue Funktionalität:
  - `set_power_limit`: Ermöglicht die dynamische Steuerung des Entladelimits.
    - Standardwert 5000 W bei `None` (Null-Punkt-Ausregelung).
    - Validierung von Werten (nur 0-5000 W erlaubt).
    - Schreibvorgänge erfolgen nur, wenn das bestehende Limit abweicht.


**Hinweis:** Für die aktive Steuerung muss der Speicher auf **Control Mode 4 (Remote)** gesetzt werden (`StorageConf_CtrlMode (0xE004)`). 
Dies muss **extern** erfolgen und kann nicht von OpenWB automatisch übernommen werden.
Changes:
- Replaced all non-ASCII characters (e.g., "Umlauts") with UTF-8-safe alternatives to avoid encoding issues.
- Ensured all error and debug messages use encoding-safe text, replacing "Ungültige" with "Ungueltige".
- Added `blocked` mode to `set_power_limit` to set discharge limit to 0 W, allowing battery usage to be disabled (e.g., for fast charging without battery). <- not supported from OpenWB at moment
- Introduced robust handling for advanced power control activation:
  - Confirm activation using a commit register (57741).
  - Ensured redundant writes are avoided through checks.
- Improved validation logic for power limits with explicit error logging.
- Added detailed error messages for Modbus register read failures
- Optimized power limit setting to avoid unnecessary writes"
- Refactored float conversion function
- Ensured proper spacing after function definitions to comply with PEP8
- Ensured Modbus registers are only written when necessary to prevent EEPROM wear
- Implemented `ensure_remote_control_mode()` to verify and set remote control mode (57348) only once
- Improved error handling for `read_state()` to prevent crashes
- Standardized register access with proper checks before writing values
- Introduced helper function for payload builder to reduce redundancy
- Enhanced logging for better debugging and clarity
- Adjusted type hints in `set_power_limit()` to support future flexibility

Tested and verified correct behavior for setting power limits and enabling APC.
feat: Optimierung der Solaredge-Batteriesteuerung

- Kommentare für alle Funktionen hinzugefügt
- Code gemäß PEP8 formatiert (max. 100 Zeichen pro Zeile)
- Unnötige Schreibvorgänge reduziert, um Modbus-Kommunikation zu minimieren
- Verbesserte Fehlerbehandlung mit log.exception für besseren Debugging-Support
- Float-Wertevergleiche mit Toleranz für präzisere Limit-Checks optimiert
@cr0i
Copy link
Contributor

cr0i commented Feb 28, 2025

Ich habe hier noch ein bisschen die Nutzung der Profile der SE Monitorplattform getestet.
https://forum.openwb.de/viewtopic.php?p=124594#p124594
Vielleicht hilft das bei der Umsetzung?

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.

2 participants