[Custom Integration] Marstek Venus Energy Manager

Project Name: Marstek Venus Energy Manager
GitHub: ffunes/Marstek-Venus-Energy-Manager: A Marstek Venus Integration for Home Assistant

Hi everyone! :waving_hand:

I’ve built a custom integration for Marstek Venus E series batteries (v2 supported, v3 experimental).

While there are other integrations, I wanted smarter control—specifically, the ability to dynamically charge from the grid overnight only when tomorrow’s solar won’t be enough and other fuctionalities.

:battery: Key Features

1. :high_voltage: Dynamic PD Controller (Zero Export/Import)
A built-in PID controller continuously adjusts the battery’s charge/discharge rate to keep your grid meter close to 0W, reacting to load spikes (like coffee machines) with no oscillation.

2. :brain: Predictive Grid Charging
This feature:

  • Calculates your current usable capacity.
  • Checks tomorrow’s Solar Forecast (works with Solcast, Forecast.Solar, etc.).
  • Predicts your Home Consumption (using a rolling 7-day average of the energy your battery has discharged).
  • The Logic: If (Battery + Solar) < Consumption, it charges from the grid during your cheap off-peak window to cover the deficit. Result: You start the day with enough energy, leaving room for solar and saving money on unnecessary grid imports.

3. :shield: Other functionalities

  • No-Discharge Times: You can configure up to 4 time slots where the batteries won’t discharge.
  • Weekly Full Charge: Automatically force a 100% charge once a week for cell balancing.
  • Load Exclusion: “Hide” heavy loads (like EV chargers) so they don’t drain your house battery in 30 minutes.

:hammer_and_wrench: Installation

  1. Add https://github.com/ffunes/Marstek-Venus-Energy-Manager as a Custom Repository in HACS.
  2. Search for “Marstek Venus Energy Manager” and install.

:test_tube: Looking for Testers!

I’m running this on my V2 batteries, but I’d love feedback from V3 owners or anyone with a similar setup.

Note: I am new to GitHub and git versioning, so please be patient if I mess up a commit or release! :sweat_smile: Learning as I go.

Let me know what you think or if you have any feature requests!

ffunes/Marstek-Venus-Energy-Manager: A Marstek Venus Integration for Home Assistant

2 Likes

Hi,
I did the same some months ago.
I’ve allready built in some features for multiple batteries, wallbox etc.
Check it out: GitHub - diegoschlauri/marstek_venus_ha: Home Assistant - Intelligente Batteriesteuerung für Marstek Venus E

1 Like

New version 1.3.0 released. From the initial version to this release a few new interesting functionalities have been added like the following:

:electric_plug: Hardware & Configuration

  • New Battery Models: Full support added for Venus A (1200W) and Venus D (2200W) models, including dedicated MPPT power sensors for solar monitoring.

:sun: Smart Solar Optimization

  • Weekly Full Charge Delay: A sophisticated “Solar-Aware” feature that prevents the system from charging to 100% using grid power at night. Instead, it analyzes solar forecasts and household consumption to delay the full charge until it can be completed using surplus solar energy.
  • Solar Surplus Mode: A new setting for “excluded devices” (like EV chargers). It allows these devices to use excess solar energy when the battery is charging but prevents the battery from discharging to power them.

:battery: Efficiency & Battery Management

  • Intelligent Load Sharing: For multi-battery setups, the system now activates only the number of batteries needed to stay within the optimal efficiency zone (60% capacity threshold). It prioritizes discharging the fullest battery and charging the emptiest one to balance wear.

https://github.com/ffunes/Marstek-Venus-Energy-Manager

1 Like

Hi, i’m trying out your integration (besides many others) and found that load control is oszillating massivly using default installation options. So some questions.
Does the consumption sensor uses negativ values for surplus (power to grid)?
My sensor source has an update interval of 5 seconds, i think a higher interval is not feasible.
Any hints how to tune the pid controller.

Hi,

Yes, negative values for surplus.
The polling rate of the integration is 2.5 secs, 5 seconds is a bit slow in my opinion, I am using a 1 sec polling rate sensor (Shelly Pro 3EM) and I don’t have any issues with oscilations. You can fine tune a few parameters:

  • Kp (Proportional Gain): Controls how aggressively the battery responds to grid imbalance. Higher values = faster response but potential for overshoot.
  • Kd (Derivative Gain): Provides damping to prevent oscillations. Higher values = smoother transitions but slower settling time.
  • Deadband: The “ignore” zone around the target grid power (Watts). The battery won’t adjust if grid power is within this range of the target, preventing constant micro-adjustments.
  • Max Power Change: The maximum allowable change in battery power output per control cycle (Watts). Prevents sudden large power swings that could stress the inverter.
  • Direction Hysteresis: The power threshold (Watts) required to switch between charging and discharging. Prevents rapid flipping between modes when consumption is hovering around zero.

Try the following:

Kp: 0.3
Kd: 0.9
Deadband: 80-120W
Max Power Change: 400W
Direction Hysteresis: 150W.

Please try that, and let me know.
Since your meter is slower than the polling rate of the integration, I will implement an improvement to check if last measurement is the same as the previous one, so it skips that cycle.

Hi again,

Yesterday I released a new version with improvements for slow meters. Please test it and let me know if it solves the issue for you.

Best regards

First, thank you for the contribution. I am using yours after some unlucky attempts with others since a while. Could you integrate the individual cell voltage readouts for an (occasional) health check? I understand this should not be part of the standard polls as it increases traffic on the Modbus, but it could be on demand or triggered by a certain state (idle or 100% and idle for a while).

