A bit of an old post, but I'll reply anyway. I'm in the last stages of building a solar monitor. I started with ESP8266, then ESP32 and now on RPi. I found the ESPs to be unstable and it seemed like I never had a good reference for what was/was not implemented in their version of C. Moving to the Pi was liberating. It has a real operating system, Linux and therefore can host real applications including a database.
No love for Python, but I decided to learn it since it seems the most popular on the platform. What I wanted to do is be able to monitor both what is coming in and what is going out. My EPEver 50a charge controllers have a lot of information but two disadvantages. First the little loggers have to be downloaded periodically. The data must then be massaged in Excel. Works but not easy and not real time. Second issue is the data is centric to the charge controller. I can't monitor the usage of the power.
What I have setup is the Pi with three ADS1115 analog to digital converters for measurements. I also added a Dallas 18B20 for measuring the temperature of the electronics. Not so much a problem in the winter, but we'll see this summer. I've learned a lot about the practical accurate measurement of both AC and DC. My setup is off grid. I have a dedicated circuit run in my barn and workshop. I'm using a transfer switch based on battery voltage to switch between inverter power and building power.
I'm measuring the AC voltage and current of both the inverter and the building power to track consumption. I'm also measuring the battery voltage and the DC current coming from each charge controller to the batteries. I don't care what the panels are producing. I care what the charge controllers are actually sending to the batteries. I've also recently added a shunt to monitor the DC output of the batteries to the inverter. The inverter consumes power even when not being used so, I want to know how much. I'm just using one of those cheap meters at the moment, but I will add it to one of the ADCs soon.
I've started to add some automation to the setup. I discovered in testing that the transfer switch was switching back to the inverter as soon as we got a good sunny day even if the batteries were low. This happens because the charge controllers raise the current to charge. No way around this so I decided to make one in code. Now I track what I call a charge event (when the system switches to building power). I then track how much power is being stored in the batteries and don't switch over until enough have been stored. The tricky part here is putting a relay on the battery monitor wires that go to the transfer switch. I break the connection so the transfer switch thinks there is no battery and therefore can't switch back. When my program reconnects the relay, the transfer switch can then see the battery and switches back to the inverter. So far this has worked well, but I need to tune the process.
I've gotten cocky and added one more layer. My AIMS 2K inverter has a port for an external remote switch. I've attached that to a relay so now when the system switches to building power, I can turn off the inverter. It basically uses about 23watts continuously. Doesn't seem like much but if we have a week of cloudy weather, it consumes most of the power the panels are providing. This new feature is still being debugged, but I should have it working soon. If you are interested in more detail, let me know.