Thursday, July 07, 2022

Live PV solar monitor

If you have solar photo voltaic panels it's good to know how much is being generated so you can choose when to use power such as the tumble dryer. Using power locally, from the panels, is much more economical than receiving the feed-in tariff and buying power back at other times.

In a previous home we installed a PV solar system that had a Fronius inverter. I was impressed with the low RF noise emitted by this product and pleased to find that it had a JSON producing web service endpoint that I could poll to see how much power was being generated.

At our new home there is a system with micro-inverters and an Envoy controller. The micro-inverters do produce noticeable RF noise but bear in mind that this is a very low noise location so I might be a little sensitive to it.

It turns out that this system also has JSON producing web services. The system, once I figured out how to connect to our Wifi, has a web interface at http://envoy.local 

By enabling Developer mode in the browser I was able to see that the web page calls back to endpoints including:

  • home.json
  • production.json
  • Inventory.json
  • info.xml
  • dba.json
I haven't explored them all, but production.json gives me the data I need.

Here's a snippet showing how I get the generated power and the used power from the content returned from production.json

DynamicJsonDocument doc(3072);
DeserializationError error = deserializeJson(doc, payload);

if (error) {
USE_SERIAL.printf("Json error");


// Extract current power generated from the Envoy controller JSON

long genWattsNow = doc["production"][1]["wNow"];
long useWattsNow = doc["consumption"][0]["wNow"];

Using a nifty M5StickC device, which has an ESP32 and a little LCD display, I've stuck together sample code for an http client and Json parser to display the currently generated power and the currently used power. I'm happy to share the code but honestly, there's not much to it beyond the HTTP sample code.

1 comment:

Simon Rumble VK2VSR said...

I have the Enphase gear too, it's awesome. There's a Home Assistant integration that pulls it all in. You can then have ESPHome drive displays with it. I built a thing using an ESP32 and some MAX7219 matrix lights to show red and green for consumption vs production in real time. Super easy for everyone in the house to know when to put the clothes dryer, dishwasher etc on.

Also use it in dashboards around the house too.