A comprehensive Home Assistant custom integration for the Marstek Venus E battery energy storage system. This integration provides full local control and monitoring via the device's UDP JSON-RPC API.
β Automatic Device Discovery
- UDP broadcast discovery on local network
- Automatic device detection during setup
- Manual IP entry fallback option
β Complete Monitoring
- Battery status (SOC, temperature, capacity, charge/discharge state)
- Solar PV generation (power, voltage, current)
- Grid power flow (import/export)
- Energy totals (PV, grid, load)
- CT clamp readings (3-phase power monitoring)
- WiFi signal strength
β Full Control
- UI Mode Selector: Change modes directly from Home Assistant UI
- UI Schedule Configuration: Set up charging/discharging schedules through UI (no YAML needed)
- Operating Modes: Auto (Self-Consuming), AI, Manual, Passive
- Real-time mode changes
- Up to 10 time-based schedules (slots 0-9)
- Automation Support: Configure all 10 schedules via Home Assistant automations
β Home Assistant Integration
- Native Energy Dashboard support
- Service calls for automation
- Select entity for easy mode switching
- Options flow for schedule configuration
- 5-minute polling interval (configurable via options)
- Non-blocking async implementation
- Comprehensive device information
- Multi-language support (English, French)
- Open HACS in Home Assistant
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository URL:
https://github.com/YOUR-USERNAME/marstek-venus-e - Category:
Integration - Click "Add"
- Find "Marstek Venus E" in HACS and click "Download"
- Restart Home Assistant
- Copy the
custom_components/marstek_venus_efolder to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
- Go to Settings β Devices & Services
- Click + Add Integration
- Search for "Marstek Venus E"
- Automatic Discovery:
- The integration scans your network for Marstek devices
- Found devices are displayed in a list
- Select your device and click Submit
- Manual Configuration (if no devices found):
- Select "Enter IP manually"
- Enter device IP address, port (30000), and optional BLE MAC
- Click Submit
After adding the integration, you can configure charging/discharging schedules in two ways:
- Go to Settings β Devices & Services
- Find Marstek Venus E integration
- Click Configure (gear icon)
- Select "Configure Manual Mode Schedule"
- Set up your schedule:
- Time Slot: Choose 0-9 (you can create 10 different schedules)
- Start/End Time: When the schedule runs
- Active Days: Select days of the week
- Power: Negative to charge (-1000W), positive to discharge (+1000W)
- Enable: Toggle to activate
- Click Submit
Configure all 10 schedule slots automatically when you switch to Manual mode using Home Assistant automations. This is the easiest way to set up complex schedules!
Quick Start:
- Copy the example automation from
example_automation.yamlin this repository - Paste it into your Home Assistant automations
- Adjust times, power levels, and days to match your needs
- Save and test by switching to Manual mode!
Benefits:
- Configure all 10 slots in one action
- Different schedules for weekdays vs weekends
- Dynamic schedules based on battery level, weather, or electricity prices
- Seasonal adjustments (winter vs summer patterns)
See the Manual Mode Automation Guide for detailed examples and best practices.
sensor.marstek_venus_e_battery_state_of_charge- Battery SOC (%)sensor.marstek_venus_e_battery_temperature- Battery temperature (Β°C)sensor.marstek_venus_e_battery_capacity- Current battery capacity (Wh)sensor.marstek_venus_e_battery_rated_capacity- Rated battery capacity (Wh)sensor.marstek_venus_e_battery_power- Battery charging/discharging power (W)
sensor.marstek_venus_e_pv_power- Solar generation power (W)sensor.marstek_venus_e_pv_voltage- PV voltage (V)sensor.marstek_venus_e_pv_current- PV current (A)
sensor.marstek_venus_e_grid_power- Grid import/export power (W)sensor.marstek_venus_e_offgrid_power- Off-grid power (W)sensor.marstek_venus_e_total_pv_energy- Total PV energy generated (kWh)sensor.marstek_venus_e_total_grid_export_energy- Total energy exported to grid (kWh)sensor.marstek_venus_e_total_grid_import_energy- Total energy imported from grid (kWh)sensor.marstek_venus_e_total_load_energy- Total load consumption (kWh)
sensor.marstek_venus_e_phase_a_power- Phase A power (W)sensor.marstek_venus_e_phase_b_power- Phase B power (W)sensor.marstek_venus_e_phase_c_power- Phase C power (W)sensor.marstek_venus_e_total_ct_power- Total CT power (W)
sensor.marstek_venus_e_wifi_signal_strength- WiFi RSSI (dBm)sensor.marstek_venus_e_wifi_ssid- Connected WiFi networksensor.marstek_venus_e_operating_mode- Current operating mode
binary_sensor.marstek_venus_e_battery_charging- Battery charging statusbinary_sensor.marstek_venus_e_battery_discharging- Battery discharging statusbinary_sensor.marstek_venus_e_ct_meter_connected- CT meter connection status
select.operating_mode- Change operating mode (Auto, AI, Manual, Passive)- Auto: Self-consumption optimization
- AI: Intelligent mode based on usage patterns
- Manual: Time-based schedules (configure via integration options)
- Passive: Fixed power target mode
Set the operating mode of your system.
Modes:
Auto- Automatic operation based on device algorithmsAI- AI-optimized operationManual- Time-based schedule controlPassive- Follow a specific power target
service: marstek_venus_e.set_mode
data:
mode: "Auto"Configure a manual charging/discharging schedule.
service: marstek_venus_e.set_manual_schedule
data:
time_num: 0 # Time slot 0-9 (10 slots available!)
start_time: "09:00"
end_time: "17:00" # MUST be greater than start_time
week_set: 127 # All days (byte-based: 1=Mon, 2=Tue, 4=Wed, 8=Thu, 16=Fri, 32=Sat, 64=Sun)
mode: "Charging" # "Charging" or "Discharging"
power: 500 # 100-800W magnitude (always positive)
enable: trueImportant Constraints:
end_timemust be greater thanstart_timemodemust be "Charging" (negative power) or "Discharging" (positive power)powermagnitude must be between 100 and 800 watts (always positive)week_setuses byte-based bitmask
Week Set Bitmask:
- Monday: 1
- Tuesday: 2
- Wednesday: 4
- Thursday: 8
- Friday: 16
- Saturday: 32
- Sunday: 64
- All days: 127 (sum of all)
- Weekdays only: 31
- Weekend only: 96
Set passive mode with a power target.
service: marstek_venus_e.set_passive_mode
data:
power: 2000 # Target power in watts
cd_time: 3600 # Countdown in seconds (0 = indefinite)type: vertical-stack
cards:
- type: gauge
entity: sensor.marstek_venus_e_battery_state_of_charge
name: Battery Level
min: 0
max: 100
needle: true
severity:
green: 60
yellow: 30
red: 0
- type: entities
entities:
- entity: sensor.marstek_venus_e_battery_power
name: Battery Power
- entity: sensor.marstek_venus_e_battery_temperature
name: Temperature
- entity: binary_sensor.marstek_venus_e_battery_charging
name: Charging
- entity: binary_sensor.marstek_venus_e_battery_discharging
name: Discharging
- entity: sensor.marstek_venus_e_battery_capacity
name: Current Capacitytype: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: statistic
entity: sensor.marstek_venus_e_pv_power
name: Solar
icon: mdi:solar-power
stat_type: mean
period:
calendar:
period: day
- type: statistic
entity: sensor.marstek_venus_e_grid_power
name: Grid
icon: mdi:transmission-tower
stat_type: mean
period:
calendar:
period: day
- type: statistic
entity: sensor.marstek_venus_e_battery_power
name: Battery
icon: mdi:battery
stat_type: mean
period:
calendar:
period: day
- type: entities
title: Energy Today
entities:
- entity: sensor.marstek_venus_e_total_pv_energy
name: PV Generated
- entity: sensor.marstek_venus_e_total_grid_import_energy
name: Grid Import
- entity: sensor.marstek_venus_e_total_grid_export_energy
name: Grid Export
- entity: sensor.marstek_venus_e_total_load_energy
name: Total Consumptiontitle: Marstek Venus E
type: vertical-stack
cards:
# Header with mode
- type: entities
entities:
- entity: sensor.marstek_venus_e_operating_mode
name: Operating Mode
# Battery gauge
- type: gauge
entity: sensor.marstek_venus_e_battery_state_of_charge
name: Battery
min: 0
max: 100
needle: true
severity:
green: 60
yellow: 30
red: 0
# Power flow
- type: horizontal-stack
cards:
- type: entity
entity: sensor.marstek_venus_e_pv_power
name: Solar
icon: mdi:solar-power
- type: entity
entity: sensor.marstek_venus_e_grid_power
name: Grid
icon: mdi:transmission-tower
- type: entity
entity: sensor.marstek_venus_e_battery_power
name: Battery
icon: mdi:battery
# Energy totals
- type: entities
title: Energy
entities:
- sensor.marstek_venus_e_total_pv_energy
- sensor.marstek_venus_e_total_grid_import_energy
- sensor.marstek_venus_e_total_grid_export_energy
- sensor.marstek_venus_e_total_load_energy
# Mode control buttons
- type: horizontal-stack
cards:
- type: button
name: Auto
icon: mdi:autorenew
tap_action:
action: call-service
service: marstek_venus_e.set_mode
data:
mode: "Auto"
- type: button
name: AI
icon: mdi:brain
tap_action:
action: call-service
service: marstek_venus_e.set_mode
data:
mode: "AI"
- type: button
name: Manual
icon: mdi:clock-outline
tap_action:
action: call-service
service: marstek_venus_e.set_mode
data:
mode: "Manual"Add your Marstek Venus E to Home Assistant's Energy Dashboard:
- Go to Settings β Dashboards β Energy
- Click Add Consumption:
- Select
sensor.marstek_venus_e_total_load_energy
- Select
- Click Add Solar Production:
- Select
sensor.marstek_venus_e_total_pv_energy
- Select
- Click Add Battery:
- Energy in:
sensor.marstek_venus_e_total_grid_import_energy - Energy out:
sensor.marstek_venus_e_total_grid_export_energy
- Energy in:
- Click Add Grid Consumption:
- Grid import:
sensor.marstek_venus_e_total_grid_import_energy
- Grid import:
- Click Add Return to Grid:
- Grid export:
sensor.marstek_venus_e_total_grid_export_energy
- Grid export:
The best way to use Manual mode is to automatically configure all 10 schedule slots when you switch to it:
automation:
- alias: "Marstek - Auto-Configure on Manual Mode"
trigger:
- platform: state
entity_id: select.operating_mode
to: "Manual"
action:
# Slot 0: Night charging
- service: marstek_venus_e.set_manual_schedule
data:
time_num: 0
start_time: "01:00"
end_time: "06:00"
week_set: 127 # All days
mode: "Charging"
power: 800 # Charge at 800W
enable: true
# Slot 1: Morning peak discharge (weekdays)
- service: marstek_venus_e.set_manual_schedule
data:
time_num: 1
start_time: "07:00"
end_time: "09:00"
week_set: 31 # Weekdays only
mode: "Discharging"
power: 700 # Discharge at 700W
enable: true
# Slot 2: Evening peak discharge
- service: marstek_venus_e.set_manual_schedule
data:
time_num: 2
start_time: "18:00"
end_time: "22:00"
week_set: 127 # All days
mode: "Discharging"
power: 750 # Discharge at 750W
enable: true
# ... configure remaining slots 3-9 as neededπ See the Manual Mode Automation Guide for:
- Complete 10-slot configuration examples
- Seasonal schedules (winter vs summer)
- Dynamic schedules based on battery level
- Price-based charging strategies
- Weekend vs weekday patterns
automation:
- alias: "Charge Battery at Night"
trigger:
- platform: time
at: "23:00:00"
action:
- service: marstek_venus_e.set_manual_schedule
data:
time_num: 0
start_time: "01:00"
end_time: "07:00" # Must be > start_time
week_set: 127 # Every day
power: 800 # Maximum (800W)
enable: true
- service: marstek_venus_e.set_mode
data:
mode: "Manual"automation:
- alias: "Auto Mode During Day"
trigger:
- platform: time
at: "07:00:00"
action:
- service: marstek_venus_e.set_mode
data:
mode: "Auto"automation:
- alias: "Low Battery Warning"
trigger:
- platform: numeric_state
entity_id: sensor.marstek_venus_e_battery_state_of_charge
below: 20
action:
- service: notify.mobile_app
data:
title: "Low Battery"
message: "Marstek battery is at {{ states('sensor.marstek_venus_e_battery_state_of_charge') }}%"automation:
- alias: "Store Excess Solar"
trigger:
- platform: numeric_state
entity_id: sensor.marstek_venus_e_pv_power
above: 2000
condition:
- condition: numeric_state
entity_id: sensor.marstek_venus_e_battery_state_of_charge
below: 95
action:
- service: marstek_venus_e.set_passive_mode
data:
power: -2000 # Charge battery
cd_time: 0 # Until solar drops- Ensure you've restarted Home Assistant after installation
- Check
custom_components/marstek_venus_e/manifest.jsonexists - Review Home Assistant logs for errors
- Verify the device IP address is correct
- Ensure device and Home Assistant are on the same network
- Check if port 30000 (UDP) is accessible
- Try pinging the device:
ping <device_ip> - Verify the device is powered on and connected to WiFi
Some sensors depend on hardware configuration:
- CT sensors require CT clamps to be installed
- Check that the device firmware supports all API endpoints
Add to configuration.yaml:
logger:
default: info
logs:
custom_components.marstek_venus_e: debugThen check logs at Settings β System β Logs
This integration uses the Marstek Device Local API (UDP JSON-RPC). For complete API documentation, refer to the official Marstek documentation.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Home Assistant Community: Community Forum
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial integration. It is not affiliated with or endorsed by Marstek. Use at your own risk.
- Integration developed for Home Assistant
- Based on Marstek Device Open API documentation
- Inspired by the Home Assistant community
Enjoy your Marstek Venus E integration! β‘π
