Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help please :-D #1886

Open
Ryuisnod opened this issue Jan 20, 2025 · 22 comments
Open

help please :-D #1886

Ryuisnod opened this issue Jan 20, 2025 · 22 comments
Labels
configuration User configuration issue

Comments

@Ryuisnod
Copy link

Ryuisnod commented Jan 20, 2025

hello,

I feel I've got everything set up correctly but my predbat plan doesn't include any charging or exporting, I have been reading through the Docs for about 2 days checking every setting, any help will be appreciated as im lost. The plan looks reasonable if it only charges my battery!

Image

Image

Image

pred_bat:
  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

  # If you are using Predbat outside of HA then set the HA URL and Key (long lived access token here)
  #ha_url: 'http://homeassistant.local:8123'
  #ha_key: 'xxx'

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

  # 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.givtcp_{geserial}_load_energy_today_kwh
  import_today:
    - sensor.givtcp_{geserial}_import_energy_today_kwh
  export_today:
    - sensor.givtcp_{geserial}_export_energy_today_kwh
  pv_today:
    - sensor.givtcp_{geserial}_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: '{geserial}'
  ge_cloud_key: 'xxxx'
  #
  # 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: 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
  givtcp_rest:
    - 'http://homeassistant.local:6345'
    - 'http://homeassistant.local:6346'

  # 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: switch.givtcp_{geserial}_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.givtcp_{geserial}_battery_charge_rate
    - number.givtcp2_{geserial2}_battery_charge_rate
  discharge_rate:
    - number.givtcp_{geserial}_battery_discharge_rate
    - number.givtcp2_{geserial2}_battery_discharge_rate
  battery_power:
    - sensor.givtcp_td2418g007_battery_power
    - sensor.givtcp2_{geserial2}_battery_power
  pv_power:
    - sensor.givtcp_{geserial}_pv_power
    - sensor.givtcp2_{geserial2}_pv_power
  load_power:
    - sensor.givtcp_{geserial}_load_power
    - sensor.givtcp2_{geserial2}_load_power
  soc_kw:
    - sensor.givtcp_{geserial}_soc_kwh
    - sensor.givtcp2_{geserial2}_soc_kwh
  soc_max:
    - sensor.givtcp_{geserial}_battery_capacity_kwh
    - sensor.givtcp2_{geserial2}_battery_capacity_kwh
  reserve:
    - number.givtcp_{geserial}_battery_power_reserve
    - number.givtcp2_{geserial2}_battery_power_reserve
  inverter_mode:
    - select.givtcp_{geserial}_mode
    - select.givtcp2_{geserial2}_mode
  inverter_time:
    - sensor.givtcp_{geserial}_invertor_time
    - sensor.givtcp2_{geserial2}_invertor_time
  charge_start_time:
    - select.givtcp_{geserial}_charge_start_time_slot_1
    - select.givtcp2_{geserial2}_charge_start_time_slot_1
  charge_end_time:
    - select.givtcp_{geserial}_charge_end_time_slot_1
    - select.givtcp2_{geserial2}_charge_end_time_slot_1
  charge_limit:
    - number.givtcp_{geserial}_target_soc
    - number.givtcp2_{geserial2}_target_soc
  scheduled_charge_enable:
    - switch.givtcp_{geserial}_enable_charge_schedule
    - switch.givtcp2_{geserial2}_enable_charge_schedule
  scheduled_discharge_enable:
    - switch.givtcp_{geserial}_enable_discharge_schedule
    - switch.givtcp2_{geserial2}_enable_discharge_schedule
  discharge_start_time:
    - select.givtcp_{geserial}_discharge_start_time_slot_1
    - select.givtcp2_{geserial2}_discharge_start_time_slot_1
  discharge_end_time:
    - select.givtcp_{geserial}_discharge_end_time_slot_1
    - select.givtcp2_{geserial2}_discharge_end_time_slot_1

  # Pause mode is not supported by all firmware's and will be ignored if not present
  pause_mode:
   - select.givtcp_{geserial}_battery_pause_mode
   - select.givtcp_{geserial2}_battery_pause_mode

  # Not all firmwares support pause start/end time, delete these if not supported
  # to avoid spurious writes/warnings
  pause_start_time:
   - select.givtcp_{geserial}_battery_pause_start_time_slot
   - select.givtcp2_{geserial2}_battery_pause_start_time_slot
  pause_end_time:
   - select.givtcp_{geserial}_battery_pause_end_time_slot
   - select.givtcp2_{geserial2}_battery_pause_end_time_slot

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

  # Battery temperature history, only one for modelling, used to predict future temperature
  #
  battery_temperature_history: sensor.givtcp_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:
    - 11000
 

  # Export limit is a software limit set on your inverter that prevents exporting above a given level
  # When enabled Predbat will model this limit
  #export_limit:
  # - 3600
  # - 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

  # Workaround to limit the maximum reserve setting, some inverters won't allow 100% to be set
  # Comment out if your inverter allows 100%
  # inverter_reserve_max : 98

  # 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)
  # The example below is from GE 9.5kwh battery with latest firmware and gen1 inverter
  #
  # 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:
    91 : 0.91
    92 : 0.81
    93 : 0.71
    94 : 0.62
    95 : 0.52
    96 : 0.43
    97 : 0.33
    98 : 0.24
    99 : 0.24
    100 : 0.24
  #battery_discharge_power_curve:
  # 4 : 1.0

  # 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

  # Solcast cloud interface, set this or the local interface below
  solcast_host: 'https://api.solcast.com.au/'
  solcast_api_key: 'QeljTblfSyNN_VR8ikrpdY7ohPe_ik7q'
  solcast_poll_hours: 8

  # 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: re:(sensor.(solcast_|)(pv_forecast_|)forecast_today)
  pv_forecast_tomorrow: re:(sensor.(solcast_|)(pv_forecast_|)forecast_tomorrow)
  pv_forecast_d3: re:(sensor.(solcast_|)(pv_forecast_|)forecast_(day_3|d3))
  pv_forecast_d4: re:(sensor.(solcast_|)(pv_forecast_|)forecast_(day_4|d4))

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

  # car_charging_planned is set to a sensor which when positive indicates the car will charged in the upcoming low rate slots
  # This should not be needed if you use Intelligent Octopus slots which will take priority if enabled
  # The list of possible values is in car_charging_planned_response
  # Auto matches Zappi and Wallbox, or change it for your own
  # One entry per car
  car_charging_planned:
    - 're:(sensor.wallbox_portal_status_description|sensor.myenergi_zappi_[0-9a-z]+_plug_status)'

  car_charging_planned_response:
    - 'yes'
    - 'on'
    - 'true'
    - 'connected'
    - 'ev connected'
    - 'charging'
    - 'paused'
    - 'waiting for car demand'
    - 'waiting for ev'
    - 'scheduled'
    - 'enabled'
    - 'latched'
    - 'locked'
    - 'plugged in'

  # In some cases car planning is difficult (e.g. Ohme with Intelligent doesn't report slots)
  # The car charging now can be set to a sensor to indicate the car is charging and to plan
  # for it to charge during this 30 minute slot
  #car_charging_now:
  #  - off

  # Positive responses for car_charging_now
  # car_charging_now_response:
    - 'yes'
    - 'on'
    - 'true'

  # To make planned car charging more accurate, either using car_charging_planned or the Octopus Energy plugin,
  # specify your battery size in kwh, charge limit % and current car battery soc % sensors/values.
  # If you have Intelligent Octopus the battery size and limit will be extracted from the Octopus Energy plugin directly.
  # Set the car SOC% if you have it to give an accurate forecast of the cars battery levels.
  # One entry per car if you have multiple cars.
  car_charging_battery_size:
   - 55
  #car_charging_limit:
  #  - 're:number.tsunami_charge_limit'
  #car_charging_soc:
  #  - 're:sensor.tsunami_battery'

  # One per car, when true only one car can charge at once, when False multiple cars can charge at once
  #car_charging_exclusive:
   - True

  # 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_energy([0-9a-z_]+|)_intelligent_dispatching)'
 # octopus_ready_time: 're:((select|time).octopus_energy_([0-9a-z_]+|)_intelligent_target_time)'
 # octopus_charge_limit: 're:(number.octopus_energy([0-9a-z_]+|)_intelligent_charge_limit)'

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

  # Set this to False if you use Octopus Intelligent slot for car planning but when on another tariff e.g. Agile
  #octopus_slot_low_rate: False

  # Carbon Intensity data from National grid
  carbon_intensity: 're:(sensor.electricity_maps_co2_intensity)'

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

  # Alternative scraper from Octopus web site if the above is not working
  # octopus_free_url: 'http://octopus.energy/free-electricity'

  # 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: 're:(sensor.(octopus_energy_|)electricity_[0-9a-z]+_[0-9a-z]+_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: 15

  # 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-FLEX-BB-23-02-08/electricity-tariffs/E-1R-AGILE-FLEX-BB-23-02-08-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 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:
    - 4

  # Days previous weight can be used to control the weighting of the previo I'll pop up to seeus 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: '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}'

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.3b_outdoor_temperature

    # Internal temperature sensor(s)
    internal_temperature:
      - sensor.3b_zone_1_circuit_0_current_temperature

    # Weather data
    weather: weather.openweathermap

    # Sensor with history that monitors the thermostat setting in the house
    target_temperature: sensor.3b_zone_1_circuit_0_desired_heating_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: True

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

    # Heating is turned on history
    heating_active: sensor.3b_circuit_0_heating_curve

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

    # 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)
    # https://www.bestheating.com/milano-kent-straight-chrome-heated-towel-rail-various-sizes-91119
    # https://www.bestheating.com/milano-compact-type-11-single-panel-radiator-multi-sizes-available-74174
    # https://www.bestheating.com/milano-compact-type-22-double-panel-radiator-multi-sizes-available-74176
    # https://www.bestheating.com/milano-compact-type-21-double-panel-plus-radiator-multi-sizes-available-74175
    heat_output: 23900

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

    # Heating max power in Watts
    heat_max_power: 12000
    heat_min_power: 0

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

    # Current flow temperature setting
    flow_temp: sensor.3b_circuit_0_current_flow_temperature
    flow_difference_target: 10

    # 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 gas boiler at different input temperatures
    #gas_efficiency:
    #  0: 0.995
    #  10: 0.995
    #  20: 0.99
    #  30: 0.98
    #  40: 0.95
    #  50: 0.90
    #  60: 0.88
    #  70: 0.87
    #  80: 0.86
    #  90: 0.85
    #  100: 0.84

    # 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
@gcoan
Copy link
Collaborator

gcoan commented Jan 20, 2025

Very strange issue, never seen that before, the car charges but not the battery.

The way you have pasted your apps.yaml into the issue I can't see whether there is a problem with the file layout, but probably not.

Looking at the plan I see you have set best_soc_keep to 1.5, _min to 1.5 and _max to 20.9 - I would start with checking those first.
https://springfall2008.github.io/batpred/customisation/#battery-margins-and-metrics-options

If you set best_soc_min then predbat will always ensure you have that amount in your battery, so if your house load exceeds the prediction and the SoC drops below 1.5 then predbat will charge the battery regardless of what the import rate is. Unless you need to keep something back for an EPS and you have lots of power cuts, set this to zero.

Can set best_soc_keep if you want, this is a soft constraint, but personally I have mine set to 0 also.

best_soc_max I have never seen it set by anyone, how did you come up with this value? This may be the cause of your weird plan as it looks like it could be set to more than your inverter can deliver. Again mine is set to 0.

@springfall2008
Copy link
Owner

best_soc_max will break stuff, that sets the maximum charge level which means you are basically preventing any meaningful charge - like GCoan says set it to 0.

@springfall2008 springfall2008 added the configuration User configuration issue label Jan 20, 2025
@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 20, 2025

