Skip to the content.

Getting Started

Home Battery via Home Assistant

Video instructions (Dutch spoken with English text and subs)

Step by step

  1. Connect batteries to Home Assistant
  2. Install Node-RED in Home Assistant
    • Node-RED as a Home Assistant Add-on (popular)
    • 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-moment
        • node-red-contrib-time-range-switch
        • node-red-node-smooth
      • For the Home Assistant WebSocket connection, you’ll need to manually configure:
        • Home Assistant URL (e.g., http://homeassistant.local:8123 or 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
  3. Clone this repository
    git clone https://github.com/gitcodebob/marstek-venus-rs485-node-red.git
    
  4. Home Assistant Add-ons
    • Go to settings > Add-ons and confirm File editor or Visual Studio Server are installed
    • Confirm Node-RED is running
    • (Optional) install B2500 Meter to enable the Marstek control option.
      • This sends grid power usage via the ESPHome boards to Martek’s own control algorithms.
    • (Optional) install Cheapest Hours to enable support for Dynamic contracts with hourly changing rates.
  5. Configure Home Assistant
    • Use the provided YAML files in the home assistant folder as follows.
      • Configuration files are organized using the package-based structure:
        • packages/house_battery_control.yaml contains 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.yaml contains configuration-related entities specific for your install. Customize it. Don’t overwrite at each update.
      • The main configuration.yaml automatically loads all package files from the packages/ directory
        • Tip: you can add your own package files to the packages/ folder as well. They will be loaded automatically.
        • Tip: the house_battery_control.yaml includes recorder: configuration to reduce logbook clutter by excluding high-frequency technical entities (PID control signals, calculated averages) while preserving user-relevant changes (Master Switch, Strategy selection, configuration changes). History graphs and statistics remain fully functional.
      • This package-based structure provides better organization, easier maintenance, and improved configuration sharing.
      • See instruction Good to know / Safety for safety tips.
  6. Home Assistant DASHBOARD - continue installation with guidance
    • In Home Assistant import dashboard.yaml to create a dashboard.
    • Follow the additional guidance on this interactive dashboard.
      1. Set your desired number of batteries (the system can handle any number of batteries, but the dash is designed for max. 4)
      2. Set your P1 sensor (/packages/house_battery_control_config.yaml)
      3. Import NR flows, see instructions below.
  7. Import Node-RED Flows
    • In Node-RED, go to the menu > Import > and select the relevant JSON files from the node-red folder:
      • 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 (simple charge 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.
  8. 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 Control to 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

← Back to Home