Power management with hass

Hello! Somewhat new to home assistant but I have been poking around for a few weeks and am now looking for some advice. What I want is something that can better manage power for my house. I have a solar array and long list of heavy load devices. (Water heater, pool pump, mini-split ACs all over the place). So far I have integrated my solar inverter so I can see power coming in and out, I have also setup some basic automations with the water heater and the pool pump to ensure that if the power consumption in the house exceeds the output of the solar array it shutsdown the pool pump and water heater.

However… what I have found is that I feel like just basic automations are too simple for what I really want. What I really want is more of a queuing system, I need to identify all my devices and more or less set them up to request power then based on how much power is available at any given moment use hassio to trigger them or shut them down to prioritize something else. My goal is to eliminate this situation where for 10 minutes at a time through the whole day I have 3 or 4 AC compressors running which causes me to draw power from the grid only to end up selling power back to the grid 15 minutes later when 2 or 3 of them shut down. It would be nice if I could somehow figure out how to tell AC 2 to basically wait 5 minutes for the compressor in AC1 to finish and then AC3 to do the same waiting for AC 1 or 2 etc etc.

The reason, of course is that power companies buy power from you at around 4 cents/KW and then sell it back to you at 16-24 cents/KW…

Any thoughts or input on how I could do that?

1 Like

Queueing is quite a complex task and I haven’t seen that functionality in any projects I have seen. It is probably best handled in python, via appdaemon.

I have been thinking about something like that for a while, and focused on my pool pump. The biggest challenge that I have found is the lack of predictability of my solar power production. You can probably cover the two extremes - in the middle of a sunny day in summer you produce enough power to keep everything running, and on a rainy/cloudy day in winter you never produce enough to run anything solely off solar power.

Ideally you would want to predict your solar power output based on past data, time of day, season, weather forecast.

Just an example: let’s say you run your pool pump at 9am for 2 hours, and the pump uses 1000W. It’s a cloudy day and at 9am you only produce 500W. Start the pool pump anyway and buy the gap from the grid? Or hope that the weather forecast is correct, and the clouds disappear in 1 hour. But what if the clouds do not go away, and one hour later you only produce 250W? And so on…

For now I have implemented my pool pump automation based on the time of the day and sunrise/sunset, as well as a few seasonal features.


These problems I think ive got figured out in the automations… I think I have 4 or 5 for the pool pump (have not put anything on github yet) but basically it works like this:

If solar production > pool pump wattage (750) and(condition) power sent to grid > 750 turn on pump

If power sent to grid < -500 turn off pump

Then… The magic trick, I want to run the pump 8 hours a day so I have a catch up automation that runs at midnight since electricity is cheaper after midnight. I have a sensor value that captures the run time of the pump and every night after midnight it runs until the accumulated time for the past 24 hours is 8

If time = 00:00 and(condition) pump hours < 8
disable the automation that turns off the pool pump
trigger the automation that turns on the pump

Do the reverse when the 8 hours is met.

I need to add in seasons so I can reduce the number of hours but thats easy enough…

This way, however I do not need to worry about the varying out put of the solar and I can guarantee that my pool pump runs the scheduled time per day either using the cheapest electricity OR the solar power.

My biggest problem is that this works GREAT with the pool pump and the water heater but it is very rudimentary scheduling at best. The water heater is basically the same routine but it turns off the water heater after -500 watts for 10 seconds where as the pool pump turns off after -500 watts for 1 minute so that I can ensure that the water heater coming on does not trigger the pool pump turning off and that the pool pump is more or less prioritized over the water heater. But when I start thinking about adding two or three AC units this just does not really work… Or just gets very complicated and convoluted.

That is indeed a nice trick. In my case electricity costs the same all day (heat pump is on a special cheap night circuit), and local council does not allow to run the pool pump over night.