Page 1 of 1

Sample apps.yaml file for predbat & Fox

Posted: Wed Feb 18, 2026 2:18 pm
by WyndStryke
Here's an example predbat apps.yaml file - but don't rely on it alone (also look at the example Fox template on the github).

Code: Select all

pred_bat:
  module: predbat
  class: PredBat

# Based on the KH7 inverter, EC4300-H battery, and Octopus tariffs.  Adjust as needed
# for your inverter, battery, and tariff.
#
# NECESSARY:
#
# If you used a 'friendly name' when configuring your sensors, for example 'Fox', then the sensor names
# will all start with 'fox_' (e.g., sensor.fox_battery_soc).
#
# Check your firmware version to ensure that BMS sensors and Back-up work-mode are supported.
#
# Temperature charge curve either needs to be recalculated for your batteries voltage (or
# commented out)
#    battery_temperature_charge_curve
#
# Similar with the battery_charge_power_curve (battery charge speed throttling near 100% SoC)
#
# Predbat settings:
#  * input_number.predbat_set_reserve_min should be set to 10% (90% DoD), as a minimum.
#       This is a hard limit, below this the system will draw from the grid.
#  * input_number.predbat_best_soc_min should be set to the kWh equivalent of 10% (90% DoD),
#       as a minimum
#  * input_number.predbat_best_soc_keep should be set to the kWh equivalent of a few % above
#       both the soc_min and reserve_min (I'd suggest 15 or 20%).  This is a soft limit so the
#       system will drop below it sometimes.
#
# Remember to remove 'template: true' once you are happy with the configuration.
#
# Battery_rate_max - Often higher than the inverter rating, check inverter & battery data sheets.
# inverter_limit - as per inverter rating (e.g., 7000 for KH7)
# export_limit - Optional, set this if the G100 export limit is lower than the inverter limit
# inverter_limit_charge & inverter_limit_discharge - set to inverter rating, or battery charge/
#    discharge rate if lower.
#
# OPTIONAL:
#
# Install the carbon_intensity_uk integration as per predbat instructions, set#
#   input_number.predbat_carbon_metric and enable switch.predbat_carbon_enable.
#
# input_number.predbat_metric_battery_cycle can be set to (e.g.) 1p/kWh to represent the cost
#   of battery cycling.
#
# Increase history retention to 15 or 22 days in Homeassistant/configuration.yaml (this will
#   allow two or 3 weeks of data to be used for load estimation, since normally only 10 days
#   are stored). e.g.:
#  recorder:
#    purge_keep_days: 15  (or 22)
#
# If too  much history is stored then the database size will escalate, this can be fixed by
#   purging less important sensors earlier via an automation which runs overnight.
#
# Periodic SoC Calibration - Needs an automation - track the times, and set min_soc, max_soc,
#   etc as needed  Fox inverters do not automatically calibrate.  Recommendation, at least once
#   every 7 days the battery should hit the 100% SoC mark, and at least monthly the battery
#   hit the 10% mark.


  # 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'

  # Days previous is the number of days back to find historical load data.  By
  # default this is 7 to capture load data from the previous day of the week,
  # if you have more history you could use 14 and 21.
  # https://springfall2008.github.io/batpred/apps-yaml/#days_previous
  # Average load data over previous 3 weeks for any given week day.  
  days_previous:
  - 7
  - 14
  - 21

  # 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

  # XXX: This is a configuration template, delete this line once you edit your configuration
  template: True

  # 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
  #
  # 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.load_energy_today
  import_today:
  - sensor.grid_consumption_energy_today
  export_today:
  - sensor.feed_in_energy_today
  pv_today:
  - sensor.solar_energy_today
  grid_power:
  - sensor.grid_ct


  # 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
  #


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

  inverter_type: FoxESS
  inverter:
    name: "FoxESS"
    has_rest_api: false
    has_mqtt_api: false
    has_service_api: true
    output_charge_control: "power"
    has_charge_enable_time: false
    has_discharge_enable_time: false

    # Theoretically Target SoC should be configured with number.max_soc but this causes issues because
    # target_soc is not automatically reset to 100% after use by switch.predbat_inverter_soc_reset, and
    # this blocks all charging.
    has_target_soc: false

    # Reserve SoC will be configured with number.min_soc_on_grid
    has_reserve_soc: true

    charge_time_format: "S"
    charge_time_entity_is_option: false
    soc_units: "%"
    num_load_entities: 1
    has_ge_inverter_mode: false
    time_button_press: false
    clock_time_format: "%Y-%m-%d %H:%M:%S"
    write_and_poll_sleep: 2
    has_time_window: false
    support_charge_freeze: true
    support_discharge_freeze: true


# Predbat statuses versus Fox work-modes
#
# PREDBAT           FOX
# Demand (Eco)      Self-Use
# This is the default, the load will be covered by solar and/or battery. Excess solar will
# charge the battery or be exported if the battery is full. This is described as 'Eco' Mode
# for GivEnergy inverters but other inverters use different terminology.
#
# Charging          Force Charge
# The battery charges from the grid and the grid also covers any load. Solar power will
# also be used to charge the battery.
#
# Freeze charging   Back-up (with reserve soc set to number.min_soc_on_grid)
# The battery is charging but the current battery level (SoC) is frozen (held). Think of
# it as a charge to the current battery level. The grid or solar covers any house load. 
# If there is a shortfall of Solar power to meet house load, the excess house load is met
# from grid import, but if there is excess Solar power above the house load, the excess 
# solar will be used to charge the battery,
#
# Hold charging     Back-up (with reserve soc set to number.min_soc_on_grid)
# A type of charge where the target SoC % is the same as the current SoC %, effectively the
# same as a charge freeze (but without being explicitly selected).
#
# No Charge         Self use
# A charge where the target SoC % is lower than the current battery SoC level so there will
# be no charging unless the usage is unexpectedly high.
#
# Exporting         Force Discharge 
# The battery is being force-discharged. The house load will be covered by the battery and
# any excess is exported to the grid. Any solar generated will be exported.
#
# Freeze exporting  Feed-in First 
# The battery is in demand mode, but with charging disabled. The battery or solar covers the
# house load. As charging is disabled, if there is excess solar generated, the current SoC
# level will be held and the excess solar will be exported. If there is a shortfall of
# generated solar power to meet the house load, the battery will discharge to meet the extra
# load.
#
# Hold exporting    Self use
# The plan was to force export but the minimum battery level was reached and thus the battery
# is kept in Demand mode. If the battery level again gets above the threshold it will be changed
# back to Export mode.
#
# Calibration       Needs an automation
# Fox inverters do not automatically calibrate, so to do this an automation is needed if required.
# At least once every 7 days the battery should hit the 100% SoC mark.  This can be done by setting
# the predbat min_keep, etc as needed if too much time has passed. 
#
# Error
# If there is a configuration error or other problem, you should check the Predbat log file for more
# details.

  # Services to control charging/discharging
  # charge_start_service - Should be set to a service that is called when charging starts
  charge_start_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Force Charge"

  # charge_freeze_service - If your inverter supports charge freeze set to a service that starts this mode
  # The Back-up work mode does not exist on older firmware versions
  charge_freeze_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Back-up"

 # charge_stop_service - Should be set to a service that is called when charging/charge freeze stops
  charge_stop_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Self Use"

  # discharge_start_service - Should be set to a service that is called when force export (discharge) starts
  discharge_start_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Force Discharge"

  # discharge_stop_service - Should be set to a service that is called when export/export freeze stops
  discharge_stop_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Self Use"

  # discharge_freeze_service - If your inverter supports export freeze set to a service that starts this mode
  discharge_freeze_service:
    service: select.select_option
    entity_id: select.work_mode
    option: "Feed-in First"

  #
  # Run balance inverters every N seconds (0=disabled) - only for multi-inverter
  #balance_inverters_seconds: 60
  #
  # When set use the REST API rather than HA entity for control, should be more reliable/faster to control
  # Set one per inverter
  # If using Docker then change homeassistant.local to the Docker IP address


  # 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.force_charge_power
  discharge_rate:
  - number.force_discharge_power
  pv_power:
  - sensor.pv_power
  battery_power:
  - sensor.invbatpower
  battery_voltage:
  - sensor.invbatvolt
  load_power:
  - sensor.load_power


  soc_percent:
  - sensor.battery_soc

  # NOTE: RECENT FIRMWARE NEEDED for bms_kwh_remaining (total battery capacity after considering 
  #       state-of-health.  Old firmware used this for soc_kwh.  If not available then just put 
  #       in the nominal battery size in kWh (not the usable size) as a constant rather than as 
  #       a sensor.
  soc_max:
  - sensor.bms_kwh_remaining

  # battery_rate_max is the theoretical maximum charge speed of the battery itself (not the inverter),
  # this will vary therefore needs to be calculated.
  #
  # For example, KH7 50 amps max, ECS4300-H4 battery is 230 volts nominal, therefore 50x230=11500
  # It is likely to be more than the inverter itself can supply from AC.
  battery_rate_max:
  - 11500

  # Reserve SoC is used for Freeze Charge and Hold Charge modes.  This must never be set to less than 10%
  # (to match 90% DoD) and preferably a little higher to be safe.  
  # Also see the predbat setting input_number.predbat_set_reserve_min which should be set to 10 minimum, 
  # and input_number.predbat_best_soc_min which needs to be set >= kWh equivalent of that.
  reserve:
  - number.min_soc_on_grid

  # charge_limit needed if target_soc is enabled (for freeze-charging).  However, if configured
  # with number.max_soc, it will block all charging during the day because it does not reset to
  # 100% despite switch.predbat_inverter_soc_reset being set on. 
  # charge_limit:
  # - number.max_soc

  # Original did not contain this line.  Needed because battery is 90% DoD, and we must never drop below that.    
  battery_min_soc:
  - sensor.min_soc

  # 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:
  - 7000

  # Export limit is a software limit set on your inverter that prevents exporting above a given level
  # When enabled Predbat will model this limit.  If inverter_limit is the same as export_limit, this
  # line is not needed.
  #export_limit:
  # - 7000

  # Maximum speed of the inverter for charging and discharging the battery, for Fox this will be the same as the inverter_limit.
  # Optionally can be lowered if the user wishes to reduce battery degradation.
  inverter_limit_charge:
  - 7000
  inverter_limit_discharge:
  - 7000

  # The battery charge rate will drop as it nears 100%. 
  # Enter the charging curve here as a % of the max charge rate for each soc percentage.
  # the default is 1.0 (full power)
  #  Based on the ECS4800 Charge curve with 50Amps as 1.0 https://www.foxesscommunity.com/viewtopic.php?p=4554#p4554  (Linear from 80%-97% then drops abruptly).
  battery_charge_power_curve:
    100: 0.05
    99: 0.10
    98: 0.20
    97: 0.32
    96: 0.36
    95: 0.40
    94: 0.44
    93: 0.48
    92: 0.52
    91: 0.56
    90: 0.60
    89: 0.64
    88: 0.68
    87: 0.72
    86: 0.76
    85: 0.80
    84: 0.84
    83: 0.88
    82: 0.92
    81: 0.96

  # Note that these sensors are only available on recent Fox firmware, if unavailable then either
  #    comment out or get a firmware update.
  battery_temperature:
  - sensor.bms_cell_temp_low
  battery_temperature_history:
  - sensor.bms_cell_temp_low

  # 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 curve based on recent Fox ESS firmware, older firmware has a different curve.  
  #     https://www.youtube.com/watch?v=nDAw0KAYvcE&list=WL&index=86&t=328s
  #     Note that you will need to translate from Amps for your battery voltage + size.  If
  #     in doubt just comment out this section.
  battery_temperature_charge_curve:
  # 15-19c, 25 Amps max, EC4300-H4 = 230v + 16.58kWh, 25*230=5.75kW, 5.75/16.58 = 0.344C
    19: 0.344
    18: 0.344
    17: 0.344
    16: 0.344
    15: 0.344
  # 10-14c, 15 Amps max, EC4300-H4 = 230v + 16.58kWh, 15*230=3.45kW, 3.45/16.58 = 0.208C
    14: 0.208
    13: 0.208
    12: 0.208
    11: 0.208
    10: 0.208
  # 5-9c, 10 Amps max, EC4300-H4 = 230v + 16.58kWh, 10*230=2.3kW, 2.3/16.58 = 0.139
    9: 0.139
    8: 0.139
    7: 0.139
    6: 0.139
    5: 0.139
  # 0-4c, 5 Amps max, EC4300-H4 = 230v + 16.58kWh, 5*230=1.15kW, 1.15/16.58 = 0.0688C
    4: 0.069
    3: 0.069
    2: 0.069
    1: 0.069
    0: 0.069

  # 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
  # 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

  # car_charging_energy defines an incrementing sensor which measures the charge added to your car
  # is used for car_charging_hold feature to filter out car charging from the previous load data
  # Automatically set to detect Wallbox and Zappi, if it doesn't match manually enter your sensor name
  # Also adjust car_charging_energy_scale if it's not in kwH to fix the units
  car_charging_energy: 're:(sensor.myenergi_zappi_[0-9a-z]+_charge_added_session|sensor.wallbox_portal_added_energy)'

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

  # If you have Octopus intelligent, enable the intelligent slot information to add to pricing
  # Will automatically disable if not found, or comment out to disable fully
  # When enabled it overrides the 'car_charging_planned' feature and predict the car charging based on the intelligent plan (unless octopus intelligent charging is False)
  # This matches either the intelligent slot from the Octopus Plugin or from the Intelligent plugin
  octopus_intelligent_slot: 're:(binary_sensor.octopus_intelligent_slot|re:binary_sensor.octopus_energy_intelligent_dispatching)'
  octopus_ready_time: 're:(time.octopus_energy_([0-9a-z_]+|)_intelligent_target_time)'
  octopus_charge_limit: 're:(number.octopus_energy([0-9a-z_]+|)_intelligent_charge_target)'

  # Example alternative configuration for Ohme integration release >=v0.6.1
  # octopus_intelligent_slot: 'binary_sensor.ohme_slot_active'
  # octopus_ready_time: 'time.ohme_target_time'
  # octopus_charge_limit: 'number.ohme_target_percent'

  # 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: 're:(binary_sensor.octopus_energy([0-9a-z_]+|)_saving_session(s|))'
  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: 're:(event.octopus_energy_([0-9a-z_]+|)_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_18l2072347_1900021028724_current_rate'
  metric_octopus_export: 're:(sensor.(octopus_energy_|)electricity_[0-9a-z]+_[0-9a-z]+_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: 're:(sensor.(octopus_energy_|)electricity_[0-9a-z]+_[0-9a-z]+_current_standing_charge)'

  # Or set your actual rates across time for import and export
  # If start/end is missing it's assumed to be a fixed rate
  # Gaps are filled with zero rate
  #rates_import:
  #  -  start: "00:30:00"
  #     end: "04:30:00"
  #     rate: 7.5
  #  -  start: "04:30:00"
  #     end: "00:30:00"
  #     rate: 40.0
  #
  #rates_export:
  #  -  rate: 4.2

  # Based on E-on Next Drive import + E-on export, replace with your own tariff details (or use
  # the Octopus API calls)
#  rates_import:
#  - start: "00:00:00"
#    end: "07:00:00"
#    rate: 6.7
#  - start: "07:00:00"
#    end: "00:00:00"
#    rate: 25.41
#  rates_export:
#  - rate: 6.0


  # Tariff comparison feature
  # Adjust this list to the tariffs you want to compare, include your current tariff also
  compare_list:
  - id: 'current'
    name: 'Current tariff'
  - id: 'eon_drive_v10'
    name: 'E-on Next Drive v10'
    rates_import:
    - start: "00:00:00"
      end: "06:00:00"
      rate: 7.5
    - start: "06:00:00"
      end: "00:00:00"
      rate: 29.0
    rates_export:
    - rate: 6
  - id: 'eon_smart_drive'
    name: 'E-on Next Smart Drive v5'
    rates_import:
    - start: "00:00:00"
      end: "06:00:00"
      rate: 6.5
    - start: "06:00:00"
      end: "00:00:00"
      rate: 27.55
    rates_export:
    - rate: 6
  - id: 'bg_elec_driver'
    name: 'BG Electric Driver'
    rates_import:
    - start: "00:00:00"
      end: "05:00:00"
      rate: 7.9
    - start: "05:00:00"
      end: "00:00:00"
      rate: 27.0
    rates_export:
    - rate: 15.1
  - id: 'good_energy_ev'
    name: 'Good Energy EV'
    rates_import:
    - start: "00:00:00"
      end: "05:00:00"
      rate: 8
    - start: "05:00:00"
      end: "00:00:00"
      rate: 33.03
    rates_export:
    - rate: 15
  - id: 'igo_fixed'
    name: 'Intelligent GO import/Fixed export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-VAR-24-10-29/electricity-tariffs/E-1R-INTELLI-VAR-24-10-29-J/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-J/standard-unit-rates/'
  - id: 'igo_agile'
    name: 'Intelligent GO import/Agile export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-VAR-24-10-29/electricity-tariffs/E-1R-INTELLI-VAR-24-10-29-J/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-J/standard-unit-rates/'
  - id: 'go_fixed'
    name: 'GO import/Fixed export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/GO-VAR-22-10-14/electricity-tariffs/E-1R-GO-VAR-22-10-14-J/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-J/standard-unit-rates/'
  - id: 'go_agile'
    name: 'GO import/Agile export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/GO-VAR-22-10-14/electricity-tariffs/E-1R-GO-VAR-22-10-14-J/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-J/standard-unit-rates/'
  - id: 'go_no_export'
    name: 'GO import/No export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/GO-VAR-22-10-14/electricity-tariffs/E-1R-GO-VAR-22-10-14-J/standard-unit-rates/'
    rates_export:
    - rate: 6
  - id: 'smartsaver'
    name: 'E-on Next Smart Saver'
    rates_import:
    - start: "00:00:00"
      end: "02:00:00"
      rate: 20.43
    - start: "02:00:00"
      end: "05:00:00"
      rate: 16.33
    - start: "05:00:00"
      end: "16:00:00"
      rate: 20.43
    - start: "16:00:00"
      end: "19:00:00"
      rate: 40.72
    - start: "19:00:00"
      end: "00:00:00"
      rate: 20.43
    rates_export:
    - rate: 6
  - 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-J/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-J/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-J/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-J/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-J/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-J/standard-unit-rates'
  - id: 'iflux'
    name: 'Intelligent Flux import/Export'
    rates_import_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-FLUX-IMPORT-23-07-14/electricity-tariffs/E-1R-INTELLI-FLUX-IMPORT-23-07-14-J/standard-unit-rates/'
    rates_export_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-FLUX-EXPORT-23-07-14/electricity-tariffs/E-1R-INTELLI-FLUX-EXPORT-23-07-14-J/standard-unit-rates/'
  - id: 'good_energy_hp'
    name: 'Good Energy HP'
    rates_import:
    - start: "00:00:00"
      end: "05:00:00"
      rate: 30.36
    - start: "05:00:00"
      end: "09:00:00"
      rate: 12
    - start: "09:00:00"
      end: "13:00:00"
      rate: 30.6
    - start: "13:00:00"
      end: "16:00:00"
      rate: 12
    - start: "16:00:00"
      end: "00:00:00"
      rate: 30.6
    rates_export:
    - rate: 15
  - id: 'cosy_fixed'
    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-J/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-J/standard-unit-rates/'
  - id: 'cosy_agile'
    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-J/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-J/standard-unit-rates/'

  # Can be used instead of the plugin to get import rates directly online
  # Overrides metric_octopus_import and rates_import
  # rates_import_octopus_url : "https://api.octopus.energy/v1/products/FLUX-IMPORT-23-02-14/electricity-tariffs/E-1R-FLUX-IMPORT-23-02-14-A/standard-unit-rates"
  # rates_import_octopus_url : "https://api.octopus.energy/v1/products/AGILE-24-10-01/electricity-tariffs/E-1R-AGILE-24-10-01-A/standard-unit-rates"

  # Overrides metric_octopus_export and rates_export
  # rates_export_octopus_url: "https://api.octopus.energy/v1/products/FLUX-EXPORT-BB-23-02-14/electricity-tariffs/E-1R-FLUX-EXPORT-BB-23-02-14-A/standard-unit-rates"
  # rates_export_octopus_url: "https://api.octopus.energy/v1/products/AGILE-OUTGOING-BB-23-02-28/electricity-tariffs/E-1R-AGILE-OUTGOING-BB-23-02-28-A/standard-unit-rates/"
  # rates_export_octopus_url: "https://api.octopus.energy/v1/products/OUTGOING-FIX-12M-BB-23-02-09/electricity-tariffs/E-1R-OUTGOING-FIX-12M-BB-23-02-09-A/standard-unit-rates/"

  # Import rates can be overridden with rate_import_override
  # Export rates can be overridden with rate_export_override
  # Use the same format as above, but a date can be included if it just applies for a set day (e.g. Octopus power ups)
  # This will override even the Octopus plugin rates if enabled
  #
  #rates_import_override:
  # -  date: '2023-09-10'
  #    start: '14:00:00'
  #    end: '14:30:00'
  #    rate: 112
  #    load_scaling: 0.8

  # 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 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


  # 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: 'small'
    minutes: 15
    energy: 0.25

  # If you have a sensor that gives the energy consumed by your solar diverter then add it here
  # this will make the predictions more accurate. It should be an incrementing sensor, it can reset at midnight or not
  # It's assumed to be in Kwh but scaling can be applied if need be
  #iboost_energy_today: 'sensor.xxxxx'
  #iboost_energy_scaling: 1.0
  # Gas rates for comparison
  #metric_octopus_gas: 're:(sensor.(octopus_energy_|)gas_[0-9a-z]+_[0-9a-z]+_current_rate)'

  # Nordpool market energy rates
  #futurerate_url: 'https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?date=DATE&market=N2EX_DayAhead&deliveryArea=UK&currency=GBP'
  #futurerate_adjust_import: True
  #futurerate_adjust_export: False
  #futurerate_peak_start: "16:00:00"
  #futurerate_peak_end: "19:00:00"
  #futurerate_peak_premium_import: 14
  #futurerate_peak_premium_export: 6.5

  # 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_intelligent_slot}'
  # - '{octopus_ready_time}'
  # - '{octopus_charge_limit}'
  #  - '{octopus_saving_session}'
  #  - '+[car_charging_planned]'
  #  - '+[car_charging_soc]'
  #  - '{car_charging_now}'
  # Carbon Intensity data from National grid
  carbon_intensity: 're:(sensor.carbon_intensity_uk)'

  # Axle VPP configuration, documentation https://springfall2008.github.io/batpred/components/#axle-energy-vpp-axle
  # Configure for events-only.
  # The only mandatory configuration is axle_api_key, all others will be defaulted appropriately.
  # The API key is available on the 'home assistant' link from the Axle account page.  Sets your API key to communicate with the Axle Energy VPP (Virtual Power Plant) service
  #axle_api_key: 
  #  eyJ312490876892376882376823768237682376823768237692038erjdfhgujeadhfgbujeahgu123 96872398675k
  # axle_pence_per_kwh:  Sets the payment rate in pence per kWh for Axle Energy VPP events (optional, default: 100)
  #axle_pence_per_kwh: 100
  # axle_session: Optional, enables you to manually configure the Axle binary sensor name if you don't wish to use the Predbat default
  # axle_automatic - When True (default) automatically uses *binary_sensor.predbat_axle_event* as the binary_sensor which gives details of current and historic Axle events
  #axle_automatic: true
  #axle_control: Optional, when set to True will set Predbat into Read-Only mode for the duration of the Axle session so Axle can control your inverter.  Defaults to False so Predbat will control import and export of your inverter according to the Axle session details
  axle_control: false

  # 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.
  # If you update any predbat settings via automations, add them here.
  watch_list:
  - sensor.solcast_pv_forecast_forecast_today
#    - '{octopus_intelligent_slot}'
#    - '{octopus_ready_time}'
#    - '{octopus_charge_limit}'
#    - '{octopus_saving_session}'
#    - '+[car_charging_planned]'
#    - '+[car_charging_soc]'
#    - '{car_charging_now}'

  load_ml_enable: true
  temperature_enable: "True"