springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
115 stars 40 forks source link

New setup does not show any usable data to control my inverter or EV charger #1326

Open lucode opened 1 month ago

lucode commented 1 month ago

Describe the bug I have read much of the documentation and spent some time understanding the app. It works now and outputs reasonable prediction data, but I can't find any entities I could use to control my inverter or EV charger. In the logs I found the following entries, but I can't discharge my battery as it is a non-feed-in installation.

2024-07-23 17:31:20.093983: Base discharge window [ 23-07 23:59:00 - 23-07 23:59:00 @ 0c 100.0%, 24-07 23:59:00 - 24-07 23:59:00 @ 0c 100.0% ]
2024-07-23 17:31:20.094019: Will recompute the plan as it is invalid

The entities for the Car charger are as follows: image The value "EV charging slot" is getting synchronized with my actual charging time, but does not predict anything.

The Inverter is from Victron and I used the SF inverter type for my setup. Link to my apps.yaml: https://github.com/HA-projects/predbat/blob/main/Inverters/Victron/victron_multiplus_v2.yaml

Expected behaviour I tried the mode SOC-only and Control charge, but I can't see any difference. In the docs a value is mentioned "target charge percentage" and a charge window, which are both not present in my setup.

In Control SOC-only mode Predbat will adjust the target charge percentage (SOC target) according to the Best plan, but the charge window will not be modified.

It is very unclear to me how to use this app in this regard, Or it is meant to use Prediction Best values to control the SOC of my battery? What is puzzling too, is that the app stays always in the "idle status".

Predbat version 8.3.1

Environment details

Screenshots image

Log file

