Native integration for Marstek Venus E/C battery storage
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 totalsES.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
- Is there interest in this integration?
- Any preference on how to handle the UDP discovery vs. direct IP configuration?
- Should the
ongrid_powerfallback for badbat_powerreadings be handled in the integration, or left to the user to work around?
Happy to put together a PR if there's interest.
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?
I'm looking to integrate two Marstek Venus to my System. That would be nice to see your features in evcc
@detlefheese pls look into the documentation
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.
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 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 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
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
@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
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
Looking now at presenting the battery via the existing MQTT also to evcc.
Maybe this should also be the integration into EVCC via the UDP API ?
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
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.
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
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.
i would love to see this PR open again, can you do finish it @coltmans ?
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?
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
Any update @coltmans ! :-)
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