Nice work!
I’m also implementing a similar code right now for my new virtual battery contract.
Those are nice and simple sensor snippets 
For the SoC you’re right as the capacity is infinity, however we can calculate a State of Energy = SoE. Then use that value in some automation to optimize our home energy flow.