Open fllash333 opened 6 months ago
Battery Design Capacity in kWh
You can just type this number into apps.yaml as it doesn't change
Battery State of Charge in kWh
You only need to set one of these, the percent is fine:
soc_percent:
- sensor.battery_level
soc_kw: sensor.current_stored_capacity
Daily Total Load (from all sources, including grid, solar and battery)
Load is supposed to be how much your house consumes, a template sensor should work but you will need to wait 24 hours after creating it before you have some data.
The error:
changed to Error - Unable to fetch history from sensor.daily_consumed_energy_grid_and_generated
Doesn't match the sensor name you set?
load_today:
- sensor.daily_consumed_energy
Not sure where the name came from?
Good to know. I'll comment out the capacity.
Ah, OK. Let me clarify. The config I pasted in works (mostly). But daily_consumed_energy entity, as provided by my inverter, doesn't include import from the grid so it throws all the predictions off overnight (understandably). My attempt around that was to create a template sensor that just adds the daily import and the daily_consumed_energy together. I named it daily_consumed_energy_grid_and_generated so it was clear what it does.
However when I set load_today to this entity, I get an exception. It's probably related to the way I've made the template sensor. Here's the trace from the log: ` 2024-06-06 17:35:02.409117 WARNING pred_bat: ------------------------------------------------------------ 2024-06-06 17:40:02.446084 WARNING pred_bat: ------------------------------------------------------------ 2024-06-06 17:40:02.446186 WARNING pred_bat: Unexpected error in worker for App pred_bat: 2024-06-06 17:40:02.446398 WARNING pred_bat: Worker Ags: {'id': 'e9000f03314942b696f02ea273cd0c16', 'name': 'pred_bat', 'objectid': 'de065f2bc88b4774bd364c9e94ad455b', 'type': 'scheduler', 'function': <bound method PredBat.run_time_loop of <predbat.PredBat object at 0x7f136488bad0>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 300, 'random_start': 0, 'random_end': 0, '__thread_id': 'thread-0'}} 2024-06-06 17:40:02.446491 WARNING pred_bat: ------------------------------------------------------------ 2024-06-06 17:40:02.447201 WARNING pred_bat: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/apps/predbat.py", line 15454, in run_time_loop raise e File "/config/apps/predbat.py", line 15449, in run_time_loop self.update_pred(scheduled=True) File "/config/apps/predbat.py", line 14291, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/config/apps/predbat.py", line 12791, in execute_plan self.reset_inverter() File "/config/apps/predbat.py", line 12767, in reset_inverter inverter.adjust_charge_rate(inverter.battery_rate_max_charge * MINUTE_WATT) File "/config/apps/predbat.py", line 3266, in adjust_charge_rate self.write_and_poll_value( File "/config/apps/predbat.py", line 3429, in write_and_poll_value matched = abs(float(current_state) - new_value) <= fuzzy ^^^^^^^^^^^^^^^^^^^^ TypeError: float() argument must be a string or a real number, not 'NoneType'
2024-06-06 17:40:02.447337 WARNING pred_bat: ------------------------------------------------------------`
Hey there,
I have a Sungrow setup, and have been playing around with Batpred. I have most parts working although there are some that don't work because the inverter doesn't expose certain details. I've worked around some parts, but others are giving me a bit of trouble.
I'm using this HA custom component to interface with the Sungrow gear: https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant
This itself works very well and exposes all sorts of functionaly and data.
Here's the top part of the apps.yaml that I've configured (based on the SolarEdge template):
Sungrow doesn't expose these details via Modbus:
It's possible to derive them from other data (eg, Daily Total Load is the sum of imported energy and consumed energy generated from Solar/Battery). For the Design Capacity I just created a helper and hardcoded the capacity. The state of charge I calculated from the design capacity and the state of charge in percent.
All that is well and good but an exception is thrown when I try to use my template sensor for Daily Total Load:
To be fair this could be my problem because I only know the basics about template sensors, so I'm not sure if it doesn't like that there is only one day's worth of history (as I created the sensor yesterday) or if I've created it with some parameters incorrect.
Anyway, progress. Am keen to sort out what's happening. Let me know what other information I can chuck in here.
Cheers!