Predbat - preparing for battery replacement

5 comments started 2026-01-14 last 2026-01-14
Home AutomationHome Assistant
P
#1 pwdst

On Friday GivEnergy will be replacing two faulty 2.6kWh Gen 1 batteries with a single 5.12kWh Gen 3 battery. The inverter will not change beyond the removal of the redundant isolator handle given the Gen 3 battery has this built in.

Is there anything I should be doing to prepare Predbat for this existential crisis? I plan on removing battery_charge_power_curve as obviously different batteries are going to have different characteristics. I know that battery_temperature will need updating with the new serial number.
I am planning on restarting Home Assistant after the battery has been fitted to force GivTCP to update values, and can also remove the set_reserve_min values as that was a temporary mitigation for low voltages on the damaged cells.

P
#2 pwdst

This is the Predbat yaml config file-

  module: predbat
  class: PredBat

  # Sets the prefix for all created entities in HA - only change if you want to run more than once instance
  prefix: predbat

  # Timezone to work in
  timezone: Europe/London

  # Currency, symbol for main currency second symbol for 1/100s e.g. $ c or £ p or e c
  currency_symbols:
  - '£'
  - 'p'

  # Number of threads to use in plan calculation
  # Can be auto for automatic, 0 for off or values 1-N for a fixed number
  threads: auto

  # Set the battery level you want to keep (in kWh) as a backup in case you use more energy
  #best_soc_keep: 0.4

  # Set to auto-match with a GivEnergy serial number, but you can override the serial or the sensor names
  # if it doesn't work or if you have more than one inverter you will need to list both
  geserial: 'sensor.givenergy_REDACTED_invertor_serial_number'

  # Sets the maximum period of zero load before the gap is filled, default 30 minutes
  # To disable set it to 1440
  load_filter_threshold: 30

  # Sensors, more than one can be specified and they will be summed up automatically
  load_today:
  - sensor.givenergy_REDACTED_load_energy_today_kwh
  import_today:
  - sensor.givenergy_REDACTED_import_energy_today_kwh
  export_today:
  - sensor.givenergy_REDACTED_export_energy_today_kwh
  pv_today:
  - sensor.givenergy_REDACTED_pv_energy_today_kwh

  # Load forecast can be used to add to the historical load data (heat-pump)
  # To link to Predheat
  # Data must be in the format of 'last_updated' timestamp and 'energy' for incrementing kWh
  #load_forecast:
  #  - predheat.heat_energy$external

  # If you enable ge_cloud_data then the load/import and export data will be fetches from the GE cloud instead of from GivTCP sensors
  # this is usually less efficient and of course prone to internet downtime, but could be useful if you lost your GivTCP data
  # Set the serial to the inverter serial to pull the data from and the key to your API key
  # When this is set load_today, import_today and export_today are not used
  ge_cloud_data: false
  ge_cloud_serial: 'REDACTED'
  ge_cloud_key: 'REDACTED.REDACTED.REDACTED'

  # Controls/status - must by 1 per inverter
  num_inverters: 1

  # Run balance inverters every N seconds (0=disabled) - only for multi-inverter
  balance_inverters_seconds: 0

  # When enabled automatic restart will restart the add-on if communication fails
  # Example below is auto-restart for GivTCP add-on itself
  auto_restart:
    - shell: 'rm -rf /homeassistant/GivTCP/*.pkl'
    - service: hassio/addon_restart
      addon: a6a2857d_givtcp

  #  Example on how to restart the inverter via GivTCP
    - service: switch.turn_on
      entity_id: button.givenergy_REDACTED_reboot_invertor

  # If not using REST then instead set the Control here (one for each inverter)
  # You should keep this section even when using REST as a fallback if it fails and for charge curve calculations
  charge_rate:
  - number.givenergy_REDACTED_battery_charge_rate
  discharge_rate:
  - number.givenergy_REDACTED_battery_discharge_rate
  battery_power:
  - sensor.givenergy_REDACTED_battery_power
  pv_power:
  - sensor.givenergy_REDACTED_pv_power
  load_power:
  - sensor.givenergy_REDACTED_load_power
  grid_power:
  - sensor.givenergy_REDACTED_grid_power
  soc_kw:
  - sensor.givenergy_REDACTED_soc_kwh
  soc_max:
  - sensor.givenergy_REDACTED_battery_capacity_kwh
  reserve:
  - number.givenergy_REDACTED_battery_power_reserve
  inverter_mode:
  - select.givenergy_REDACTED_mode
  inverter_time:
  - sensor.givenergy_REDACTED_invertor_time
  charge_start_time:
  - select.givenergy_REDACTED_charge_start_time_slot_1
  charge_end_time:
  - select.givenergy_REDACTED_charge_end_time_slot_1
  charge_limit:
  - number.givenergy_REDACTED_target_soc
  scheduled_charge_enable:
  - switch.givenergy_REDACTED_enable_charge_schedule
  scheduled_discharge_enable:
  - switch.givenergy_REDACTED_enable_discharge_schedule
  discharge_start_time:
  - select.givenergy_REDACTED_discharge_start_time_slot_1
  discharge_end_time:
  - select.givenergy_REDACTED_discharge_end_time_slot_1

  # Defines the battery reserve percentage for inverter 1, i.e. the minimum charge level that should be retained in the battery
  set_reserve_min: 10

  #Battery temperature sensor per inverter, used outside REST mode to get current temperature
  battery_temperature:
   - sensor.givenergy_REDACTED_battery_temperature

  # Battery temperature history, only one for modelling, used to predict future temperature
  battery_temperature_history:
   - sensor.givenergy_battery_stack_1_bms_temperature

  # Battery temperature charge adjustment curve
  # Specific in C which is a multiple of the battery capacity
  # e.g. 0.33 C is 33% of the battery capacity
  # values unspecified will be assumed to be 1.0 hence rate is capped by max charge rate
  #battery_temperature_charge_curve:
  #  19: 0.33
  #  18: 0.33
  #  17: 0.33
  #  16: 0.33
  #  15: 0.33
  #  14: 0.33
  #  13: 0.33
  #  12: 0.33
  #  11: 0.33
  #  10: 0.25
  #  9: 0.25
  #  8: 0.25
  #  7: 0.25
  #  6: 0.25
  #  5: 0.25
  #  4: 0.25
  #  3: 0.25
  #  2: 0.25
  #  1: 0.15
  #  0: 0.00

  # Inverter max AC limit (one per inverter). E.g for a 3.6kw inverter set to 3600
  # If you have a second inverter for PV only please add the two values together
  inverter_limit:
  - 3600

  # Some inverters don't turn off when the rate is set to 0, still charge or discharge at around 200w
  # The value can be set here in watts to model this (doesn't change operation)
  #inverter_battery_rate_min:
  #  - 200

  # Some batteries tail off their charge rate at high soc%
  # enter the charging curve here as a % of the max charge rate for each soc percentage.
  # the default is 1.0 (full power)
  #
  # Predbat can compute this curve automatically if you have enough data, restart the add-on and look in the logfile for the data
  # once set here Predbat will no longer re-compute the curve.
  # Can also be set to 'auto' to just use the calculation curve, not recommended if you are using low power charging mode.
  battery_charge_power_curve:
    90 : 0.99
    91 : 0.85
    92 : 0.73
    93 : 0.64
    94 : 0.56
    95 : 0.48
    96 : 0.35
    97 : 0.27
    98 : 0.18
    99 : 0.12
    100 : 0.12
  #battery_discharge_power_curve:
  #  4 : 1.0

  set_charge_low_power: true

  # Inverter clock skew in minutes, e.g. 1 means it's 1 minute fast and -1 is 1 minute slow
  # Separate start and end options are applied to the start and end time windows, mostly as you want to start late (not early) and finish early (not late)
  # Separate discharge skew for discharge windows only
  inverter_clock_skew_start: 0
  inverter_clock_skew_end: 0
  inverter_clock_skew_discharge_start: 0
  inverter_clock_skew_discharge_end: 0

  # Clock skew adjusts the Appdaemon time
  # This is the time that Predbat takes actions like starting discharge/charging
  # Only use this for workarounds if your inverter time is correct but Predbat is somehow wrong (AppDaemon issue)
  # 1 means add 1 minute to AppDaemon time, -1 takes it away
  clock_skew: 0

  # Set these to match solcast sensor names if not using the cloud interface
  # The regular expression (re:) makes the solcast bit optional
  # If these don't match find your own names in Home Assistant
  pv_forecast_today: sensor.solcast_pv_forecast_forecast_today
  pv_forecast_tomorrow: sensor.solcast_pv_forecast_forecast_tomorrow
  pv_forecast_d3: sensor.solcast_pv_forecast_forecast_day_3
  pv_forecast_d4: sensor.solcast_pv_forecast_forecast_day_4

  # Defines the number of cars modelled by the system, set to 0 for no car
  num_cars: 0

  # Carbon Intensity data from National grid
  carbon_postcode: 'REDACTED'
  carbon_automatic: True

  # Octopus saving session points to the saving session Sensor in the Octopus plugin, when enabled saving sessions will be at the assumed
  # Rate is read automatically from the add-in and converted to pence using the conversion rate below (default is 8)
  octopus_saving_session: 'binary_sensor.octopus_energy_REDACTED_octoplus_saving_sessions'
  octopus_saving_session_octopoints_per_penny: 8

  # Octopus free session points to the free session Sensor in the Octopus plugin
  # Note: You must enable this event sensor in the Octopus Integration in Home Assistant for it to work
  octopus_free_session: 'event.octopus_energy_REDACTED_octoplus_free_electricity_session_events'

  # Energy rates
  # Please set one of these three, if multiple are set then Octopus is used first, second rates_import/rates_export and latest basic metric

  # Set import and export entity to point to the Octopus Energy plugin import and export sensors
  # automatically matches your meter number assuming you have only one (no need to edit the below)
  # Will be ignored if you don't have the sensor but will error if you do have one and it's incorrect
  # NOTE: To get detailed energy rates you need to go in and manually enable the following events in HA
  #       event.octopus_energy_electricity_xxxxxxxx_previous_day_rates
  #       event.octopus_energy_electricity_xxxxxxxx_current_day_rates
  #       event.octopus_energy_electricity_xxxxxxxx_next_day_rates
  # and if you have export enable:
  #       event.octopus_energy_electricity_xxxxxxxx_export_previous_day_rates
  #       event.octopus_energy_electricity_xxxxxxxx_export_current_day_rates
  #       event.octopus_energy_electricity_xxxxxxxx_export_next_day_rates
  # Predbat will automatically find the event. entities from the link below to the sensors
  metric_octopus_import: 'sensor.octopus_energy_electricity_REDACTED_current_rate'
  metric_octopus_export: 'sensor.octopus_energy_electricity_REDACTED_export_current_rate'

  # Standing charge in pounds, can be set to a sensor or manually entered (e.g. 0.50 is 50p)
  # The default below will pick up the standing charge from the Octopus Plugin
  # The standing charge only impacts the cost graphs and doesn't change the way Predbat plans
  # If you don't want to show the standing charge then just delete this line or set to zero
  metric_standing_charge: 'sensor.octopus_energy_electricity_REDACTED_current_standing_charge'

  # For pv estimate, leave blank for central estimate, or add 10 for 10% curve (worst case) or 90 or 90% curve (best case)
  # If you use 10 then disable pv_metric10_weight below
  # pv_estimate: 10

  # Days previous is the number of days back to find historical load data
  # Recommended is 7 to capture day of the week but 1 can also be used
  # if you have more history you could use 7 and 14 (in a list) but the standard data in HA only lasts 10 days
  days_previous: 7

  # Days previous weight can be used to control the weighting of the previous load points, the values are multiplied by their
  # weights and then divided through by the total weight. E.g. if you used 1 and 0.5 then the first value would have 2/3rd of the weight and the second 1/3rd
  # Include one value for each days_previous value, each weighting on a separate line.
  # If any days_previous's that are not given a weighting they will assume a default weighting of 1.
  days_previous_weight: 1

  # Number of hours forward to forecast, best left as-is unless you have specific reason
  forecast_hours: 48

  # Specify the devices that notifies are sent to, the default is 'notify' which goes to all
  #notify_devices:
  #  - mobile_app_treforsiphone12_2

  # Battery scaling makes the battery smaller (e.g. 0.9) or bigger than its reported
  # If you have an 80% DoD battery that falsely reports it's kwh then set it to 0.8 to report the real figures
  # One per inverter
  battery_scaling: 1.0

  # Can be used to scale import and export data, used for workarounds
  import_export_scaling: 1.0

  # Export triggers:
  # For each trigger give a name, the minutes of export needed and the energy required in that time
  # Multiple triggers can be set at once so in total you could use too much energy if all run
  # Creates an entity called 'binary_sensor.predbat_export_trigger_<name>' which will be turned On when the condition is valid
  # connect this to your automation to start whatever you want to trigger
  export_triggers:
  - name: 'large'
    minutes: 60
    energy: 1.0
  - name: 'medium'
    minutes: 30
    energy: 0.5
  - name: 'small'
    minutes: 15
    energy: 0.25

  # Tariff comparison feature
  # Adjust this list to the tariffs you want to compare, include your current tariff also
  # Octopus region code (https://energy-stats.uk/dno-region-codes-explained/)
  octopus_region: 'REDACTED'
  compare_list:
  #  - id: 'current'
  #    name: 'Current Tariff'
  #  - id: 'cap_seg'
  #    name: 'Price cap import/Seg export'
  #    rates_import:
  #       - rate: 24.86
  #    rates_export:
  #       - rate: 4.1
    - id: 'agile_fixed'
      name: 'Agile import/Fixed export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-24-10-01/electricity-tariffs/E-1R-AGILE-24-10-01-{octopus_region}/standard-unit-rates/'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-{octopus_region}/standard-unit-rates/'
    - id: 'agile_agile'
      name: 'Agile import/Agile export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-24-10-01/electricity-tariffs/E-1R-AGILE-24-10-01-{octopus_region}/standard-unit-rates/'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-OUTGOING-19-05-13/electricity-tariffs/E-1R-AGILE-OUTGOING-19-05-13-{octopus_region}/standard-unit-rates/'
    - id: 'flux'
      name: 'Flux import/Export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/FLUX-IMPORT-23-02-14/electricity-tariffs/E-1R-FLUX-IMPORT-23-02-14-{octopus_region}/standard-unit-rates/'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/FLUX-EXPORT-23-02-14/electricity-tariffs/E-1R-FLUX-EXPORT-23-02-14-{octopus_region}/standard-unit-rates/'
    - id: 'cosy_fixed_export'
      name: 'Cosy import/Fixed export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/COSY-22-12-08/electricity-tariffs/E-1R-COSY-22-12-08-{octopus_region}/standard-unit-rates'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-{octopus_region}/standard-unit-rates/'
    - id: 'fixed_cosy_fixed_export'
      name: 'Fixed Cosy import/Fixed export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/COSY-FIX-12M-25-09-24/electricity-tariffs/E-1R-COSY-FIX-12M-25-09-24-{octopus_region}/standard-unit-rates/'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-{octopus_region}/standard-unit-rates/'
    - id: 'cosy_agile_export'
      name: 'Cosy import/Agile export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/COSY-22-12-08/electricity-tariffs/E-1R-COSY-22-12-08-{octopus_region}/standard-unit-rates'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-OUTGOING-19-05-13/electricity-tariffs/E-1R-AGILE-OUTGOING-19-05-13-{octopus_region}/standard-unit-rates/'
    - id: 'fixed_cosy_agile_export'
      name: 'Fixed Cosy import/Agile export'
      rates_import_octopus_url: 'https://api.octopus.energy/v1/products/COSY-FIX-12M-25-09-24/electricity-tariffs/E-1R-COSY-FIX-12M-25-09-24-{octopus_region}/standard-unit-rates/'
      rates_export_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-OUTGOING-19-05-13/electricity-tariffs/E-1R-AGILE-OUTGOING-19-05-13-{octopus_region}/standard-unit-rates/'

  # Watch list, a list of sensors to watch for changes and then update the plan if they change
  # This is useful for things like the Octopus Intelligent Slot sensor so that the plan update as soon as you plugin in
  # Only uncomment the items you actually have set up above in apps.yaml, of course you can add your own as well
  # Note those using +[] are lists that are appended to this list, whereas {} items are single items only
  watch_list:
    - '{octopus_saving_session}'

  predheat:
    # Days forward
    forecast_days: 2

    # Days previous is the number of days back to find historical load data
    # Recommended is 7 to capture day of the week but 1 can also be used
    # if you have more history you could use 7 and 14 (in a list) but the standard data in HA only lasts 10 days
    days_previous: 7

    # Gas or heatpump mode ('gas' or 'pump')
    mode: pump

    # External temperature sensor
    external_temperature: sensor.outdoor_temperature

    # Internal temperature sensor(s)
    internal_temperature: sensor.heating_zone_current_temperature

    # Weather data
    weather: weather.met_office_REDACTED

    # Sensor with history that monitors the thermostat setting in the house
    target_temperature: sensor.heating_zone_desired_temperature

    # Thermostat Hysteresis turn on amount in degrees (default 0.5)
    hysteresis: 0.5

    # Thermostat Hysteresis turn off amount in degrees (default 0.1)
    hysteresis_off: 0.1

    # When true models a smart thermostat that turns the heating ahead of the target temperature so it reaches it just in time
    smart_thermostat: false

    # Past energy consumption of heating in KWh, scaled with heating_energy_scaling
    heating_energy: sensor.arotherm_plus_consumed_electrical_energy_heating

    # Heating is turned on history
    heating_active: sensor.heating_circuit_state

    # House heat loss in watts per degrees temp difference
    heat_loss_watts: 94

    # Static heat sources in the house (e.g. people/equipment)
    heat_gain_static: 200

    # House heat loss in degrees per hour per degree temp difference
    heat_loss_degrees: 0.030

    # Heating max output (of the radiators), in Watts at delta 50 (BTU / 3.41)
    heat_output: 6044

    # Add up radiator volume + any pipework or expansion vessel
    heat_volume: 132

    # Heating max power in Watts
    heat_max_power: 4200
    heat_min_power: 2200

    # Heating cop is the maximum efficiency and will be scaled down based on temperatures
    # put 1.0 for condensing gas boilers, or around 4.0 for heat pumps
    heat_cop: 3.37

    # Current flow temperature setting
    flow_temp: sensor.heating_curcuit_current_flow_temperature
    flow_difference_target: 5

    weather_compensation:
      -20: 56
      -10: 49
      0: 42
      10: 34
      20: 23

    # Sets the conversion factors between the delta T50°C and other delta T values
    #delta_correction:
    #  75: 1.69
    #  70: 1.55
    #  65: 1.41
    #  60: 1.27
    #  55: 1.13
    #  50: 1
    #  45: 0.87
    #  40: 0.75
    #  35: 0.63
    #  30: 0.51
    #  25: 0.41
    #  20: 0.3
    #  15: 0.21
    #  10: 0.12
    #  5: 0.05
    #  0: 0.00

    # Sets the efficiency of a heat pump in COP at different input temperatures
    #heat_pump_efficiency:
    #  -20: 2.10
    #  -18: 2.15
    #  -16: 2.2
    #  -14: 2.25
    #  -12: 2.3
    #  -10: 2.4
    #  -8: 2.5
    #  -6: 2.6
    #  -4: 2.7
    #  -2: 2.8
    #  0: 2.9
    #  2: 3.1
    #  4: 3.3
    #  6: 3.6
    #  8: 3.8
    #  10: 3.9
    #  12: 4.1
    #  14: 4.3
    #  16: 4.3
    #  18: 4.3
    #  20: 4.3
