Myenergi Zappi automation to protect hybrid battery during Eco Tariff

Dave Foster
Posts: 1661
Joined: Thu Oct 13, 2022 7:21 pm

HughInDevon wrote: Sat Feb 08, 2025 9:42 pm Hi Dave,
I think I have cracked how to start forced discharging. I managed to do it via the UI after a bit of trial and error. So, my last remaining problem is how to stop the fd before the soc falls to 10%. Ideally I would like to stop it in the same automation when the Soc drops to say 15% but perhaps I need to use another automation to stop it? Any thoughts?

Regards, Hugh
ok sorry a bit late to the party, for your FD soc i'd suggest doing it in another automation and keep it simple, it can be done in the same automation but you would have to write an if then, set trigger_id's and it wouldn't make it easy to follow.
If you do it in a separate automation 'FDSOC Control' it's a simple test, something like this -

Code: Select all

alias: FDSOC Control
description: "If in Force Discharge mode and SOC drops below 20, set work mode to Self Use"
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.battery_soc
    below: 20
conditions:
  - condition: state
    entity_id: select.work_mode
    state: Force Discharge
actions:
  - action: logbook.log
    metadata: {}
    data:
      name: FDSOC Control
      message: Less than set SOC, set back to Self Use
  - action: select.select_option
    metadata: {}
    data:
      option: Self Use
    target:
      entity_id: select.work_mode
mode: single

The numeric trigger will only trigger once if the battery_soc falls from above the set limit to below the set limit, it won't trigger again until the soc rises back above the value (you can use an input number for the test).

The only downside to this simple way is that it has to fall below what you set i.e. if you set 20, it will trigger at 19 - not a major issue but my ocd is trembling slightly.

The next condition is to check it actually in Force Discharge mode, and if it is then it will switch back to Self Use.
User avatar
HughInDevon
Posts: 58
Joined: Wed Jul 31, 2024 4:50 pm

Your OCD may be trembling but mine is in full melt down. I was so pleased with myself for managing to get my automation to change the work state to force discharge that I forgot to kill it. So, it triggered, it worked, it emptied my battery as soon as the force charging schedule ended!
Luckily it is a sunny day in dear old Devon so we are on self-use mode and the soc is slowly going up again.
I shall shamelessly use your code for a third automation. Thanks as always.
Hugh
KH10 with 4 off ECS4800 batteries.
20 Jinko 435W panels in 2 strings. 10 on house, south facing, 10 on barn, east facing.
Solar installation active on 27/11/2024. Export MPAN active on 30.12/2024.
Zappi V2 charger and 2 EVs.
Currently on Octopus Intelligent Go tariff.
Home Assistant modbus integration (Now working - ish)
Dave Foster
Posts: 1661
Joined: Thu Oct 13, 2022 7:21 pm

HughInDevon wrote: Sun Feb 09, 2025 9:59 am Your OCD may be trembling but mine is in full melt down. I was so pleased with myself for managing to get my automation to change the work state to force discharge that I forgot to kill it. So, it triggered, it worked, it emptied my battery as soon as the force charging schedule ended!
Luckily it is a sunny day in dear old Devon so we are on self-use mode and the soc is slowly going up again.
I shall shamelessly use your code for a third automation. Thanks as always.
Hugh
ouch, i've done that a few times and kicked myself for the rest of the day.

It can be done precisely but you have to use a time pattern to trigger the automation every minute (a tiny overhead) and then test with a template in conditions, but the other way is easier to test and get working.
Post Reply