sorry about the format, you should see the first edit, had too remove all the "#" as it was turning all the comments into titles but I've now noticed there is a code button so I've sorted it.

sadly i had all these things at 0 already and the issue was the same, i was mucking about trying to make things happen, ill put them all back to 0.

one thing to note is that i do have the 3-phase inverter and batteries. i didn't have "sensor.givtcp{geserial}battery_power" as an entity so I created it with a helper, which seems to be working from what I can see as the stats look fine, ill paste code below and add the logs

- platform: template
  sensors:
   givtcp_xxxxxxx_battery_power:
     friendly_name: "Battery Power"
     unit_of_measurement: "W"
     device_class: power
     value_template: >
         {% set charge = states('sensor.givtcp_xxxxxxxx_battery_charge_power') | float(0) %}
         {% set discharge = states('sensor.givtcp_xxxxxxx_battery_discharge_power') | float(0) %}
         {{ discharge - charge }}

predbat.log

@gcoan
Copy link
Collaborator

gcoan commented Jan 20, 2025

I'd recommend you change the template to being a time based trigger template. The problem with the one you have is that every single change in battery charge or discharge power, even by a single watt will result in a new state record being generated for your battery power entity.

You'll fill your database up with unnecessary guff as well as slow HA down a bit.

Here's a similar one I have for PV power so I can see total PV power vs Solcast forecast. I trigger this every 3 minutes but I have other sensors for things like net energy today on slower frequencies like 5 or 15 minutes:

