Help with Zappi / Octopus / Sunsynk automation

Hi. I’m new to automations in HA and have recently joined Octopus Intelligent tairff that has problems that it can drain my home solar battery when charging the car. What I’d like to achieve is an automation to prevent the home battery from discharging when the car is charging. My inverter is a Sunsynk and this doesn’t have a simple on/off for battery, but you can set the charge capacity at 100% which stops it from discharging.

So, in terms of entities, I need to test for zappi status of “charging” (entity: sensor.myenergi_zappi_status_2)

And trigger changing the following entity to 100% which will stop the battery discharging: (entity: number.ss_prog1_capacity) and also prog2, prog3 etc.

When Zappi returns to pause mode I then want to revert the previous entities to their previous values. I’m assuming this is a simple automation but welcome any pointers as to how to write it!

Hello Al,

I’m sure that can be done. Also having someone or something writing it for you means the second it misbehaves, you will be struggling back to find someone to fix it for you.
The best way to learn is to just try. Run thru the docs on getting started with the automation editor. If you get stuck, come back with what you have done.

and
The Home Assistant Cookbook - Index.

How to help us help you - or How to ask a good question.

1 Like

Thanks, I actually think I managed it without code, just using the automation workflow. In the end acheived it with setting the max discharge current of the battery to 1A when the Zappi internal CT rate is above 1000W. When it drops back down below 1000W the battery discharge current returns to 50A.

1 Like

Hi would you be able to share your automation workflow for this?

Sad to said i Given up trying with Home Assistant, not been able to get it to fully work.

Background:

Normally, Octopus Go offers off-peak rates at around 7p per kWh between 23:30 and 05:30 in the UK. However, the charging times for your car can dynamically adjust based on market prices.

The issue is that while MyEnergi Zappi (controlled by the energy provider) responds to these variable times, the SunSync inverter only accepts fixed time slots. Since MyEnergi doesn’t integrate with SunSync, there’s no way to sync the two systems.

As a result, if Octopus shifts your car charging to before 23:30, the battery will end up draining into the car instead of charging at the cheap rate if you do not change the settings manually.

What I have Done:

I’ve been experimenting with CursorAI and built a small web app that solves a common issue: preventing your car charging from draining your home battery.

The app syncs your SunSync inverter with your Zappi’s charging status, ensuring your battery isn’t used to charge your EV when it shouldn’t be.

You could ask CursorAI to convert this code into Python or any other language you may find useful. I have also documented the API calls needed in Postman exports.

Warning: Use at your own risk, always back up SunSync settings before using!

The Code:

If you’d like to try it out, the code is available here: GitHub - martinjamesholland/Zappi-Sunsync-Controller-Public: Zappi and Sunsync battery management when the car is charging using controller

Requirements:

  • Web hosting with PHP 8.2+
  • A cron job (or you can run it locally on a PC/Mac/server)

I have this working. I also automatically

  • add charge to the battery whenever the favourable 7p rate is in place during peak hours (in addition to always charging them during off-peak)
  • not increase the battery SOC above the 80% limit (my preference)

I have a SunSynk inverter, with SolarAssistant communicating to HASS via MQTT. I have a Zappi v2.1 charger, and I use Intelligent Octopus Go; the car is a VW ID.3.

These automations should give you an idea…

In short:

  • you disable use_timer to prevent the battery from being discharged
  • if required, disable grid_charge to prevent the battery from being charged (which is what happens when use_timer is disabled)

You do not need to change the work mode timers.

You need to trigger the above only during: a) off-peak, or b) when IO Go is dispatching (e.g. 7p a unit at 7am) and the Zappi is charging.

- id: '1742548715289'
  alias: When peak, Charge SunSynk if actively dispatching
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - sensor.kit_charging_state
    to: charging
  - trigger: state
    entity_id:
    - sensor.zappi_plug_status
    to: Charging
  - trigger: time_pattern
    minutes: /3
  conditions:
  - condition: time
    after: 05:30:00
    before: '23:30:00'
  - condition: state
    entity_id: binary_sensor.octoplus_vehicle_intelligent_dispatching
    state: 'on'
  - condition: state
    entity_id: sensor.kit_charging_state
    state: charging
  actions:
  - action: automation.trigger
    target:
      entity_id: automation.turn_off_sunsynk_timer_until_next_30_min_window
    data:
      skip_condition: true
  mode: single

To get the current state of dispatching from octopus, latest practice is to call a service - I call this service very often when a car is connected to the zappi.

- id: '1742283823832'
  alias: When peak, Update IO dispatches when Zappi connected
  description: 'condition: use time, not off-peak entity'
  triggers:
  - trigger: time_pattern
    minutes: /3
  - trigger: state
    entity_id:
    - binary_sensor.charger_is_plugged_in
    to: 'on'
  conditions:
  - condition: time
    after: '05:30:00'
    before: '23:30:00'
  - condition: state
    entity_id: binary_sensor.charger_is_plugged_in
    state: 'on'
  actions:
  - delay: { hours: 0, minutes: 0, seconds: 30, milliseconds: 0 }
  - action: octopus_energy.refresh_intelligent_dispatches
    target:
      entity_id:
      - binary_sensor.octoplus_vehicle_intelligent_dispatching
    data: {}
  mode: single

You need to resume the work mode timers under some circumstances, like…

- id: '1742422169148'
  alias: When peak, Re-enable SunSynk timer when IO stops dispatching
  triggers:
  - trigger: state
    entity_id:
    - binary_sensor.octoplus_vehicle_intelligent_dispatching
    to: 'off'
  conditions:
  - condition: time
    after: '05:30:00'
    before: '23:30:00'
  actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.sunsynk_use_timer
  mode: single

I have a Givenergy inverter and Zappi car charger and experienced the same problem using Octopus Intelligent Go tariff. Using Home Assistant I have two automations. The first detects any change of status of the ZAPPI to “Boosting” and sets the Discharge rate of the battery to zero. The second detects any change of status of the ZAPPI to “Paused” or “Complete” and sets the battery discharge rate to 2600 (my maximum). This seems to work OK and it doesn’t matter whether it is inside or outside the 23:30 to 05:30 timeframe.

Easy to edit in the UI of Home Assistant, but here is the YAML:

Note also I send myself a notification so I know what is going on. Also check for not boosting, not charging and paused or complete in the second code. This is because there does not seem absolute consistency in what the ZAPPI reports as it’s status. No doubt there is an algorithm but I check everything to be safe.

alias: Stop Battery discharge if ZAPPI boosting
description: ""
triggers:
  - entity_id:
      - sensor.myenergi_zappi_20517656_status
    to: Boosting
    trigger: state
conditions: []
actions:
  - device_id: 79082ed21838599b630d4c3d35847670
    domain: number
    entity_id: 84df80d69c8cf159b0e1f3da137b19e3
    type: set_value
    value: 0
  - data:
      title: Warning
      message: Zappi boosting. Battery discharge off
    action: notify.mobile_app_sm_n960f
mode: single

alias: Battery discharge when ZAPPI stops
description: ""
triggers:
  - entity_id:
      - sensor.myenergi_zappi_20517656_status
    trigger: state
    from: Charging
  - entity_id:
      - sensor.myenergi_zappi_20517656_status
    trigger: state
    from: "Boosting "
  - entity_id:
      - sensor.myenergi_zappi_20517656_status
    trigger: state
    to: Completed
  - entity_id:
      - sensor.myenergi_zappi_20517656_status
    trigger: state
    to: Paused
conditions: []
actions:
  - device_id: 79082ed21838599b630d4c3d35847670
    domain: number
    entity_id: 84df80d69c8cf159b0e1f3da137b19e3
    type: set_value
    value: 2600
  - data:
      title: Warning
      message: Zappi boosting ended,  battery to 2600
    action: notify.mobile_app_sm_n960f
mode: single

It’s certainly possible as I do it, caveat is that I use node-red with solar-assistant in addition to home-assistant and octopus energy integration.

Solar-assistant requires its own raspberry-pi and rs232 cable, I bought the StarTech DB9 RS232 USB to Serial Adapter Cable from Amazon

MQTT is used between solar-assistant and home-assistant

I can then set the capacity charge point of the inverter depending upon the time and status of IOG intelligent_dispatching. This setup also allows to dump unused battery capacity at 10PM onto the grid thus increasing my export

I can also choose to charge the house batteries along with the car during the day

1 Like

Nice idea about the export… I have used a similar set up, although I have a HyperVolt Pro 3 charger. I found Solar Assistant and MQTT a better strategy then the SunSynk API.

Interesting you had the same delay issues. I think the Inverter prefers the gentle approach. :slight_smile: