Similar to Enphase Envoy integration in Emoncms
and Enphase EnvoyS integration in Emoncms (multiphase) I’ve written my own code to get data out of my Envoy-S and into EmonCMS.
The main difference is that I’m using a “hidden” URL that requires the installer password which provides a constant stream of readings via a text/event-stream after a single “Get” request.
The Envoy-S provides the following event containing a json object about every second (I’ve included comments in the first entry below to line up with the json available in more well known URLs on the Envoy):
data: {
"production": {
"ph-a": {
"p": 54.745, // wNow
"q": 155.094, // reactPower
"s": 185.367, // apprntPwr
"v": 246.186, // rmsVoltage
"i": 0.752, // rmsCurrent
"pf": 0.31, // pwrFactor
"f": 50.0 // frequency
},
"ph-b": {
"p": 49.576,
"q": 139.221,
"s": 179.72,
"v": 248.261,
"i": 0.723,
"pf": 0.28,
"f": 50.0
},
"ph-c": {
"p": 42.27,
"q": 119.811,
"s": 131.106,
"v": 245.835,
"i": 0.532,
"pf": 0.33,
"f": 50.0
}
},
"net-consumption": {
"ph-a": {
"p": 1184.274,
"q": 247.115,
"s": 1220.902,
"v": 246.192,
"i": 4.958,
"pf": 0.97,
"f": 50.0
},
"ph-b": {
"p": 529.541,
"q": -331.655,
"s": 655.161,
"v": 248.442,
"i": 2.644,
"pf": 0.81,
"f": 50.0
},
"ph-c": {
"p": 331.505,
"q": -159.651,
"s": 387.287,
"v": 245.998,
"i": 1.575,
"pf": 0.87,
"f": 50.0
}
},
"total-consumption": {
"ph-a": {
"p": 1239.019,
"q": 92.021,
"s": 1405.839,
"v": 246.189,
"i": 5.71,
"pf": 0.88,
"f": 50.0
},
"ph-b": {
"p": 579.117,
"q": -470.876,
"s": 836.026,
"v": 248.352,
"i": 3.366,
"pf": 0.69,
"f": 50.0
},
"ph-c": {
"p": 373.775,
"q": -279.463,
"s": 518.086,
"v": 245.916,
"i": 2.107,
"pf": 0.72,
"f": 50.0
}
}
}
For completeness, ph-a, ph-b and ph-c are my 3 phases and that snapshot was taken late in the afternoon as the sun was going down.
I take the production (ignoring anything below 5W per phase) and then subtract the consumption to produce the nett, basically ignoring the net-consumption
provided by the Envoy-S as it’s always “wrong” once the Inverters shut down at night and my OCD doesn’t like seeing a non-zero production number at night.
The specific URL I’m using is http://envoy.local/stream/meter but as I mentioned above. it requires digest authentication and the installer username and password.
Thankfully, someone else has already done the work to allow you to get the installer password for your particular Envoy-S as long as you have the serial number. That same blog is also a great source of information on the available URLs on the Envoy-S.
I’m also using this same stream to provide real-time updates (well, about every second) on my home-brew weather station display which runs on an old iPad 1.
The EmonCMS importer is written in Python 3 and runs as a service on my EmonSD based Pi.
The real-time display uses html for the page itself and PHP on the Pi that hosts WeeWX for the eventstream. I couldn’t use javascript on the page to read the eventstream directly from the Envoy because it gets blocked by CORS rules in every modern browser, so I proxy the request via PHP on the Pi.
That Weather dashboard should work against any WeeWx based weather station as it just uses the cumulus realtime plug-in. I should also mention that it uses some modern HTML rendering techniques, but others that would work better are NOT used because they simply don’t work in iOS 5.1.1 which is the latest available on an old iPad 1
If there’s any interest, I’ll tidy up the code used for these and post it here.