# Total Solar power generation sensor, updated every 3 minutes
- trigger:
    - platform: time_pattern
      minutes: "/3"
  sensor:
    - name: "Total Solar Power"
      unique_id: "total_solar_power"
      unit_of_measurement: kW
      device_class: power
      state_class: measurement
      state: >
        {{ (states('sensor.g_xxxx_pv_power')|float(0) 
          + states('sensor.h_xxxx_pv_power')|float(0)
          + states('sensor.fit_solar_power')|float(0) )
          | round(1)
        }}

@Ryuisnod
Copy link
Author

Thanks for that I'll change the sensor, do you have any ideas to why I don't have charge or export on my plan?

@gcoan
Copy link
Collaborator

gcoan commented Jan 20, 2025

Another copy of the plan would be useful, and if you can attach the apps.yaml file (just attach is straight into github, don't need to copy/paste it), but in the logfile I see this:

2025-01-20 19:30:04.779445: Today's predicted so far 31.22 kWh with 20.63 kWh car/iBoost excluded and 6.49 kWh import ignored and 0 forecast extra.
2025-01-20 19:30:04.779488: Today's actual load so far 34.01 kWh with 16.3 kWh Car/iBoost excluded and 4.6 kWh import ignored.

So basically its saying that most of your load today is from charging the car/iboost, leaving you with very little actual house load consumed.

Is this correct? It might be why predbat sees no value in charging the battery

@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 20, 2025

no that doesn't seem to add up to reality at 19:30 unless that is the load number with the EV charging already removed.

Image

Image

Image

Image[

apps.txt

](url)

@gcoan
Copy link
Collaborator

gcoan commented Jan 21, 2025

You can comment all the GivTCP2 lines out (or remove them)

Looking at the yaml I can see at least two examples where you have commented out the label but not the sub items. This may cause problems, eg:

  # car_charging_now_response:
    - 'yes'
    - 'on'
    - 'true'

  # One per car, when true only one car can charge at once, when False multiple cars can charge at once
  #car_charging_exclusive:
   - True

Make sure you follow the advice on correct indentation and formatting of apps.yaml https://springfall2008.github.io/batpred/apps-yaml/

@gcoan
Copy link
Collaborator

gcoan commented Jan 21, 2025

Looking further I see other formatting errors in apps.yaml where sub-nodes are not indented two spaces, e.g.:

  pause_mode:
   - select.givtcp_{geserial}_battery_pause_mode
   - select.givtcp_{geserial2}_battery_pause_mode

  # Not all firmwares support pause start/end time, delete these if not supported
  # to avoid spurious writes/warnings
  pause_start_time:
   - select.givtcp_{geserial}_battery_pause_start_time_slot
   - select.givtcp2_{geserial2}_battery_pause_start_time_slot
  pause_end_time:
   - select.givtcp_{geserial}_battery_pause_end_time_slot
   - select.givtcp2_{geserial2}_battery_pause_end_time_slot

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

  rates_export:
   -  rate: 15

Another thing I notice is you have days previous set to just 4, so Predbat will look at your history from 4 days ago and that's it. Its not the cause of this but it does mean any unusual load on that day will be what predbat plans against.
More normal to use say day 2 to day 8, or day 7 and 14 (but you will need to increase history retention in configuration.yaml)

@WyndStryke
Copy link

More normal to use say day 2 to day 8, or day 7 and 14 (but you will need to increase history retention in configuration.yaml)

Slightly of an aside here, but I seem to recall that history can also be stored in the form of 'long term statistics'? Never looked into it, but if that's the case, then it would give a richer long-term history for this sort of thing. So rather than just looking at 'last Tuesday' or whatever, it could be based on a weighted average of Tuesdays going back further in time.

I did very recently increase my history retention to 22 days (to allow 7/14/21 to be picked up by predbat), but I suspect that might cause me data volume & performance issues. So perhaps a long-term-statistics solution would be a better approach in the long run.

@gcoan
Copy link
Collaborator

gcoan commented Jan 21, 2025

Slightly of an aside here, but I seem to recall that history can also be stored in the form of 'long term statistics'?

In HA there are three types of history:

  1. sensor history, raw values, every state change
  2. short term statistics, summarised sensor history giving max, min average every 5 minutes
  3. long term statistics, summarised to hourly

Predbat uses number 1. The short term statistics would probably be granular enough but at the moment its not what predbat uses.

And yes, keeping lots of history can bloat your database. I have been doing a lot of work on improving this and will update the predbat documentation with some advice soonish

@Ryuisnod
Copy link
Author

I've done all this and chanced to the dev givtcp and have a slight improvement

could this be part of the issue?

Warn: record_status Inverter 0 unable to read REST data from http://homeassistant.local:6345/readData - REST will be disabled

there is inverter data at that address

Image

@gcoan
Copy link
Collaborator

gcoan commented Jan 22, 2025

As far as I know there's only been one other person trying to get Predbat working with a 3 phase inverter, @LeeFarm11 and he raised and has had progressed a number of issues with both givtcp and predbat

Predbat issues include #1426 #1607 #1621 #1625 and #1630

I know that there have been dev changes made to givtcp to improve the inverter support. I think its still likely to be trial and error working out what's wrong and fixing it. On the face of it your predbat appears to not be having any issues in reading the data but then you'd think it would devise a sensible plan?

@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 22, 2025 via email

@LeeFarm11
Copy link

I am not very happy with where I am. I'm not happy with GivEnergy, and not happy that a year down the road the 3 phase Inverter is still not 'supported' by GivTCP. I would like to offer @britkat1980 more support, but I know he is busy. I believe he did spend another day at GivEnergy HQ recently, but I don't know how much progress he made with understanding and interfacing with the 3 phase Inverter. I would like to offer him to come to mine and play with my Inverter as much as he likes in an effort to move forward.

Until then, my predbat plan continues to work and my automation script continues to handle the charging and discharging, but I suspect it will be much less successful if we ever get any significant sunshine.

I have concerns about the solar forecast data, but not had time to investigate properly.

I have not spent much time on it recently, too much other stuff going on. But -
for me I have REST disabled in apps.yaml

  # 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
  #givtcp_rest:
  #  - 'http://192.168.1.204:6345'

Latest version of my automation is here -

alias: PredbatStatusChangeAutomation2
description: Modify Inverter Settings depending on predbat.status
triggers:
  - trigger: state
    entity_id:
      - predbat.status
    attribute: last_updated
conditions: []
actions:
  - if:
      - condition: or
        conditions:
          - condition: state
            entity_id: predbat.status
            state: Charging
          - condition: state
            entity_id: predbat.status
            state: Freeze charging
          - condition: state
            entity_id: predbat.status
            state: No charge
    then:
      - action: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_discharge_enable
      - action: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_charge_enable
    else:
      - if:
          - condition: or
            conditions:
              - condition: state
                entity_id: predbat.status
                state: Discharging
              - condition: state
                entity_id: predbat.status
                state: Freeze discharging
              - condition: state
                entity_id: predbat.status
                state: Exporting
        then:
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_discharge_enable
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_charge_enable
        else:
          - if:
              - condition: or
                conditions:
                  - condition: state
                    entity_id: predbat.status
                    state: Read-Only
                  - condition: state
                    entity_id: predbat.status
                    state: Hold charging
            then: []
            else:
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_charge_enable
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_discharge_enable
mode: single
trace:
  stored_traces: 50

@gcoan
Copy link
Collaborator

gcoan commented Jan 22, 2025

for me I have REST disabled in apps.yaml

I was going to suggest that might be an improvement.

Bear in mind that Predbat still uses REST to obtain the inverter information from givtcp, but you have the choice as to whether to use REST to control the inverter or use Home Assistant controls. Commenting the REST line out means Predbat uses the givtcp HA controls which is one thing less to have to be working right

Glad to hear you have made some progress @LeeFarm11 and it is working albeit with automation interventions to get around the givtcp control deficiencies.

@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 22, 2025 via email

@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 27, 2025

I am not very happy with where I am. I'm not happy with GivEnergy, and not happy that a year down the road the 3 phase Inverter is still not 'supported' by GivTCP. I would like to offer @britkat1980 more support, but I know he is busy. I believe he did spend another day at GivEnergy HQ recently, but I don't know how much progress he made with understanding and interfacing with the 3 phase Inverter. I would like to offer him to come to mine and play with my Inverter as much as he likes in an effort to move forward.

Until then, my predbat plan continues to work and my automation script continues to handle the charging and discharging, but I suspect it will be much less successful if we ever get any significant sunshine.

I have concerns about the solar forecast data, but not had time to investigate properly.

I have not spent much time on it recently, too much other stuff going on. But - for me I have REST disabled in apps.yaml

  # 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
  #givtcp_rest:
  #  - 'http://192.168.1.204:6345'

Latest version of my automation is here -

alias: PredbatStatusChangeAutomation2
description: Modify Inverter Settings depending on predbat.status
triggers:
  - trigger: state
    entity_id:
      - predbat.status
    attribute: last_updated
conditions: []
actions:
  - if:
      - condition: or
        conditions:
          - condition: state
            entity_id: predbat.status
            state: Charging
          - condition: state
            entity_id: predbat.status
            state: Freeze charging
          - condition: state
            entity_id: predbat.status
            state: No charge
    then:
      - action: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_discharge_enable
      - action: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.givtcp_td2343g049_force_charge_enable
    else:
      - if:
          - condition: or
            conditions:
              - condition: state
                entity_id: predbat.status
                state: Discharging
              - condition: state
                entity_id: predbat.status
                state: Freeze discharging
              - condition: state
                entity_id: predbat.status
                state: Exporting
        then:
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_discharge_enable
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.givtcp_td2343g049_force_charge_enable
        else:
          - if:
              - condition: or
                conditions:
                  - condition: state
                    entity_id: predbat.status
                    state: Read-Only
                  - condition: state
                    entity_id: predbat.status
                    state: Hold charging
            then: []
            else:
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_ac_charge_enable
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_charge_enable
              - action: switch.turn_off
                metadata: {}
                data: {}
                target:
                  entity_id: switch.givtcp_td2343g049_force_discharge_enable
mode: single
trace:
  stored_traces: 50

Could your share your apps.yaml and your config settings? All the numbers in my plan look about right to me but even when battery empty and electricity at 7p it will still not plan to charge. All sensors look right too so I must have something wrong

@britkat1980
Copy link

@lee can you try the latest dev version, which has my updates from time at GivEnergy HQ last month. It should fix some of the control issues you have experienced. I’d be interested in your feedback.

@LeeFarm11
Copy link

Hi @Ryuisnod

apps(2).yaml.zip

GivTCP Configuration. I see I have set Inverter 1 to only show Battery data. I guess that is wrong. Will try to test what difference it makes later. EVC is disabled for now to save complications. Tariffs are wrong, but predabat is set with correct rates.

Image

Image

Image

Image

Image

Image

Image

Image

Image

@Ryuisnod
Copy link
Author

Ryuisnod commented Jan 28, 2025 via email

@Ryuisnod
Copy link
Author

@LeeFarm11 Ok I seem to have it going now thanks for that.

@britkat1980 I'm using the givtcp dev fork. Predbat is able to charge and export natively without automations.

I didn't have predbat working before so I can't compare but I had made my own automations for charge and export and it required flicking a lot of switches but that seems to not be the case anymore.

Only things that haven't worked natively with predbat is battery power as there isn't an entity for that and the formatting of the entity names being different.

If there is any other information you want or things I can test from my 3-phase setup just let me know. Thanks for you time and effort on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration User configuration issue
Projects
None yet
Development

No branches or pull requests

6 participants