evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Native integration for Marstek Venus E/C battery storage

Open coltmans opened this issue 8 months ago • 19 comments

Summary

I'd like to propose a native integration for Marstek Venus E and C battery storage systems.

Marstek recently released a local API (Rev 2.0) for their Venus series batteries. I've been working on integrating my two Venus E V2 units with evcc and wanted to share what I found and propose contributing a proper built-in integration.

About the device

  • Marstek Venus E/C — home battery storage, 5.12 kWh per unit, stackable
  • Local API over UDP JSON-RPC on the LAN (no cloud required once enabled)
  • API is enabled via the Marstek app, configurable port (default 30000)
  • Supports reading SOC, power, energy totals, and setting operating modes (auto/passive/manual/UPS)
  • Official API docs: https://static-eu.marstekcloud.com/ems/resource/agreement/MarstekDeviceOpenApi.pdf

Current workaround

I've built a small HTTP proxy that bridges the UDP API to evcc's custom plugin system: https://github.com/coltmans/marstek-venus-evcc

It works, but requiring users to run a separate proxy isn't ideal. A native Go integration would be much cleaner.

What a native integration would need

The UDP protocol is straightforward JSON-RPC — one request, one response. The main methods needed:

  • ES.GetStatus — battery SOC, power, grid power, energy totals
  • ES.SetMode — set auto / passive mode (passive mode accepts a power setpoint for charge/discharge control)

One thing worth noting: bat_power in ES.GetStatus appears to report incorrect values on at least some firmware versions (reporting ~22000W instead of ~2300W). The workaround is falling back to -ongrid_power which is reliable.

Interfaces to implement

  • api.Meter (CurrentPower)
  • api.Battery (Soc)
  • api.BatteryCapacity (Capacity)
  • api.BatteryController (SetBatteryMode) — via passive mode

Questions before starting a PR

  1. Is there interest in this integration?
  2. Any preference on how to handle the UDP discovery vs. direct IP configuration?
  3. Should the ongrid_power fallback for bad bat_power readings be handled in the integration, or left to the user to work around?

Happy to put together a PR if there's interest.

coltmans avatar Mar 11 '26 13:03 coltmans

Is there interest in this integration?

Not sure. What's the case given we already have Modbus?

how to handle the UDP discovery

What UDP discovery?

andig avatar Mar 11 '26 16:03 andig

I'm looking to integrate two Marstek Venus to my System. That would be nice to see your features in evcc

detlefheese avatar Mar 12 '26 13:03 detlefheese

@detlefheese pls look into the documentation

andig avatar Mar 12 '26 13:03 andig

Is there interest in this integration?

Not sure. What's the case given we already have Modbus?

The Venus E V2 needs extra hardware, it doesn't have Modbus TCP support like V3 (correct me if I'm wrong)

how to handle the UDP discovery

What UDP discovery?

I wasn't able to connect my batteries via UDP discovery, I had to address them directly in my config.

coltmans avatar Mar 12 '26 20:03 coltmans

I need to step back, after two days I'm recognizing connection issues between the marstek energy meter and the V2 batteries with this setup.

coltmans avatar Mar 13 '26 20:03 coltmans

@coltmans Could you elaborate? I was having the same idea to try and use the (quite) new local API on the Venus v2, as I currently need a micro controller in between to convert the RS485 modbus to TCP. What were the exact connection issues that made you step back?

pvrobays avatar Mar 17 '26 08:03 pvrobays

@pvrobays i had to set static ips for the batteries and the marstek energy meter (CT003 in my case) to reach them via the script, since the UDP discovery didn't work at all. This was working fine for like 2 days, then I saw that the batteries did not decharge anymore. Reason was that the batteries lost the connection to the energy meter (Green CT in the lower left corner of the app). I had to revert my network changes to get it working again

coltmans avatar Mar 17 '26 09:03 coltmans

I'm interested in this too. I also have V1 and V2 models , they don't have native Modbus support without extra hardware. So using their official API would be awesome... Any reason why this is closed? Would be great to use it... Also for V3 models, cause they only support Modbus TCP direct , but ONLY when using LAN

pergolafabio avatar Apr 08 '26 19:04 pergolafabio

@pvrobays i had to set static ips for the batteries and the marstek energy meter (CT003 in my case) to reach them via the script, since the UDP discovery didn't work at all. This was working fine for like 2 days, then I saw that the batteries did not decharge anymore. Reason was that the batteries lost the connection to the energy meter (Green CT in the lower left corner of the app). I had to revert my network changes to get it working again

Regarding the CT loss. Yes that's a known issue and marstek is aware , they confirmed the issue and will be resolved on newer firmware, for now if you want to use / test, there is an CT 003 emulator. So no need to use the hardware anymore

pergolafabio avatar Apr 08 '26 19:04 pergolafabio

I played with the Marstek Venus E Gen3 integration. Lessons learned :

  • modbus only seems to work via ethernet connection, not wifi
  • modbus is very unstable , works very seldom
  • the UDP API is more stable , but shows also some instabilities, and i regularly need to start the discovery via an UDP broadcast. I have integrated this into Home assistant via MQTT , I have or better Copilot has written a Rust bridge to collect the data and present this in HA MQTT discoverable mode. https://github.com/vortex314/marstek_ha
Image

Looking now at presenting the battery via the existing MQTT also to evcc.

Image

Maybe this should also be the integration into EVCC via the UDP API ?

vortex314 avatar Jun 14 '26 20:06 vortex314

Is the API still under development? Would be nice to see API support for marstek devices, so we don't need to use Modbus or extra hardware to support modbus

pergolafabio avatar Jun 22 '26 16:06 pergolafabio

Is the API still under development? Would be nice to see API support for marstek devices, so we don't need to use Modbus or extra hardware to support modbus

Hey, not anymore, since I was having the issues with the connection, and I'm having only gen2 batteries. But feel free to fork the repo.

coltmans avatar Jun 22 '26 19:06 coltmans

Yeah. But not a developer :-) I was having also issue with connection. But it's an issue with the CT003 meter, I now use the Astrameter , and connection is stable

pergolafabio avatar Jun 22 '26 19:06 pergolafabio

I have two Marstek Venus E v3 batteries, could do some testing with the local API, if need be.

I do have the marstek-local-api HA integration running as well, and have noticed some flapping of both batteries. Possibly because both Wifi and ethernet were connected at the same time. I have deconfigured the wifi settings and am now on ethernet only, so will see if this re-occurs.

Varashi avatar Jun 24 '26 12:06 Varashi

i would love to see this PR open again, can you do finish it @coltmans ?

pergolafabio avatar Jun 24 '26 13:06 pergolafabio

Hey @coltmans , with the astrameter (ct003 emulator) there is no loss anymore, would love to see this implemented, so no MQTT workaround is needed anymore...

Or anyone else?

pergolafabio avatar Oct 30 '26 06:10 pergolafabio

Hi @pergolafabio I'll have a look on it again on the weekend. I switched to homeassistant lately at home, now I'm more willing again to give it a try

coltmans avatar Nov 05 '26 20:11 coltmans

Any update @coltmans ! :-)

pergolafabio avatar Nov 13 '26 11:11 pergolafabio

Any update @coltmans ! :-)

Sorry, of course not. Life had other plans. Since we have quite a lot of sun at the moment, I'm ok with the actual setup. I guess this changes the next few weeks. I have it on my Todo list

coltmans avatar Nov 13 '26 12:11 coltmans