Optimizing Solar Hybrid Inverter Logic for Maximum Profit

I’m currently working on optimizing the logic for controlling my solar hybrid inverter and attached house battery. The goal is to maximize profit by charging the battery during low electricity price periods and discharging it when prices are high. I’ve successfully integrated communication with the inverter and set up bindings for real-time electricity prices and solar production forecasts. However, I’m facing a challenge with the current rule setup and would appreciate any advice or insights from the community.Initially, I implemented a rule that identifies the hour between 22:00 and 08:00 with the lowest electricity price and charges the battery up to 60% during that time. While this worked for days with a predictable price curve, it didn’t account for scenarios where prices drop significantly after the initial charging period. For instance, today the price curve showed a much lower rate after the initial charging window, leading to missed savings opportunities.I’m considering whether to stick with this rule-based approach or explore more advanced algorithms that can dynamically adjust charging schedules based on real-time data and historical trends. I’ve heard that others have developed sophisticated energy management systems (EMS) for similar purposes, and I’m curious about the best practices or existing solutions that could be adapted to my setup.If anyone has experience with EMS implementations or can suggest resources or algorithms that might be applicable, I’d be grateful for your input. Additionally, if there are specific features or functionalities within openHAB that could enhance the system’s adaptability and efficiency, please share your thoughts. I’m eager to refine this system to make the most of my solar setup and reduce energy costs.