As far as your question goes: (and answered by someone) delivering power back to the grid is where the problem exists. In fact in my area the power companies are specifically putting meters in which have live data feeds- one possible reason: To know when your pushing power back to the grid with an unapproved device.
So how do they know whether your doing it or not? Simple. They know if you have solar. So they know that between the hours of 8am to like 6pm you can produce electricty. But if you start backfeeding the grid at 8pm with your batteries, they will know. My interconnect agreement specifically does not allow the use of generators or batteries to "sell back" to the grid. Also, their time of day plan is very specific. ; you can only use the credits in the time frame you produced it.
Realistically, you'd have to push more than you use- and with a 5kw reserve, you'd most likely consume that within the day anyhow.
If your in CA or another area with default peak rates, your ideal scenario is to store the 5kw from overnight charging ( say 10pm to 6am) and switch over to batteries from 6am to 10pm.
The time of use system here is pretty abysmal- almost a 8x factor in price! But if your overall consumption is very low, actual cumulative savings is also low.
IF you want it for a different reason (battery packup, etc) then there is some real added value. But simply arbitraging energy from the grid isnt one of them.
Dont break any laws in your area. (disclaimer).
You need a charge controller to charge up your battery bank. You then need some current limiting device (buck/boost converter) to send the power to a grid tie inverter input. If you dont have a current limiter, you will dump the max amps of your battery into the grid tie inverter, and blow it up.
Set the current limiting device to the optimized discharge curve of your batteries.
Any power your house or circuit needs will be taken first. Whatever is left will dump to the grid.
Your meter needs to be ready for this. Some will not give you credit. Some will roll backwards . Some only roll forward!!