Victron, Home Assistant, Node-red, Modbus, scheduled battery charge

I’m working with Victron CerboGX, Multiplus-II and a Lifepo4-battery as part of my solar setup. I also have Homeassistant with Node-red installed, and now I want to enable one schedule, in the ESS “Scheduled charge levels" setting from node-red by Modbus, in Home Assistant (and not in Cerbo, Venus OS large) so I can charge the battery at cheapest hours in the night to a defined soc value.

Setup and communication work fine, but I can’t find the Modbus register value to enable/disable the ESS schedule anywhere.

I’ve also looked here: CCGX-Modbus-TCP-register-list-3.50.xlsx

Does anyone have this register value?

I can do a lot of workarounds, but the one I need suits me best, and I don’t want to hand control over to Dynamic ESS.

The next best thing would be enable/disable schedule by MQTT, but this leads me to the same dead end.

Too complicated…

You could start by using an ESS schedule simmilar to this:

and then use the programm dbus-spy on venus-os to search for what you need. This is still not the register number, but an approch which will help for a node-red solution.

Thank you for your suggestion to an approach. Haven’t thought of that.

Hi Woob, From Jan 1 on I am going to run the same setup and looking for a solution to write via HomeAssistant into the scheduled battery registers. Did you find a solution already, Thanks Fred

Unfortunately, not.

It would have been the best solution I my case to control the scheduled charge in Victron by Home Assistant.

Plan B, is to send the individual commands from Node-red or Automation/Script in HA to Victron, as all the command are available in HA in the Victron integration.

But this also gives me concerns….like, what if the general network communication breaks down, while charging, or I forget and reboot HA while charging/communicating.

So doing it all from HA also means to considerate to have some actions to take care of “faults”

I’ve not done it yet (due to lack of time) and currently it works kinda ok for me to go with at static charge schedule at night. But hopefully within 1 month or two….

Hi,

Those values seems to be controllable only via mqtt, not via a register

I managed to set it up correctly thanks mostly to this guide:

I can now see and control the scheduled charging

This is the sensor configuration

mqtt:
  sensor:
    - state_topic: "victron/N/DEVICE_ID/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Start"
      name: "ESS Scheduled charging start"
      unique_id: "ess_scheduled_start_time"
      value_template: >
          {% set hours = (value_json.value // 3600) %}
          {% set minutes = ((value_json.value % 3600) // 60) %}
          {{ "%02d:%02d" | format(hours, minutes) }}
    - state_topic: "victron/N/DEVICE_ID/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Duration"
      name: "ESS Scheduled charging duration"
      unique_id: "ess_scheduled_duration"
      value_template: >
          {% set hours = (value_json.value // 3600) %}
          {% set minutes = ((value_json.value % 3600) // 60) %}
          {{ "%02dh%02dm" | format(hours, minutes) }}
  
  number:
      - name: "ESS Scheduled charging soc"
        unique_id: "ess_scheduled_percent"
        state_topic: "victron/N/DEVICE_ID/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Soc"
        command_topic: "victron/W/DEVICE_ID/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Soc"
        device_class: battery
        unit_of_measurement: "%"
        min: 0
        max: 100
        step: 1
        value_template: '{{ value_json.value }}'
        command_template: '{"value": {{ value | int }}}'

This is an example of an automation to set the target SOC for the night depending on tomorrows solar forecast

alias: Schedule SOC based on solar forecast
description: ""
triggers:
  - at: "22:55:00"
    trigger: time
actions:
  - data:
      topic: >-
        victron/W/DEVICE_ID/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/0/Soc
      retain: false
      payload: >
        {% set target_value = 18 %}
        {% set battery_capacity = 13 %}
        {% set forecast = states('sensor.solcast_pv_forecast_forecast_tomorrow') | float(50) %}
        {% set value = ((target_value - forecast) / battery_capacity) * 100 %}
        {% if value < 15 %}
          {% set value = 15 %}
        {% elif value > 100 %}
          {% set value = 100 %}
        {% endif %} 
        {"value": {{ value | int }}}
    action: mqtt.publish
mode: single

target_value=18 is arbitrary, and it’s the expected average consumption of my home
battery_capacity=13 I considered 80% of my 15kwh battery storage
It basically charges more during the low tariff at night if there is less expected production tomorrow

The 5 schedules are controlled by these mqtt topics

Hope it can help

1 Like