Getting Started
Video instructions (Dutch spoken with English text and subs)
Step by step
- Connect batteries to Home Assistant
- The project assumes you have connected your batteries to Home Assistant
- Have a look at these modbus examples and ready to use configurations
- Connect grid power or P1 meter to Home Assistant
- The project assumes you have a grid power sensor available in Home Assistant
- A P1 USB-dongle, HomeWizzard P1 monitor, Shelly EM50, any will do.
- 1 Hz refresh preferred
- Marstek users: CT002 or CT003 is not a requirement. HBC functions just fine without them.
- Install Node-RED in Home Assistant
- Node-RED as a Home Assistant Add-on (popular)
- Follow the official guide: How to install Node-RED in Home Assistant
- Node-RED in a Docker container
- The default Node-RED Docker installation is missing several nodes required by this project. Install them via Node-RED’s Manage palette:
node-red-contrib-momentnode-red-contrib-time-range-switchnode-red-node-smooth
- For the Home Assistant WebSocket connection, you’ll need to manually configure:
- Home Assistant URL (e.g.,
http://homeassistant.local:8123or your specific IP address) - Access token (generate one in Home Assistant: Profile > Long-Lived Access Tokens)
- Update the connection settings in each Home Assistant server configuration node
- Home Assistant URL (e.g.,
- The default Node-RED Docker installation is missing several nodes required by this project. Install them via Node-RED’s Manage palette:
- Node-RED as a Home Assistant Add-on (popular)
- Clone this repository
git clone https://github.com/gitcodebob/marstek-venus-rs485-node-red.git - Home Assistant Add-ons
- Go to settings > Add-ons and confirm
File editororVisual Studio Serverare installed - Confirm
Node-REDis running - (Optional) install
B2500 Meterto enable theMarstek controloption.- This sends grid power usage via the ESPHome boards to Martek’s own control algorithms.
- (Optional) install Cheapest Hours to enable support for
Dynamiccontracts with hourly changing rates.
- Go to settings > Add-ons and confirm
- Configure Home Assistant
- Use the provided YAML files in the
home assistantfolder as follows.- Configuration files are organized using the package-based structure:
packages/house_battery_control.yamlcontains all input entities (booleans, datetimes, numbers, selects) and template sensors for battery control. This file is what you usually update.packages/house_battery_control_config.yamlcontains configuration-related entities specific for your install. Customize it. Don’t overwrite at each update.
- The main
configuration.yamlautomatically loads all package files from thepackages/directory- Tip: you can add your own package files to the
packages/folder as well. They will be loaded automatically.
- Tip: you can add your own package files to the
- This package-based structure provides better organization, easier maintenance, and improved configuration sharing.
- See instruction Good to know / Safety for safety tips.
- Configuration files are organized using the package-based structure:
- Use the provided YAML files in the
- Home Assistant DASHBOARD - continue installation with guidance
- In Home Assistant import
dashboard.yamlto create a dashboard. - Follow the additional guidance on this interactive dashboard.
- Set your desired number of batteries (the system can handle any number of batteries, but the dash is designed for max. 4)
- Set your P1 sensor (
/packages/house_battery_control_config.yaml)- Examples for 1 and 3 phase sensors are available.
- Examples of singular (+/-) and split (+production/+consumption) sensors are available.
- Uncomment and adapt what is relevant to your situation and place the template sensor name under
p1_meter_power
- Import NR flows, see instructions below.
- In Home Assistant import
- Import Node-RED Flows
- In Node-RED, go to the menu > Import > and select the following JSON file from the
node-redfolder:all-flows-in-one-file.json(imports all flows in 1 go, you are done)
If you require specific flows, the structure is as follows
- Import seperate flows:
00 master-switch-flow.json(enable/disable control)00 presets-switch-flow.json(pid control presets)01 start-flow.json(the main flow)
- Import charging strategies:
02 strategy-self-consumption.json(PID-based self-consumption strategy)02 strategy-timed.json(time-based charging/discharging strategy)02 strategy-charge.json(charge from grid strategy)02 strategy-sell.json(discharge to grid strategy)02 strategy-full-stop.json(full stop strategy)
- Optional: Explore additional examples in the
node-red/examples/directory for advanced strategy patterns - Deprecated flows are available in
node-red/deprecated/folder for reference - Deploy all flows. No edits required.
- In Node-RED, go to the menu > Import > and select the following JSON file from the
- Firing up
- Check the dashboard if all checks are green, if you have not done so already.
- Continue reading before switching the master battery mode to
Full Controlto activate.
Disclaimer
You are responsible for configuring and operating your system safely. Monitor carefully. Be prepared to switch off battery control or disengage the battery physically.
Good to know / Safety
- The P1 value is expected in Watt (w). If your meter supplies kW, multiply the P1 input * 1000
- Test your first time setup in 800W mode
- Manufacturers advise to consult a professional electrician when going above 800W.
- Set the appropriate Max. Charge and Max. Discharge values for each battery via the dashboard, by clicking on the glance charts on the dashboard.
- Don’t solely rely on Home Assistant / Node-RED to disengage the batteries when running into trouble during first flights. Staying near the physical battery controls or your circuit breakers is a good extra safety measure.
