Victron Energy

Victron Energy systems (inverters, battery storage, solar chargers) expose their data via MQTT on the local network or through the VRM (Victron Remote Management) cloud portal. energy2mqtt connects directly to the Victron GX device’s MQTT interface to retrieve comprehensive energy data.

Details

Victron GX devices include: Cerbo GX, Venus GX, Ekrano GX, and devices running Venus OS. These act as the central hub for your Victron system and provide the MQTT interface.

How It Works

Victron GX devices run Venus OS, which includes a built-in MQTT broker. energy2mqtt connects to this broker and automatically discovers all connected devices: grid meters, batteries, inverters (MultiPlus/Quattro), and solar chargers.

Typical Setup

[Grid Meter] ──┐
[Battery] ─────┼──> [Victron GX Device] <──(MQTT)──> [energy2mqtt] ──> [Home Assistant]
[MultiPlus] β”€β”€β”€β”˜         β”‚
[Solar] β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Connection Options

Method Description Use Case
Local MQTT Connect to GX device on LAN Home network, low latency
VRM MQTT Connect via Victron cloud Remote access, internet required
Details

For the best performance and reliability, use the local MQTT connection when energy2mqtt runs on the same network as your Victron system.

Supported Devices

energy2mqtt automatically detects and reads data from:

Grid Meters

AC meters connected to the system (grid connection point):

Measurement Description Unit
energy_positive Total energy from grid kWh
energy_negative Total energy to grid (feed-in) kWh
power Current total power W
frequency Grid frequency Hz
voltage_l1/l2/l3 Per-phase voltage V
current_l1/l2/l3 Per-phase current A
power_l1/l2/l3 Per-phase power W

Batteries

Battery systems (including Pylontech, BYD, Victron batteries):

Measurement Description Unit
soc State of Charge %
soh State of Health %
voltage Battery voltage V
current Charge/discharge current A
power Battery power W
temperature Battery temperature Β°C

Pylontech-specific data:

Measurement Description Unit
min_cell_temperature Coldest cell Β°C
max_cell_temperature Hottest cell Β°C
min_cell_voltage Lowest cell voltage V
max_cell_voltage Highest cell voltage V

VEBus Devices (MultiPlus/Quattro)

Inverter/charger energy flow data:

Measurement Description Unit
energy_inv_acin1 Inverter to AC-IN1 kWh
energy_inv_acin2 Inverter to AC-IN2 kWh
energy_inv_out Inverter to AC-Out kWh
energy_out_inv AC-Out to Inverter kWh
energy_acin1_inv AC-IN1 to Inverter kWh
energy_acin2_inv AC-IN2 to Inverter kWh
energy_acin1_acout AC-IN1 to AC-Out (bypass) kWh
energy_acin2_acout AC-IN2 to AC-Out (bypass) kWh
energy_acout_acin1 AC-Out to AC-IN1 kWh
energy_acout_acin2 AC-Out to AC-IN2 kWh

Victron MQTT Protocol

Topic Structure

Victron uses a specific MQTT topic structure:

N/{portal_id}/{service}/{device_instance}/{path}
Component Description Example
N/ Notification prefix N/
portal_id Unique system ID c0619ab38650
service Device type grid, battery, vebus
device_instance Device number 30, 276
path Data path Ac/Power, Dc/0/Voltage

Read Requests

To get current values, energy2mqtt publishes to R/ topics:

Publish to: R/{portal_id}/grid/30/Ac/Power
Response on: N/{portal_id}/grid/30/Ac/Power

Message Format

Values are JSON-encoded:

{"value": 1234.5}

Configuration

Basic Configuration

Add to your e2m.yaml:

victron:
  - name: "home_system"
    enabled: true
    broker_host: "192.168.1.50"    # IP of your GX device
    broker_port: 1883
    client_name: "energy2mqtt"
    update_interval: 10            # Seconds between updates

Configuration Parameters

Parameter Required Description Default
name Yes Friendly name for the system -
enabled Yes Enable/disable this connection -
broker_host Yes IP address or hostname of GX device -
broker_port Yes MQTT port 1883
client_name No MQTT client identifier energy2mqtt
update_interval Yes Seconds between data updates -

Multiple Systems

You can monitor multiple Victron systems:

victron:
  - name: "house_1"
    enabled: true
    broker_host: "192.168.1.50"
    broker_port: 1883
    update_interval: 10

  - name: "house_2"
    enabled: true
    broker_host: "192.168.1.51"
    broker_port: 1883
    update_interval: 10