G
#3 geoffreycoan

There isn't a great deal you will need to do. I would shut HA and Predbat down whilst the inverter is being recommissioned to stop predbat trying to interfere and getting confused.

Removing the battery charge and discharge curves, good idea, but until you have 7 days of history with the new batteries predbat will create the curves based on the old battery history. Suggest you instead manually set the curves to:

battery_charge_power_curve:
    100 : 1.0
  battery_discharge_power_curve:
    4 : 1.0

to tell predbat its full rate charging to max and min, and then when you have built up history, comment these out to generate new correct curves.

I do notice one issue with your apps.yaml:

pwdst ge_cloud_data: false
ge_cloud_serial: 'REDACTED'
ge_cloud_key: 'REDACTED.REDACTED.REDACTED'

You have set both givtcp entities and a ge_cloud configuration. Predbat will be using the givtcp load_energy, pv_energy, etc, but as you have configured a ge_cloud_serial and key then all communication to/from the inverter will be via the givenergy cloud, i.e. not local via givtcp.
Is that your intent?

P
#4 pwdst

That was set when there was a bug with resetting not happening exactly at midnight with GivTCP which was causing problems. I had toggled cloud_data to false after the bug was resolved but if that isn't sufficient to use GivTCP then I will remove the block entirely.

G
#5 geoffreycoan

pwdst no its not, I discovered that simply setting a ge_cloud_key, predbat will use it regardless of anything else!