2024-07-23 17:31:19.914179: Inverter 0 discharge windows currently [{'start': 1439, 'end': 1439, 'average': 0}, {'start': 2879, 'end': 2879, 'average': 0}]
2024-07-23 17:31:19.914221: Note: Inverter does not support discharge freeze - disabled
2024-07-23 17:31:19.914252: Note: Inverter does not support charge freeze - disabled
2024-07-23 17:31:19.914283: Note: Inverter does not support reserve - disabling reserve functions
2024-07-23 17:31:19.914366: Found 1 inverters totals: min reserve 0.38 current reserve 0.38 soc_max 9.6 soc 9.6 charge rate 4.0 kW discharge rate 4.0 kW battery_rate_min 0.0 w ac limit 5.0 export limit 5.0 kW loss charge 3 % loss discharge 3 % inverter loss 4 %
2024-07-23 17:31:20.093740: Base charge    window [  ]
2024-07-23 17:31:20.093983: Base discharge window [ 23-07 23:59:00 - 23-07 23:59:00 @ 0c 100.0%, 24-07 23:59:00 - 24-07 23:59:00 @ 0c 100.0% ]
2024-07-23 17:31:20.094019: Will recompute the plan as it is invalid
2024-07-23 17:31:20.094080: Best charge    window [  ]
2024-07-23 17:31:20.094110: Best discharge window [  ]
2024-07-23 17:31:20.096467: PV Forecast 63.6 kWh and 10% Forecast 55.8 kWh pv cloud factor 0.1
2024-07-23 17:31:20.101363: Load divergence over 8.0 hours mean 473.33 W, min 180.4 W, max 1840.0 W, std dev 238.56 W, divergence 25.2%
2024-07-23 17:31:20.226725: Yesterday basic charge window best: [{'start': 0, 'end': 390, 'average': 0.12}, {'start': 1260, 'end': 1830, 'average': 0.12}, {'start': 2700, 'end': 2880, 'average': 0.12}] charge limit best: [9.6, 9.6, 9.6]
2024-07-23 17:31:20.300740: predict yesterday end_record 07-24 00:00:00 final soc 9.6 kWh metric 0.44 c metric_keep 0 min_soc 8.78 @ 07-23 20:55:00 kWh load 17.63 pv 20.8
2024-07-23 17:31:20.301881:          [   00:00,    00:30,    01:00,    01:30,    02:00,    02:30,    03:00,    03:30,    04:00,    04:30,    05:00,    05:30,    06:00,    06:30,    07:00,    07:30,    08:00,    08:30,    09:00,    09:30,    10:00,    10:30,    11:00,    11:30,    12:00,    12:30,    13:00,    13:30,    14:00,    14:30,    15:00,    15:30,    16:00,    16:30,    17:00,    17:30,    18:00,    18:30,    19:00,    19:30,    20:00,    20:30,    21:00,    21:30,    22:00,    22:30,    23:00,    23:30]
2024-07-23 17:31:20.302895:     SOC: [     9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,      9.4,     9.09,     8.98,     9.09,     9.25,     9.56,      9.6,      9.6,      9.6,     9.49,     9.39,      9.6,      9.6,      9.6,      9.6,      9.6,      9.6,     9.58,     9.49,      9.6,      9.6,     9.58,      9.6,      9.6,     9.56,     9.57,      9.3,     9.11,     8.78,      9.6,      9.6,      9.6,      9.6,      9.6]
2024-07-23 17:31:20.303679:     BAT: [   g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-,    g>be-,    g~be-,    g<be+,    g~be+,    g~be+,    g>be+,    g>be~,    g>be~,    g>be~,    g~be-,    g~be+,    g>be~,    g>be~,    g>be~,    g>be~,    g>be~,    g<be-,    g>be+,    g>be+,    g>be~,    g>be+,    g~be+,    g~be-,    g<be-,    g~be-,    g<be-,    g<be-,    g~be-,    g<bf+,    g<be-,    g<be-,    g<be-,    g<be-,    g<be-]
2024-07-23 17:31:20.304671:    LOAD: [       0,     0.15,     0.29,     0.39,     0.55,     0.68,     0.79,     0.95,     1.06,      1.2,     1.34,     1.44,      1.6,     1.86,     2.06,     2.37,     2.56,     2.71,     2.91,     3.03,     3.21,     3.44,      3.6,     4.36,     5.21,     5.45,     5.73,     6.04,      6.3,     7.07,     8.21,     9.54,    10.84,    12.11,    13.41,    14.01,    14.85,    15.31,    15.45,    15.64,    16.04,    16.25,    16.56,    16.78,    16.91,    17.14,    17.29,    17.45]
2024-07-23 17:31:20.305767:      PV: [       0,      0.0,      0.0,      0.0,      0.0,     0.01,     0.02,     0.03,     0.04,     0.05,     0.05,     0.06,     0.07,     0.08,     0.09,     0.11,      0.2,     0.48,     0.84,      1.3,     1.88,     2.48,     3.23,      4.1,     4.92,     5.82,     6.75,     7.75,     8.87,     10.6,    11.95,     13.5,     14.9,     16.5,    17.95,     18.7,    19.67,    20.19,     20.3,    20.52,    20.66,     20.7,     20.7,     20.7,     20.8,     20.8,     20.8,     20.8]
2024-07-23 17:31:20.306876:  IMPORT: [       0,     0.15,     0.29,     0.39,     0.55,     0.67,     0.77,     0.92,     1.02,     1.15,     1.28,     1.38,     1.53,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     1.78,     2.89,     2.95,     3.19,     3.34,      3.5]
2024-07-23 17:31:20.307807:  EXPORT: [       0,        0,        0,        0,        0,        0,        0,        0,        0,        0,        0,        0,        0,        0,      0.0,      0.0,      0.0,      0.0,      0.0,      0.0,     0.34,     0.68,     1.24,     1.42,     1.45,     1.87,     2.48,     3.13,     3.94,     4.83,     4.99,     5.16,     5.28,     5.44,     5.53,     5.67,     5.74,     5.77,     5.78,     5.78,     5.78,     5.78,     5.78,     5.78,     5.81,     5.81,     5.81,     5.81]
2024-07-23 17:31:20.308793:  METRIC: [       0,     0.02,     0.04,     0.05,     0.07,     0.08,     0.09,     0.11,     0.12,     0.14,     0.15,     0.17,     0.18,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.21,     0.35,     0.35,     0.38,      0.4,     0.42]
2024-07-23 17:31:20.308863: Yesterday: Predbat disabled was 0.44p vs real 0.0p saving 0.44p with import 3.68 export 5.81 battery_cycle 4.51 start_soc 9.6 final_soc 9.6
2024-07-23 17:31:20.342686: Yesterday: No Battery/PV system cost predicted was 3.14p vs real 0.0p saving 3.14p with import 17.63 export 0
2024-07-23 17:31:20.367445: Creating pool of 2 processes to match your CPU count
2024-07-23 17:31:20.403077: Calculate Best options: mode(Control SOC only) calculate_discharge_oncharge(True) set_discharge_freeze_only(False) set_discharge_during_charge(False) combine_charge_slots(False) combine_discharge_slots(False) combine_rate_threshold(0.0) best_soc_min(0.0 kWh) best_soc_max(0.0 kWh) best_soc_keep(0.5 kWh) inverter_loss(4 %) battery_loss(3 %) battery_loss_discharge (3 %) inverter_hybrid(True) metric_min_improvement(0.0 p) metric_min_improvement_discharge(0.1 p) metric_battery_cycle(0 p/kWh) metric_battery_value_scaling(1.0 x) 
2024-07-23 17:31:20.403585: Calculated end_record as 07-25 17:30:00
2024-07-23 17:31:20.403688: Starting second optimisation end_record 07-25 17:30:00 best_price 0 best_price_discharge 0 lowest_price_charge 0 with charge limits []
2024-07-23 17:31:20.403847: Best charge windows best_metric 0.09 best_cost 0.09 best_carbon 0 best_import 0 metric_keep 0 end_record 07-25 17:30:00 windows [  ]
2024-07-23 17:31:20.403912: Best charge windows best_metric 0.09 best_cost 0.09 best_carbon 0 best_import 0 metric_keep 0 end_record 07-25 17:30:00 windows [  ]
2024-07-23 17:31:20.403985: Best charge windows best_metric 0.09 best_cost 0.09 best_carbon 0 best_import 0 metric_keep 0 end_record 07-25 17:30:00 windows [  ]
2024-07-23 17:31:20.404034: Calculated end_record as 07-25 17:30:00
2024-07-23 17:31:20.449192: predict base end_record 07-25 17:30:00 final soc 9.6 kWh metric 0.09 c metric_keep 0 min_soc 3.88 @ 07-24 09:10:00 kWh load 54.51
Startup
 System: Home Assistant OS 12.4  (amd64 / qemux86-64)
 Home Assistant Core: 2024.7.3
 Home Assistant Supervisor: 2024.06.2
-----------------------------------------------------------

Predbat files are installed correctly for version v8.3.1
**** Starting Standalone Predbat ****
2024-07-23 17:41:48.925493: Loading apps.yaml
2024-07-23 17:41:49.032679: Info: Connected to Home Assistant at http://supervisor/core
2024-07-23 17:41:49.034715: Creating task: <coroutine object HAInterface.socketLoop at 0x7f9a23742f10>
2024-07-23 17:41:49.036429: Info: Start socket for url http://supervisor/core/api/websocket
2024-07-23 17:41:49.036848: Info: Web Socket task started
2024-07-23 17:41:49.037605: Warn: unable to find /config/appdaemon.yaml skipping checks as maybe outside AppDaemon
2024-07-23 17:41:49.088028: Info: Web Socket active
Watching ['./download.py', './ha.py', './predbat.py', './inverter.py', './unit_test.py', './utils.py', './apps.yaml', './hass.py', './prediction.py', './config.py'] for changes
springfall2008 commented 1 month ago

I'm not sure I understand the question, but SOC only mode is when you have configured a fixed charge window and you just want Predbat to decide the charge %. I'd recommend control Charge/Discharge initially.

In your apps.yaml you can't control your system as you hard-wired the controls, these are meant to point to HA switches/numbers that Predbat can modify.

There are various control methods that can be selected in the inverter configuration section, either using these controls directly but also be using a service API to HA.

How can you control your inverter in HA currently, what do the controls look like?

charge_limit:
   - 100
  reserve:
    - 20
  scheduled_charge_enable:
   - off
  scheduled_discharge_enable:
   - off
  charge_start_time:
   - off
  charge_end_time:
   - off
  discharge_start_time:
   - off
  discharge_end_time:
   - off
lucode commented 1 month ago

How can you control your inverter in HA currently, what do the controls look like?

Thank you for the hints. I start to understand now. So it means that "charge_limit" is a sensor, controlled by Predbat to set my SOC Target? And, charge_start/stop_time are setting the schedule to reach the SOC Target? And what about the service API (charge_start_service - Should be set to a service that is called when charging starts)? Are those if I don't want to use the charge_start/stop_time entities to control my charge?

Frankly, the list of the inverter controls should be more precise about the entities. At least they should be divided in two categories, which makes it clear which ones are input sensors or hard-coded and which are entities (variables) that are controlled by Predbat. https://springfall2008.github.io/batpred/apps-yaml/#home-assistant-entity-inverter-control

 # Entity name for used to set the SOC target for the battery in percentage (AC charge target)    
  charge_limit:
   - sensor.victron_predbat_soc_target
  reserve:
    - 20
  scheduled_charge_enable:
   - off
  scheduled_discharge_enable:
   - off
  charge_start_time:
   - sensor.victron_predbat_charge_start_time
  charge_end_time:
   - sensor.victron_predbat_charge_stop_time
springfall2008 commented 1 month ago

Basically yes, although sensor. are read only entities so you can't use those for controls, they have to be a select. for times I believe.

If you don't have some of these then the inverter options can disable them. The service API is called if you have has_service_api enabled.

lucode commented 1 month ago

Basically yes, although sensor. are read only entities so you can't use those for controls, they have to be a select. for times I believe.

If you don't have some of these then the inverter options can disable them. The service API is called if you have has_service_api enabled.

Yes, I started to think that my conclusion was wrong. But how can I control my inverter, I do need the service API ? And which input parameter are essential?

In the meantime I changed the mode to Charge control, but nothing changes, it stays in idle and when I turn it active it goes back to off. image