Skip to content

Victron bat control mode 1 - #3850

Open
ndrsnhs wants to merge 5 commits into
openWB:masterfrom
ndrsnhs:victron-bat-control-mode
Open

Victron bat control mode 1#3850
ndrsnhs wants to merge 5 commits into
openWB:masterfrom
ndrsnhs:victron-bat-control-mode

Conversation

@ndrsnhs

@ndrsnhs ndrsnhs commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Victron erwartet in allen Modi die Übergabe des Grid Setpoints.
In dieser Implementierung wird dafür Mode 1 genutzt.
Mode 2 deaktiviert die Phasensaldierung und ist daher nicht nutzbar.
Mode 3 setzt die Register entgegen der Dokumentation nach 10-14 Sekunden zurück

Die für die Berechnung nötigen zusätzlichen Daten werden als dataclass übergeben. Die Entscheidung welche Werte und wie diese genutzt werden/ die Berechnung verbleibt damit in der Komponente.

Für die Entladesperre wird weiterhin Mode 2 genutzt. Bei kompletter Sperre des Speichers spielt die fehlende Saldierung keine Rolle. Die Register haben eine längere Lebensdauer als in Mode 3

@ndrsnhs
ndrsnhs marked this pull request as ready for review August 25, 2026 07:54
@ndrsnhs
ndrsnhs requested a review from LKuemmel August 25, 2026 07:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The dispatch can pass SetPoint objects to unupdated battery implementations, and Victron’s unconditional register read can interrupt control writes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Extends battery control with EVU power data and Victron ESS Mode 1 grid-setpoint handling.

Changes:

  • Adds and propagates the SetPoint dataclass.
  • Migrates battery adapters and MQTT/configuration handling.
  • Updates Victron charge/discharge control.
File summaries
File Summary
packages/modules/devices/victron/victron/bat.py Implements Victron Mode 1 grid-setpoint control.
packages/modules/devices/varta/varta/bat_modbus.py Migrates battery control input.
packages/modules/devices/sungrow/sungrow_sh/bat.py Migrates battery control input.
packages/modules/devices/sungrow/sungrow_ihm/bat.py Migrates battery control input.
packages/modules/devices/sonnen/sonnenbatterie/bat.py Migrates battery control input.
packages/modules/devices/solis/solis/bat.py Migrates battery control input.
packages/modules/devices/solax/solax/bat.py Migrates battery control input.
packages/modules/devices/solaredge/solaredge/bat.py Migrates battery control input.
packages/modules/devices/sma/sma_sunny_island/bat.py Migrates battery control input.
packages/modules/devices/sma/sma_sunny_boy/bat.py Migrates battery control input.
packages/modules/devices/sigenergy/sigenergy/bat.py Migrates battery control input.
packages/modules/devices/qcells/qcells/bat.py Migrates battery control input.
packages/modules/devices/marstek/venus_c_e/bat.py Migrates battery control input.
packages/modules/devices/kostal/kostal_plenticore/bat.py Migrates battery control input.
packages/modules/devices/good_we/good_we/bat.py Migrates battery control input.
packages/modules/devices/generic/mqtt/bat.py Migrates MQTT battery control input.
packages/modules/devices/batterx/batterx/bat.py Migrates battery control input.
packages/modules/devices/anker/solarbank/bat.py Migrates battery control input.
packages/modules/devices/alpha_ess/alpha_ess/bat.py Migrates battery control input.
packages/modules/common/configurable_device.py Passes setpoint data through the fault wrapper.
packages/helpermodules/update_config.py Registers the EVU power topic.
packages/helpermodules/setdata.py Validates EVU power input.
packages/helpermodules/mosquitto_dynsec/missing_role_topics_test.py Updates internal topic permissions tests.
packages/control/process.py Passes complete battery setpoints to devices.
packages/control/bat.py Adds the EVU power setpoint field.
packages/control/bat_all.py Populates EVU power for battery control.
Review details

Suppressed comments (1)

packages/modules/devices/victron/victron/bat.py:64

  • This read is performed even for None and 0 setpoints, although bat_power is only used in the charge/discharge branches. Besides adding a Modbus request every control cycle, a read failure can prevent the following self-regulation/stop writes and leave the previous Victron mode active. Read register 842 only when calculating an active grid setpoint (or use the cached value for that calculation).
        bat_power = self.__tcp_client.read_holding_registers(842, ModbusDataType.INT_16, unit=modbus_id)
  • Files reviewed: 26/26 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

target=set_power_limit_wrapper,
args=(bat_component,
data.data.bat_data[f"bat{bat_component.component_config.id}"].data.set.power_limit),
data.data.bat_data[f"bat{bat_component.component_config.id}"].data.set),
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