Skip to content

When "switch.predbat_car_charging_from_battery" is "on" then EV charging is not subtracted from houseload (LoadML) #3715

@raverlution

Description

@raverlution

Describe the bug
When "switch.predbat_car_charging_from_battery" is "on", the EV consumption is included in the household consumption (Load ML) — is that how it’s supposed to be, or is it a bug?

Expected behaviour
I would expect it to subtract the EV consumption when "switch.predbat_car_charging_from_battery" is "on" just like it does when "switch.predbat_car_charging_from_battery" is "off".

car_charging_energy:

  • sensor.shelly_billader_daglig_energi
    Is a sensor in kWh

car_charging_now:

  • "binary_sensor.keba_p30_charging"
    Is "on" when the car charges

Predbat version
V8.35.1

Environment details

  • Inverter and battery setup
  • Standard HAOS install
  • Deye 12kW + 28kWh battery

Screenshots

Image

Log file

predbat.log.txt

You can download the logfile from the WebUI on the Dash tab select predbat.log

Predbat debug yaml file

predbat_debug.yaml.txt

Predbat.yaml

pred_bat:
  module: predbat
  class: PredBat
  prefix: predbat
  timezone: Europe/Copenhagen
  threads: auto

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

  # 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.sunmateiopulse_2193d0_pulse_daily_energy_houseload   # load_power_daily_kWh
  import_today:
  - sensor.sunmateiopulse_2193d0_pulse_daily_energy_bought   # electric_import_daily_kWh
  export_today:
  - sensor.sunmateiopulse_2193d0_pulse_daily_energy_sold   # electric_export_daily_kWh
  pv_today:
  - sensor.sunmateiopulse_2193d0_pulse_daily_production

  # Aktiver ML load prediction ### Ny AI beregning i stedet for PredAI (som er meget tungt)
  load_ml_enable: True
  # Use the output data in Predbat (can be False to explore the use without using the data)
  load_ml_source: True

  # Enable temperature predictions (RECOMMENDED for ML load prediction)
  # Optional: specify coordinates (defaults to zone.home)
  temperature_enable: true
  

  # Controls/status - must by 1 per inverter
  num_inverters: 1
  inverter_type: SK
  support_discharge_freeze: true

  # **** Start of Outputs to Deye Inverter **** Tænd & sluk for grid charge mm. det styrer jeg med HA Automationer i stedet.
  # **** Start of Outputs to Deye Inverter **** Tænd & sluk for grid charge mm. det styrer jeg med HA Automationer i stedet.
  
  timed_charge_current:
  - number.sunmateiopulse_2193d0_pulse_battery_max_grid_charge   # Inverter battery max charge setting in A FROM GRID!!
  timed_discharge_current:
  - number.sunmateiopulse_2193d0_pulse_battery_max_discharge   # Inverter battery max discharge setting in A
  charge_limit:
  - number.sunmateiopulse_2193d0_pulse_timepoint_1_capacity   # Inverter SOC time slot1

  # **** End of Outputs to Deye Inverter ****
  # **** End of Outputs to Deye Inverter ****
  # **** End of Outputs to Deye Inverter ****


  # Custom sensors to get the BMS charge/discharge limit, based on inverter size (8000kW, BMS reported limit, and inverter set limit)
  # Det er en hjælper jeg har oprettet. Når bilen lader med 11kWh så ændrer den denne sensor og predbat ved
  # at den kun kan lade med eks. 5kwh mod de normale 12kWh. (og Predbat indstiller også inverteren til max 
  # at lade med de eks. 5kWh)
  inverter_limit_charge:
  - sensor.predbat_change_inverter_max_grid_charge   
  inverter_limit_discharge:
  - 12500
  battery_rate_max:
  - 12500   # The maximum rate of the battery charge/discharge in watts **required to lift the 2600w default limit**
  battery_voltage:
  - sensor.sunmateiopulse_2193d0_pulse_battery_voltage
  battery_power:
  - sensor.sunmateiopulse_2193d0_pulse_battery_output_w_power   #in watts
  grid_power:
  - sensor.sunmateiopulse_2193d0_pulse_grid_out_total_power
  grid_power_invert:
  - true
  soc_percent:
  - sensor.sunmateiopulse_2193d0_pulse_battery_soc
  pv_power:
  - sensor.sunmateiopulse_2193d0_pulse_pv1_power
  - sensor.sunmateiopulse_2193d0_pulse_pv2_power
  load_power:
  - sensor.sunmateiopulse_2193d0_pulse_load_w_totalpower   #I watt
  soc_max:
  - 28   # Batteri størrelse i kWh - HUSK AT ÆNDRE TIL HVOR STORT DIT BATTERI ER!!!
  battery_min_soc:
  - 6   # Batteri min. SOC i % - ÆNDRES TIL HVAD DU VIL AFLADE NED TIL


  # 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:
  - 12000   # Ændre til inverter størrelse i W

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

  # Ved at lave en _default: i stedet så udregner Predbat automatisk battery_charge_power_curve: og bruger
  # Kun _default: hvis ikke den har eller kan lave en automatisk battery_charge_power_curve:
  battery_charge_power_curve_default:
    100: 1.0
  battery_discharge_power_curve_default:
    0: 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: 'xxxx'
  #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))
  pv_forecast_d5: re:(sensor.(solcast_|)(pv_forecast_|)forecast_(day_5|d5))
  
  
  # **** Car charging starts here!!! ****
  # **** Car charging starts here!!! ****
  # 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:
  - sensor.shelly_billader_daglig_energi

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

  # 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
  # For at Predbat sætter husbatteriet på "hold" når bilen lader, skal den vide hvornår bilen lader
  # Det er denne sensor der "styrer" det - HUSK AT AKTIVERE "Car charging hold" I HA for at det virker!
  car_charging_now:
  - "binary_sensor.keba_p30_charging"

  # Positive responses for car_charging_now
  car_charging_now_response:
  - 'on'
  # **** Car charging end here!!! ****
  # **** Car charging end here!!! ****
  
  
  # Energi priser 
  # Jeg bruger Strømligning integrationen og jeg har derfor lavet en "custom" 
  # Strømligning sensor som ligner og har de samme attributter som Energi Data Service
  metric_energidataservice_import: "sensor.customized_stromligning_sensor_til_predbat"
  # metric_energidataservice_import: "sensor.energi_data_service"
  metric_energidataservice_export: "sensor.customized_stromligning_export_uden_moms_sensor_til_predbat"
  # metric_energidataservice_export: "sensor.energi_data_service_export"


  # Number of plan hours forward to forecast.
  forecast_hours: 48

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

  # 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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions