Try EMHASS, which is a true EMS with actual mathematical optimization under the hood. No need to pay for a cloud-based EMS service, it works locally.
I am the developer and the community is very active on helping people when struggling to setup.
Here is the main thread: https://community.home-assistant.io/t/emhass-an-energy-management-for-home-assistant
And the main repo: https://github.com/davidusb-geek/emhass