Intelligent Octopus: minimise peak rate charging your Tesla with Home Assistant

Intelligent Octopus is one of Octopus Energy’s tariffs designed for EVs. Owners allow Octopus to decide when their car is going to charge, and get a low rate (7.5p/kWh) from 23:30 to 05:30 – and any other times that Octopus chooses to charge the car.

This low rate applies to all consumption (not just car charging) when it’s active, so a minimum six-hour cheap period and knowing that your car is charging at the most beneficial (and low-carbon) time for the grid makes this an extremely attractive tariff.

The charging schedule is created as follows:

  1. Car is plugged in to charge any time from 5PM onwards
  2. Octopus detects the car charging and stops the charge
  3. Based on the current and desired state of charge, Octopus calculates how much energy is required
  4. Based on projected grid supply and demand, Octopus calculates the optimal slots to charge the car with the energy required
  5. Octopus controls the car or charger directly, based on this schedule

But there’s a problem. It can take 10-15 minutes for Octopus to detect that the car’s been plugged in. And peak rate electricity costs an eye-watering 41p/kWh on this tariff, which means that by the time Octopus has killed your peak-rate initial charge, it could cost you between £150 and £200 more per year than necessary.

This is where the power- and home-automation Swiss army knife Home Assistant comes in. Using the Intelligent Octopus and Tesla Custom add-ins we can add a couple of automations to help.

The first automation is triggered when the car starts to charge during peak hours. It checks to see if this is a scheduled cheap slot, or if Intelligent Octopus “bump” charging has been enabled. If not, it stops the car charging:

The YAML view is as follows:

alias: Stop car charging if peak rate
description: ""
trigger:
  - platform: device
    type: turned_on
    device_id: xxxx
    entity_id: switch.blue_shell_charger
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition:
  - condition: and
    conditions:
      - condition: device
        device_id: xxxx
        domain: device_tracker
        entity_id: device_tracker.blue_shell_location_tracker
        type: is_home
      - condition: time
        after: "05:30:00"
        before: "23:30:00"
      - type: is_off
        condition: device
        device_id: xxxx
        entity_id: binary_sensor.octopus_intelligent_slot
        domain: binary_sensor
      - condition: device
        type: is_off
        device_id: xxxx
        entity_id: switch.octopus_bump_charge
        domain: switch
action:
  - type: turn_off
    device_id: xxxx
    entity_id: switch.blue_shell_charger
    domain: switch
mode: single

This triggers a minute or two after the car is plugged in, which creates a different problem: it’s too quick for Octopus, which doesn’t now spot that the car is plugged in and ready for charging to be scheduled:

Cue automation two. If we get to 23:35, the car is plugged in but no Intelligent Octopus slots have been created, now we can start the car charging. After ten minutes or so, Octopus will detect the car, create the schedule and end charging. We know this will be cheap rate so we don’t really care if it takes a while to detect.

Again, the YAML view:

alias: Turn on car charger at 23:35
description: ""
trigger:
  - platform: time
    at: "23:35:00"
condition:
  - condition: and
    conditions:
      - type: is_plugged_in
        condition: device
        device_id: xxxx
        entity_id: binary_sensor.blue_shell_charger
        domain: binary_sensor
      - condition: device
        type: is_off
        device_id: xxxx
        entity_id: switch.blue_shell_charger
        domain: switch
action:
  - type: turn_on
    device_id: xxxx
    entity_id: switch.blue_shell_charger
    domain: switch
mode: single

Voilá! If you already have Home Assistant set up this will take you a few minutes to configure. If you don’t, but have a Raspberry Pi kicking around or a machine available to run docker, it’s an easy installation. And if you don’t have a Raspberry Pi or docker server available, this will run happily on a Raspberry Pi 3 which would pay for itself within a few months of using these automations.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *