Victron Integration with HA and EMHASS: A Comprehensive Guide

After months of experimentation and fine-tuning, I’m thrilled to share my experience integrating Victron equipment with Home Assistant (HA) and EMHASS. This setup has completely transformed how I manage my energy systems, offering unparalleled control and insight. Here’s a breakdown of my journey and how you can replicate it:

Hardware Setup

  • Victron MultiPlus II 5.0 (x3)
  • Victron SmartShunt (500A)
  • Victron CerboGX
  • Victron Smart Meter
  • 80kW LiFePO4 Battery Bank
  • HA Running on HAOS
  • Mosquitto Broker

Key Assumptions

  • Victron devices are connected to the same Ethernet network as HA.
  • Static IPs are assigned to both Victron GX and HA.
  • Victron ESS Assistant is installed and configured.

Integration Process

  1. MQTT Configuration
    Enable MQTT on your Victron GX device to establish communication with HA. This step is crucial as it forms the backbone of the integration.

  2. Device Identification
    Identify the Device IDs of all Victron devices on your network. This ensures that HA can accurately monitor and control each component.

  3. HA Configuration
    Add the following code to your configuration.yaml to enable Modbus communication:
    yaml
    modbus:

    • name: victron
      type: tcp
      host: 192.168.10.137
      port: 502
      sensors:
      • name: ‘ESS Grid Target’
        unit_of_measurement: “W”
        slave: 100
        address: 2700
        data_type: uint16
        scan_interval: 5
        device_class: power

    This setup allows HA to read and write data from your Victron devices.

  4. Slider Automation
    Create a slider in HA to adjust the ESS Grid Set Point. This slider acts as a user-friendly interface to control energy import/export:
    yaml
    input_number:
    input_current_slider:
    name: ESS Grid Target Value
    min: -15000
    max: 15000
    step: 100

  5. Automations
    Implement automations to synchronize the slider value with Victron. This ensures seamless communication between HA and your Victron setup:
    yaml
    alias: 990.1 ESS Grid Set Point - SEND NEGATIVE
    trigger:

    • platform: state
      entity_id: input_number.input_current_slider
      condition:
    • condition: numeric_state
      entity_id: input_number.input_current_slider
      below: “0”
      action:
    • service: modbus.write_register
      data:
      address: 2700
      unit: 100
      value: “{{ states(‘input_number.input_current_slider’) | float + 65536 }}”
      hub: victron
      mode: single

EMHASS Integration

For those diving into energy management, EMHASS offers advanced forecasting and optimization. I’ve set up daily optimizations using curl commands, ensuring my system operates at peak efficiency:
bash
post_amber_forecast: “curl -i -H ‘Content-Type: application/json’ -X POST -d ‘{"prod_price_forecast":{{( state_attr(‘sensor.amber_feed_in_forecast’, ‘forecasts’)|map(attribute=‘per_kwh’)|list) }},"load_cost_forecast":{{( state_attr(‘sensor.amber_general_forecast’, ‘forecasts’) |map(attribute=‘per_kwh’)|list) }}}’ http://localhost:5000/action/dayahead-optim

Conclusion

This integration has been a game-changer for my energy management. By leveraging HA and EMHASS, I’ve achieved a level of control and efficiency that was previously unattainable. Whether you’re looking to optimize energy usage or gain deeper insights into your system, this setup is highly recommended.

If you have any questions or need assistance, feel free to reach out. Happy automating! :rocket: