# ------------------------------------------------------------------ # Predbat apps.yaml template — Fronius GEN24 # # Fronius GEN24 does not support direct REST/MQTT control from Predbat. # Control is via a bridge layer: # Predbat → input_boolean/input_number helpers # → HA automations → shell_command → fronius_battery_control.py # → Modbus registers on inverter # # Before using this template, follow the Fronius inverter setup guide to # create the required HA helpers, bridge automations, shell_command # configuration and install the Python control script: # https://springfall2008.github.io/batpred/inverter-setup/#fronius-gen24 # ------------------------------------------------------------------ --- 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 # XXX: Template configuration, delete this line once you have set up for your system template: True # 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' # Currency, symbol for main currency second symbol for 1/100s e.g. $ c or £ p or € 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 # 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 # # Energy today (not power) sensors, more than one can be specified and they will be summed up automatically # # These require utility meter helpers — see the inverter setup guide for how to create them # from the cumulative energy sensors provided by the Fronius integration. # load_today: - sensor.daily_home_energy_use import_today: - sensor.daily_grid_draw_energy export_today: - sensor.daily_grid_feed_in_energy pv_today: - sensor.daily_solar_energy # 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 num_inverters: 1 # Fronius uses a custom inverter definition — the inverter: block below defines capabilities. # See https://springfall2008.github.io/batpred/inverter-setup/#inverter-control-options inverter_type: "FR" inverter: name: "Fronius GEN24" 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 has_target_soc: false 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 has_fox_inverter_mode: false time_button_press: false clock_time_format: "%d-%m-%y %H:%M:%S" write_and_poll_sleep: 2 has_time_window: false support_charge_freeze: true support_discharge_freeze: true # # Run balance inverters every N seconds (0=disabled) - only for multi-inverter balance_inverters_seconds: 0 # Services to control charging/discharging # Each service sets one mode ON and all others OFF for clean state transitions. # The input_boolean names must match those created in the inverter setup guide. charge_start_service: - service: input_boolean.turn_on entity_id: input_boolean.predbat_charge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_start charge_freeze_service: - service: input_boolean.turn_on entity_id: input_boolean.predbat_charge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_start charge_stop_service: - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_freeze discharge_start_service: - service: input_boolean.turn_on entity_id: input_boolean.predbat_discharge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_freeze discharge_freeze_service: - service: input_boolean.turn_on entity_id: input_boolean.predbat_discharge_freeze - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_charge_freeze discharge_stop_service: - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_start - service: input_boolean.turn_off entity_id: input_boolean.predbat_discharge_freeze # Predbat writes desired charge/discharge power (watts) to these helpers. # Bridge automations read these values and pass them to the Python script. charge_rate: - input_number.predbat_charge_rate discharge_rate: - input_number.predbat_discharge_rate reserve: - input_number.predbat_reserve charge_limit: - input_number.predbat_charge_limit # Power sensors — standard entity names from the Fronius HA integration # Polarity: Fronius reports load as negative and grid export as negative; # the invert flags below correct these to Predbat's expected conventions. battery_power: - sensor.solarnet_power_battery battery_power_invert: - false pv_power: - sensor.solarnet_power_photovoltaics load_power: - sensor.solarnet_power_load load_power_invert: - true grid_power: - sensor.solarnet_power_grid grid_power_invert: - true # soc_percent entity name varies by battery model — check yours in HA # soc_kw requires a template sensor — see inverter setup guide Step 2 soc_percent: - sensor.YOUR_BATTERY_SOC_PERCENT soc_kw: - sensor.YOUR_BATTERY_SOC_KWH # Battery capacity in kWh (usable) soc_max: - 10.0 # Set the maximum charge rate of the battery in watts battery_rate_max: - 5000 battery_min_soc: - 4 # 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 its kWh then set it to 0.8 to report the real figures battery_scaling: - 1.0 # 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) #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 # Inverter max AC limit (one per inverter). E.g. for a 10kW inverter set to 10000 # If you have a second inverter for PV only please add the two values together inverter_limit: - 10000 # Set inverter max charge and discharge rates inverter_limit_charge: - 5000 inverter_limit_discharge: - 10000 # 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 # 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 # 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 # 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)) # 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 # car_charging_planned is set to a sensor which when positive indicates the car will be 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' # 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: # - 75 #car_charging_limit: # - 're:number.tsunami_charge_limit' #car_charging_soc: # - 're:sensor.tsunami_battery' # If you have Octopus Intelligent Go and are not using the Octopus Direct connection method, 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 the intelligent slot from the Octopus Energy integration 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_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' # 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.carbon_intensity_uk)' # 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: '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 can be set to a sensor (e.g. Octopus) or manually entered in pounds here (e.g. 0.50 is 50p) 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: 0 # Can be used instead of the plugin to get import rates directly online # Overrides metric_octopus_import and rates_import # See the 'energy rates' part of the documentation for instructions on how to find the correct URL for your tariff and DNO region # #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-23-02-14/electricity-tariffs/E-1R-FLUX-EXPORT-23-02-14-A/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-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: 5 # For pv estimate, leave blank for central estimate, or add 10 for 10% curve (worst case) or 90 for 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_your_device # 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_' 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 # Nordpool market energy rates #futurerate_url: 'https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?date=DATE&market=N2EX_DayAhead&deliveryArea=UK¤cy=GBP' #futurerate_adjust_import: False #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 # 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)' # 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 updates as soon as you plug in # Only uncomment the items you actually have set up above in apps.yaml, of course you can add your own as well #watch_list: # - '+[car_charging_soc]'