Closed grahamhobson closed 1 year ago
Hi Graham, Your pull request has left me a bit confused. Considering each of the 3 changes:
Hi Graham, Your pull request has left me a bit confused. Considering each of the 3 changes:
- The latest version of palm.py (uploaded yesterday) uses the Python standard logging library. This was already used in the version of palm_soc in the HomeAssistant Smart Target module. This aspect of the change is effectively already incorporated using a standard library.
- I've been considering splitting into several modules as I'm ~20% above the ideal of <1000 lines per file. I'd also like to include wider a range of inverter modes for use with different tariff structures. I like the general concept and will get to it in due course. Meanwhile, there's nothing to prevent anyone from importing the appropriate classes from palm.py, etc into their own code as it stands.
- The module compute_tgt_soc is at the heart of palm_soc: single numbers for daily consumption and forecast generation is an ineffective approach as consumption and generation occur at different times of the day. The proposed "lite" version still accesses the GivEnergy and Solcast APIs, so I'm unclear on the benefits of disregarding the data at hand to make a less accurate recommendation. The early code in HA took a similar approach before palm_soc was incorporated, but I may be missing something! The month functionality can easily be disabled in settings.py at present and the consumption data will revert to the hard-coded list in the same file if better data is unavailable.
After looking at Palm I decided to go a different way and wrote Predbat to predict and control the battery in a more visible way. The key thing I about my approach is that it re-calculates every 5 minutes and reacts to the situation as things unfold, it's especially important for tariffs like Agile.
I don't have any particular suggestions, just wanted to share this in case you want to either a) borrow ideas or b) consider different users needs.
Simplified version of palm_soc designed to be run once a day by a scheduler to set max battery recharge level based on a simple forecast of solar generation tomorrow. Simplifications are: no load calcs, no consideration of month of the year, simplified solcast retrieval, only use estimate_50 values. Two new values in settings.py: good_generation_day_kwh and bad_generation_day_kwh This version also logs key activity to a log file. It also separates out the latest GivEnergyObj class into a separate py file. Note that the complex compute_tgt_soc function is not used.