Hi!

Thanks for your words and request. I missed this message since I am not receiving notifications in my email from this post, would you mind opening a feature request in github? Looks like a really good idea, on demand polling of certain modbus registers, really looks like a nice feature to have.

Here’s a summary of everything new added to the integration recently:

  • Venus A & D battery support — new battery models for hybrid inverter setups with MPPT power sensors
  • Support for up to 6 batteries — previously capped at 4
  • Battery load sharing — intelligent battery selection to keep each unit in its optimal efficiency zone
  • Capacity Protection (Peak Shaving) — conserves battery energy when SOC drops below a threshold, only offsetting consumption above a configurable peak limit
  • Solar-Aware Charge Delay — holds back daily charging until solar forecast is insufficient to cover consumption
  • Dynamic Pricing Mode — automatically selects the cheapest hours of the day to grid-charge, supporting Nordpool, PVPC, and CKW
  • Real-Time Price Mode — activates/deactivates grid charging instantly based on the live electricity price
  • Price-based discharge control — restricts battery discharge to periods when the current price exceeds a configurable threshold
  • Mid-day re-evaluation for dynamic pricing — re-checks whether charging is still needed 1 hour before each selected slot
  • Non-responsive battery detection — automatically excludes batteries that aren’t delivering power and retries after cooldown
  • Proactive battery alarm notifications (v2) — persistent HA notifications triggered the moment a new alarm or fault bit is set, auto-dismissed on clear
  • System Alarm Status sensor (v2) — system-level sensor aggregating alarm state across all batteries (OK / Warning / Fault)
  • Backup function exclusion from PD control — batteries actively providing offgrid power are automatically excluded from write commands
  • Solar Surplus switch per excluded device — runtime toggle to allow/block solar surplus to each excluded device (e.g. EV charger) without entering the options flow
  • Grid meter kW auto-detection & inverted sign support — auto-converts kW sensors and supports reversed sign conventions
  • Device info & connectivity sensors — firmware versions, MAC address, WiFi/Cloud status for all battery versions
  • Battery Cycle Count sensors — direct register-based (v3/vA/vD) and calculated estimate (all versions)
  • Configuration Summary diagnostic sensor — exposes full integration config as entity attributes for support purposes
  • Runtime control entities — PD parameters, SOC thresholds, power limits, time slot switches, and charge delay margin all editable from the HA UI without re-running the config wizard
  • Entity translations — all system-level entity names and states translated into EN, ES, DE, FR, NL
2 Likes

I just want to report that I have installed this integration using three Marstek Venus E 3.0 batteries. I’m currently using the Home Wizard P1 meter to measure the power consumption.
Until now (after 6 hours) it seems to be working okay.

1 Like

sounds great!

would this work with a Venus A 2120 Wh and in case of grid outage switch to UPS mode, automatically?

Hello,

Venus A is supported; however, automatic switchover to off-grid mode (for specific loads or full house backup) is not supported and will not be available in the future. This mode requires specific hardware components to detect grid outages and additional safety measures to operate securely.

Best regards

Awesome integration! Just switched over, currently running fine. Feels very polished already! Management seems to work fine. Made a few automation to switch into manual mode, to switch to forced charging. Works great!

Strategy etc will see, that aspect is a little opaque as you cannot see what the strategy is: e.g. where to solar charge, where to charge during cheap hours.

Thank you!

Hi!

Thanks a lot for your words.

What do you mean by strategy?

Best regards

The choices the integration makes when to solar charge delay, or the grid charging. I just noticed that it models this on remaining_solar_production. In the netherlands for example the optimal window to charge would be the peak solar hours as the expected return (near 0 cents) is low. Return later in the evening may be significantly higher (e.g 15c / kwh).

doh! i just noticed the solar forecast sensor! :sunny:

1 Like

Oh, Now I see…

Oh thanks for clarifying.

There are attributes in almost every sensor located in the diagnostic section of marstek venus system, if you click on the sensor, then the three dots, then details, you end up in a page like this:

1 Like

Hi, thanks for the good work. I will receive my new Marstek Venus A this week. I already own a Venus E V2. Working via modbus in HA perfectly.

Is it possible with this integration to let them work together?
:crossed_fingers:t2::crossed_fingers:t2:
Thanks in advance.

Hi,

It should be possible, if there is a compatibility issue, we can always troubleshoot it, and adapt the integration without any problem. But on paper, it should work.

1 Like

Amazing work, i tried a bunch of integrations but no one worked as well and reliably as yours. My deepest thanks ! You made these batteries work reliably in HA.

I have a couple minor suggestions:

  • allow lower caps for energy shaving, to be able to use the batteries only when really low (eg: 25%) .
  • add some damping or minimum charge for the night charge, i found that the solar forecast is not always precise and batteries might find themselves too low in the morning.

Basically between peak shaving and minimum charge it would work as a sort of “winter mode” where the battery is charged by the grid and used only to keep the peaks under control to avoid network fees (it’s an issue in Flanders).

Hi,

Thanks a lot for your words. It means a lot :slight_smile:

Regarding the suggestions,

First one is easy, I will provide that in the next release.

Second one, would you mind providing more details? I guess you are referring to predictive grid charging, but I am not sure what is the intended solution. Do you mean that you could add a security margin to the calculations to “force” trigger the grid charging if there won’t be too much PV production during the day?

By the way, I don’t know which solar forecast integration you are using, but Solcast works really good for me, you can add dampening to the prediction based on your actual production, for me, it is off by just 1 or 2 kwh.