PredBat and three phase?

3 comments started 2023-12-30 last 2024-01-03
APIsHome AutomationHome Assistant
C
#1 ChrisT

Hi all,

I've just spent a few days getting PredBat working on my GivEnergy setup with Octopus Agile. Kudos to Trefor for all the work on this amazing bit of software, it's taken a bunch of ideas that I had and converted it into an amazing tool covering pretty much anything I was thinking about. I'll need to take a few extra days to play with all the options that HA provides.

One question that I'm hoping this crowd might be able to help - my house setup is a three phase supply with each phase having a separate inverter and battery - so one inverter / one battery per phase. Right now, I've setup PredBat in monitor mode for one of the phases.

Reading though all the documentation that I can find, and also skimming the 10k+ lines of python for predbat. I'm wondering the best way to setup PredBat for all the phases - does anyone have any ideas / experience of this? I'm thinking there are two potential options.

Option 1 - run multiple copies of PredBat on the same VM
To do this adjust the predbat.py to initialise a new class (PredBat[1|2|3]), each reading a specific apps.yaml file, with each apps.yaml file connecting to a different inverter (by setting geserial) and setting a distinct prefix (apps.yaml line 10). Adjust all the charts / outputs (including the predbat plan) to use the new prefix.

Option 2 - run the current predbat.py on separate (three) VMs
To do this - clone the VM, changing the apps.yaml geserial

Option 3 - refactoring the code to process all three phases
Possible - but more work than my python skills would allow for.

Option 2 I'm pretty confident will work since the power used per phase comes from the GivEnergy API but has the disadvantage of multiple HAs to interface with - a minor inconvenience. But i'm tempted about Option 1...

Appreciate any comments / thoughts

G
#2 geoffreycoan

ChrisT Predbat will handle multiple inverters, you just edit the apps.yaml to have all 3 inverter details, one under each other in the config settings. I have two inverters (both single phase) but Predbat works just fine

The docs state that it will work for 3 inverters. You'd need to add a geserial3 entry and add another givtcp_rest entry for the 3rd inverter:

geserial: 're:sensor.givtcp_(.+)_soc_kwh'
geserial2: 're:sensor.givtcp2_(.+)_soc_kwh'

  # Sensors, more than one can be specified and they will be summed up automatically
  #
  # For two inverters the load today would normally be the master load sensor only (to cover the entire house)
  # If you have three phase and one inverter per phase then you would need three load sensors
  #
  # For pv_today if you have multiple solar inverter inputs then you should include one entry for each inverter
  #
  load_today:
    - sensor.givtcp_{geserial}_load_energy_today_kwh
    - sensor.givtcp2_{geserial}_load_energy_today_kwh
  import_today:
    - sensor.givtcp_{geserial}_import_energy_today_kwh
    - sensor.givtcp2_{geserial}_import_energy_today_kwh
  export_today:
    - sensor.givtcp_{geserial}_export_energy_today_kwh
    - sensor.givtcp2_{geserial}_export_energy_today_kwh
  pv_today:
    - sensor.givtcp_{geserial}_pv_energy_today_kwh
    - sensor.givtcp2_{geserial}_pv_energy_today_kwh

givtcp_rest:
   - 'http://homeassistant.local:6345'
   - 'http://homeassistant.local:6346'

Worth noting that Predbat manages across all two of my inverters and batteries identically, and 3 phase would work the same. So all batteries charged, discharged in parallel. I had different battery sizes on my two inverters so this caused a few oddities like one charging before the other, but it worked well enough

C
#3 ChrisT

geoffreycoan

Thanks - I read that and as I have three phase with an inverter / battery on each, I would rather run each phase separately. I have a hacked together option 1 setup (sorry trefor) running for the last few days with three independent predbat modules running. Still working through some of the bugs, but seems to be working - just been wondering about how the algorithm is working out the charge / discharge cycles right now.