Enabling MQTT on Your GX Device

By default, MQTT may not be enabled on your Victron GX device.

Via the GX Display/Touch

  1. Go to Settings β†’ Services
  2. Enable MQTT on LAN
  3. Note the IP address shown

Via VRM Portal

  1. Log in to VRM Portal
  2. Select your installation
  3. Go to Settings β†’ Remote Console
  4. Navigate to Services β†’ MQTT on LAN
  5. Enable it

Via SSH (Advanced)

ssh root@192.168.1.50
# Default password: Check VRM or device documentation

# Enable MQTT
dbus -y com.victronenergy.settings /Settings/Services/MqttLocal SetValue 1
Details

The MQTT interface has no authentication by default. Only enable it on trusted networks. Consider using a VLAN or firewall rules to restrict access.

Auto-Discovery

energy2mqtt automatically discovers devices connected to the Victron system:

  1. Portal ID Detection - Subscribes to N/+/system/0/Serial to find the system
  2. AC Meter Detection - Reads number of AC inputs and their configuration
  3. Battery Detection - Reads the battery array from system data
  4. VEBus Detection - Finds MultiPlus/Quattro devices

All discovered devices are automatically registered with Home Assistant via MQTT auto-discovery.

Output Data

Home Assistant Entities

For each discovered device, energy2mqtt creates Home Assistant entities:

Grid Meter:

  • sensor.victron_home_system_meter_xxx_power
  • sensor.victron_home_system_meter_xxx_energy_positive
  • sensor.victron_home_system_meter_xxx_energy_negative
  • sensor.victron_home_system_meter_xxx_voltage_l1 (and L2, L3)
  • sensor.victron_home_system_meter_xxx_frequency

Battery:

  • sensor.victron_home_system_battery_0_soc
  • sensor.victron_home_system_battery_0_soh
  • sensor.victron_home_system_battery_0_power
  • sensor.victron_home_system_battery_0_voltage
  • sensor.victron_home_system_battery_0_temperature

Example Output JSON

{
  "meter_serial_power": 1523,
  "meter_serial_frequency": 50.01,
  "meter_serial_voltage_l1": 230.5,
  "meter_serial_energy_positive": 12345.67,
  "battery_0_soc": 85,
  "battery_0_power": -1200,
  "battery_0_voltage": 51.2,
  "vebus276_energy_inv_out": 234.5
}

Understanding Energy Flow

Victron systems track energy flow in multiple directions:

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    AC-IN 1 ──────> β”‚             β”‚ ──────> AC-OUT
    (Grid)          β”‚  MultiPlus  β”‚         (Loads)
    AC-IN 2 ──────> β”‚  /Quattro   β”‚
    (Generator)     β”‚             β”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           v
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Battery   β”‚
                    β”‚   (DC Bus)  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Energy counters explained:

Counter Flow Direction
acin1_inv Grid β†’ Inverter β†’ Battery (charging)
inv_acin1 Battery β†’ Inverter β†’ Grid (feed-in)
acin1_acout Grid β†’ AC-Out directly (bypass)
inv_out Battery β†’ Inverter β†’ Loads
out_inv AC-Out β†’ Inverter β†’ Battery (e.g., PV on AC-Out)

Troubleshooting

Cannot Connect to MQTT

Check if MQTT is enabled:

# From a Linux machine on the same network
mosquitto_sub -h 192.168.1.50 -t "N/#" -v

You should see messages appearing. If not:

  • Verify MQTT is enabled on the GX device
  • Check firewall rules
  • Verify IP address

No Devices Discovered

Check portal ID detection:

  • Look in energy2mqtt logs for “Portal id found”
  • If missing, the GX device might not be publishing system data

Verify system serial:

mosquitto_sub -h 192.168.1.50 -t "N/+/system/0/Serial" -v

Missing Data Points

Some values show as 0 or missing:

  • Not all Victron devices report all values
  • Check if the device is physically connected
  • Some values only appear when relevant (e.g., L2/L3 on single-phase systems)

Connection Drops

Frequent disconnections:

  • Increase update_interval to reduce load
  • Check network stability
  • Verify GX device isn’t overloaded with MQTT clients

Advanced: VRM Cloud MQTT

For remote access without local network connectivity, you can connect via VRM’s MQTT broker.

Details

TODO: Document VRM MQTT broker connection including:

  • VRM MQTT broker address
  • Authentication setup
  • SSL/TLS configuration
  • Topic structure differences