# Calculating "powerwall survivability"

I’m trying to calculate if my powerwall system will survive the night and stay off grid.
To do this I need to find two data points. The first is “how much time is there left on battery with the average consumption” - I’ve done this part already, there was a very helpful post where others have figured that out.

The next datapoint is “when do the solar panels generate enough juice to cover the houses needs” - this is an easy thing to spot in the graphs, but I can’t wrap my head around how to build a sensor or a template that would basically:

• identify when in the morning the system ‘tips over’ from battery (or grid) to solar, because the panels are generating enough power to cover the houses needs
• take the last 5 days, and find that time for them
• get an average of them, and get a timestamp
• calculate the time between “how much juice is left in the batteries” and this ‘tip over’ time
• display a simple red or green icon or something simple to provide a simple thumbs up/down representing if the remaining juice in the powerwalls will “survive the night”.

It’s pretty easy to spot in the sensor.powerwall_solar_now graph. I just need to translate a point on a graph “where the numbers go from zero to a certain value during a certain time of day”, then do that for several days and take an average to get a timestamp.

I’ve been able to narrow down that it happens roughly 3 hours after sunrise (at least this time of year), but I’m not handy enough with HA or jinja to sort it out myself. Any help here, or pointers, would be greatly appreciated!

Show us the graph and the point you mean.

There’s the chart for sensor.powerwall_solar_now. The house idles at ~1300 watts before everyone wakes up.

Sorry for second post, since my account is new, the forum will only let me post one screenshot per post.

If you look at sensor.powerwall_battery_now, you can see that the moment the numbers start going negative, it means the house has what it needs and the extra is flowing into the battery - I just need to figure out how to pinpoint that time so I can do math against it.