# ------------------------------------------------------------------ # Hanchu ESS Cloud template # ------------------------------------------------------------------ # This is the NATIVE Predbat cloud integration - Predbat talks to the Hanchu cloud # directly and needs no Home Assistant integration and no bridge script. # # If you would rather drive the inverter through the hanchu-ess-ha HACS integration # and a Home Assistant script, use templates/hanchu_cloud.yaml instead; that is a # different, service-API setup and the two are alternatives, not layers. # ------------------------------------------------------------------ --- pred_bat: module: predbat class: PredBat # Sets the prefix for all created entities in HA - only change if you want to run more than one 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 # 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 # Hanchu ESS cloud - these are the e-mail address and password you sign into the # Hanchu phone app with. There is no developer portal and no API key. # # EXPERIMENTAL, AND MORE SO THAN THE OTHER CLOUD INTEGRATIONS. Hanchu publish no API # specification at all: this integration was written by reading open-source Home # Assistant integrations, so some of its behaviour is deduced rather than documented, # and it has been tested on only a couple of units. Please report what you see - # every request and response is traced to the log by default (hanchu_api_debug, below). hanchu_account: 'you@example.com' hanchu_password: 'xxxx' # Let Predbat configure the sensors and inverter settings for you hanchu_automatic: True # Set False for monitoring only - Predbat will not write to the inverter. # switch.predbat_set_read_only also holds back every write, including Predbat's own # periodic re-apply. # # NOTE: once Predbat takes control it writes all three charge and all three discharge # time slots, and sets the ones its plan does not use to 00:00-00:00. Any schedule you # set up in the Hanchu app is cleared at Predbat's first write. This is deliberate: in # User-defined mode every enabled slot runs, so a slot left over from the app would run # alongside Predbat's plan and fight it. Nothing is cleared while monitoring only. # # Freeze Export is not available on Hanchu: the charge power limit only limits charging # from the grid, so it cannot stop solar charging the battery. hanchu_control_enable: True # IMPORTANT, AND THE MOST LIKELY THING TO NEED CHANGING. # Nothing documents which Hanchu work mode actually honours the timed charge and # discharge slots. Predbat deduces it is "User-defined" (mode 3) and sets that mode # whenever it writes a window. If your inverter accepts the windows and then ignores # them, set this to False, put the inverter into whichever mode does honour them # yourself, and please report which one that is. #hanchu_work_mode_control: True # Optional: restrict to one device when the account has several #hanchu_inverter_sn: 'YOURSERIAL' # Optional: the battery power limit. Predbat looks your model up from the model code # the inverter reports and logs what it found ("Hanchu ... is a HESS-HY-S-5.0K"). For a # model it does not know, it falls back to the charge power setting's upper limit. Set # this if Predbat's value is wrong for your pack. #hanchu_battery_rate_max: 5000 # Optional: the inverter's AC rating, from the same model lookup, or for an unknown model # from the discharge power setting's upper limit (a warning is logged when the device # reports neither). Set this if Predbat's value is wrong for yours. #hanchu_inverter_limit: 5000 # Optional pacing. Predbat batches every setting change into ONE write per cycle, which # is what the reference integration does to avoid being rate limited. There is no # published rate limit, so this default is deliberately mild. #hanchu_api_delay: 1 #hanchu_min_write_interval: 60 # Every API request and response is logged by default, because that is what is needed # to look into a problem with your inverter. It writes thousands of long lines a day: # once everything is working you can set this to False to quieten the log, and turn it # back on before reporting an issue. #hanchu_api_debug: True # REQUIRED: the API does not report a grid export limit. If your grid connection is # capped below the inverter rating (G98/G99), set it here or Predbat will plan exports # it cannot deliver. One entry per device if your account has more than one. #export_limit: # - 3680 # NOTE ON SOC LIMITS. This hardware only accepts a grid-charge target of 20-100% and a # discharge floor of 5-45%. Predbat clamps anything outside those and says so in the # log; there is no way around it from here. It means a plan that wants to charge to # only 10%, or to export down to no lower than 60%, cannot be carried out exactly. # The app's "Maximum Charge SOC" is left as you set it - it limits solar charging too. # # 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 # The highest reserve Predbat may hold the battery on. Hanchu's discharge floor only accepts up # to 45%, and hanchu_automatic sets this to that ceiling for you - only set it by hand without # hanchu_automatic, and never above 45, or a hold above 45% drains the battery instead #inverter_reserve_max : 45 # 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: # 100 : 0.15 # 99 : 0.15 # 98 : 0.22 # 97 : 0.31 # 96 : 0.42 # 95 : 0.48 # 94 : 0.58 # 93 : 0.68 # 92 : 0.77 # 91 : 0.85 # 90 : 0.94 #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: '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)' # car_charging_power is the live charging power of your car charger, in Watts # It is display only - it drives the car shown on the web interface power flow diagram # and the predbat.car_charging_power sensor. The plan itself is unaffected by it. # Automatically set to detect Wallbox and Zappi, if it doesn't match manually enter your sensor name car_charging_power: 're:(sensor.myenergi_zappi_[0-9a-z]+_internal_load_ct1|sensor.wallbox_portal_charging_power)' # 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' - 'ev ready to charge' - 'charging' - 'paused' - 'waiting for car demand' - 'waiting for ev' - 'scheduled' - 'enabled' - 'latched' - 'locked' - 'plugged in' - 'waiting' # car_charging_now can be set to a sensor that shows the car is charging right now, so that # Predbat holds the house battery for the car while it charges. It never adds a charging slot. # Use an on/off sensor (matched against car_charging_now_response), or a charging power sensor # in W or kW where 200W or more counts as charging - e.g. for a Wallbox charger: #car_charging_now: # - sensor.wallbox_portal_charging_power # 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: # - 75 #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 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_postcode: 'SW1 5NA' # carbon_automatic: True # Octopus saving session points to the saving session Sensor in the Octopus plugin, when enabled saving sessions will be at the assumed # Rate is read automatically from the add-in and converted to pence using the conversion rate below (default is 8) octopus_saving_session: 're:(event.octopus_energy([0-9a-z_]+|)_(saving_session_events?|power_down_events))' octopus_saving_session_octopoints_per_penny: 8 # Minimum octopoints_per_kwh an available saving session must offer for Predbat to auto-join it (default 0, joins any non-negative reward). octopus_saving_session_min_octopoints_per_kwh: 0 # 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|power_up_events))' # Alternative scraper from Octopus web site if the above is not working # octopus_free_url: 'http://octopus.energy/free-electricity' # Enter your Axle VPP API key if you have signed up to the Axle service in the UK # axle_api_key: "xxxxxxx" # 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)' # Energy data service (https://github.com/MTrab/energidataservice) #metric_energidataservice_import: 'sensor.energi_data_service_import' #metric_energidataservice_export: 'sensor.energi_data_service_export' # 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 # 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: 112 # load_scaling: 0.8 # Days previous sets how many days of load history Predbat searches when forecasting your future house load. # By default this uses a weighted-bucket forecast that automatically accounts for day-of-week, holiday mode # and recency (days_previous_auto) - see the documentation for other options, such as picking specific # days/weights instead, or using Load ML. days_previous: - 7 # 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_' 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¤cy=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 # Tariff comparison feature # Adjust this list to the tariffs you want to compare, include your current tariff also # Octopus region code (https://energy-stats.uk/dno-region-codes-explained/) #octopus_region: "A" #compare_list: # - id: 'current' # name: 'Current Tariff' # - id: 'cap_seg' # name: 'Price cap import/Seg export' # rates_import: # - rate: 24.86 # rates_export: # - rate: 4.1 # - id: 'igo_fixed' # name: 'Intelligent GO import/Fixed export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-BB-VAR-23-03-01/electricity-tariffs/E-1R-INTELLI-BB-VAR-23-03-01-{octopus_region}/standard-unit-rates/' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-BB-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-BB-24-10-26-{octopus_region}/standard-unit-rates/' # - id: 'igo_agile' # name: 'Intelligent GO import/Agile export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/INTELLI-BB-VAR-23-03-01/electricity-tariffs/E-1R-INTELLI-BB-VAR-23-03-01-{octopus_region}/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-{octopus_region}/standard-unit-rates/' # - id: 'go_fixed' # name: 'GO import/Fixed export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/GO-VAR-BB-23-02-07/electricity-tariffs/E-1R-GO-VAR-BB-23-02-07-{octopus_region}/standard-unit-rates/' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-BB-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-BB-24-10-26-{octopus_region}/standard-unit-rates/' # - id: 'go_agile' # name: 'GO import/Agile export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/GO-VAR-BB-23-02-07/electricity-tariffs/E-1R-GO-VAR-BB-23-02-07-{octopus_region}/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-{octopus_region}/standard-unit-rates/' # - id: 'agile_fixed' # name: 'Agile import/Fixed export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-24-10-01/electricity-tariffs/E-1R-AGILE-24-10-01-{octopus_region}/standard-unit-rates/' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-BB-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-BB-24-10-26-{octopus_region}/standard-unit-rates/' # - id: 'agile_agile' # name: 'Agile import/Agile export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-24-10-01/electricity-tariffs/E-1R-AGILE-24-10-01-{octopus_region}/standard-unit-rates/' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/AGILE-OUTGOING-BB-23-02-28/electricity-tariffs/E-1R-AGILE-OUTGOING-BB-23-02-28-{octopus_region}/standard-unit-rates/' # - id: 'flux' # name: 'Flux import/Export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/FLUX-IMPORT-23-02-14/electricity-tariffs/E-1R-FLUX-IMPORT-23-02-14-{octopus_region}/standard-unit-rates' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/FLUX-EXPORT-BB-23-02-14/electricity-tariffs/E-1R-FLUX-EXPORT-BB-23-02-14-{octopus_region}/standard-unit-rates' # - 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-{octopus_region}/standard-unit-rates' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-BB-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-BB-24-10-26-{octopus_region}/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-{octopus_region}/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-{octopus_region}/standard-unit-rates/' # - id: 'snug_fixed' # name: 'Snug import/Fixed export' # rates_import_octopus_url: 'https://api.octopus.energy/v1/products/SNUG-24-11-07/electricity-tariffs/E-1R-SNUG-24-11-07-{octopus_region}/standard-unit-rates/' # rates_export_octopus_url: 'https://api.octopus.energy/v1/products/OUTGOING-VAR-BB-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-BB-24-10-26-{octopus_region}/standard-unit-rates/' # Alert feeds - customise to your country and the alert types, severity and keep value #alerts: # url: "https://feeds.meteoalarm.org/feeds/meteoalarm-legacy-atom-united-kingdom" # event: "(Amber|Yellow|Orange|Red).*(Wind|Snow|Fog|Rain|Thunderstorm|Avalanche|Frost|Heat|Coastal event|Flood|Forestfire|Ice|Low temperature|Storm|Tornado|Tsunami|Volcano|Wildfire)" # severity: "Moderate|Severe|Extreme" # certainty: "Possible|Likely|Expected" # keep: 40 # 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}'