Victron integration with Octopus Energy - Automatic IOG Scheduling via MQTT!

For those of you on Octopus who have an EV and benefit from Intelligent Octopus Go and a Victron Energy inverter (MultiPlus II or Quattro), I have finally managed to get automatic charge scheduling in Victron according to what Octopus provide.

I had already set up a fixed charging schedule from 23:30 to 05:30 which covers the fixed overnight cheap rate (currently 7p/kWh import) but if I had my EV plugged in during the day, Octopus would often provide charging sessions which allows the whole house to benefit from the cheap rate. I could then manually schedule these in my Cerbo’s configuration (Settings → System Setup → ESS → Scheduled charge levels). The problem with this is that is often changed! Octopus vary the scheduled windows throughout the day and a scheduled session might update or be removed completely after it was initially created. And if I didn’t schedule the charging session in Victron, when Octopus did remotely start the charging of my EV, the Victron would see the load and use the battery to fulfil it (emptying at the fastest rate my 5kVA MP2 can do, around 4.4kW).

This created a constant need to check via the Octopus App (or Home Assistant) what my charging sessions were to ensure Victron would be dumping my house battery into my car. Far from ideal.

I had searched for a long time if there was a way to automate this. My searches were ultimately unsuccessful as all the integrations I had come across were either for older MultiPlus (1) devices which have a different set of topics published over MQTT or using Modbus TCP to control the charger which I really wanted to avoid as it’s slow and I already had MQTT up and running for tracking the other variables from my MultiPlus II inverter.

So I decided to do some digging and have found a way of doing it, automagically :smile:

What you actually need to do is control a charging schedule, not attempt to control the charging current.

I’m assuming you already have MQTT up and running and have integrated the Victron system into HA with it publishing all the topic updates. If not, you need to get this up and running. There are several guides and videos on the internet that cover that.

Once you have Victron publishing its data to HA over MQTT, load up MQTT Explorer and drill down to topic
victron/N/<VRM ID>/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/

In there, you will see 5 different sub-topics, numbered from 0 to 4:

Each of these topics correspond to one of the charging sessions configured in the Cerbo (0 → 1, 1 → 2, etc). I picked the last one so it’s at the bottom and “out of the way”, but you can pick any you like. The first charging session is already set up for the 23:30 - 05:30 fixed charging window:


Quick explanation of the values:

  • Duration: duration in seconds. 21600 here corresponds to the 6 hours
  • Start: start time in seconds after 00:00. 84600 corresponds to 23h30min so it starts at 23:30
  • Day: this is an interesting one. The day is actually a coded system to cover every option. If the number is positive, the schedule is enabled. If it’s negative, the schedule is disabled. The values decode as follows:
Option Enable Disable
Every day 7 -7
Weekdays 8 -8
Weekends 9 -9
Monthly 11 -11
Monday 1 -1
Tuesday 2 -2
Wednesday 3 -3
Thursday 4 -4
Frday 5 -5
Saturday 6 -6
Sunday 0 -10

You can easily confirm this is working by looking at a chosen schedule, changing a setting in the Cerbo GUI and seeing it reflect in MQTT.

What I’ve done is taken the last charging slot and configured so it starts at 10:00 and goes on for 12 hours, and for every day of the week.


This gives the following:

The eagle-eyed will probably say there’s an error as the Day value is currently -7 which would mean it’s disabled, but I had to temporarily enable it so I could grab the screenshot of the Cerbo’s GUI :wink:

What we need to do is play with the Day value, effectively toggling it between 7 (enabled) and -7 (disabled).

We can use the Octopus integration to monitor this. With the Octopus integration up and running in HA, you need to look for sensor binary_sensor.octopus_energy_X_XXXXXXXX_intelligent_dispatching (replacing the X_XXXXXXXX with your Octopus account number). When Octopus enable charging with your EV plugged in, the value of this sensor is changed to On which is when we want to enable the charging of your Victron batteries.

I have set up an automation to do this. I also wanted to ensure it’s a safe one as I wouldn’t want charging to be enabled, and then an issue with HA causing the change from On to Off to be missed meaning the Victron system would continue charging when you’re no longer on discounted IOG session.

Here’s the automation I created. It effectively defaults to Off unless it explicity reads an On value, and this is run every minute to you should never miss a state change, or HA does, it will correct itself once it’s back up and running again.

alias: Configure Victron ESS Scheduled chage following Octopus Charging session
description: ""
triggers:
  - event: start
    trigger: homeassistant
  - minutes: /1
    trigger: time_pattern
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.octopus_energy_X_XXXXXXXX_intelligent_dispatching
            state: "on"
        sequence:
          - data:
              topic: >-
                victron/W/<VRM ID>/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/4/Day
              payload: "{\"value\":7}"
            action: mqtt.publish
    default:
      - data:
          topic: >-
            victron/W/<VRM ID>/settings/0/Settings/CGwacs/BatteryLife/Schedule/Charge/4/Day
          payload: "{\"value\":-7}"
        action: mqtt.publish
mode: single

I hope this all makes sense, I’ll try to answer any questions, but I have had this running now for a few weeks and it appears super reliable and always tracks IOG windows, regardless of how often they might change over the course of the day.

Thanks for this! I have got mine configured but I am waiting for my car to get a service before I can plug it in and see my new octopus intelligent slots.