Manage energy consumption based on backup battery state


I have a backup battery system and want to run automations based on the state of charge of the battery, predicted solar energy I will produce, the weather etc. A few products like span and lumin offer some features for both power and energy management but have problems with non-local apis, lack of full control etc. Are there any integrations like this that already exist? I understand that trying to do any power management in home assistant is best effort due to lag but energy management should be possible.

For example, a scenario I’d like to solve might look like this:

  1. Power goes out
  2. Quickly Shed optional loads like garage heater, car charger, hot tub etc. if power is not being curtailed
  3. Outdoor temperature is 30F
  4. Battery capacity + expected solar production in the next 24 hours is 50kWh
  5. My house baseload is 500W and I want 24 hours of backup
  6. With an extra (50 - 12)kWh, am I able to keep my house at 68F for the next 24 hours? If not set it to highest temperature that will use under 38kWh. This could be calculated roughly by making some guesses about the house’s R values and total surface area and the heat pump’s COP.
  7. If more energy than predicted is being consumed turn down the thermostat further.
  8. If solar power production is being curtailed, turn up heat, then incrementally turn on sheddable loads until curtailment stops
  9. When grid turns back on set everything back to normal

Obviously this would be the goal solution but I would like to see if anyone even has any integrations or examples of simply using a state machine based on the battery state of charge

I am also looking for this kind of solution and found this post - I haven’t tried it yet, but looks like it might cover some of what you want to do…

Offline Solar forecast / battery state forecast - integration - Energy - Home Assistant Community (