Enphase Envoy-s metered

If you are adventurous, try the Jython route. Then you can use the script I posted above. See this thread on installation. I’ve given the Jython code for production and you can easily add consumption. I like the Python/Jython over rules DSL, but that’s my preference.

The absolute easiest way to do this is to install the json path transformation and the http binding.

Then you can put something like this in your services/http.cfg file:

# Enphase Envoy
http:envoy.url=http://192.168.86.210/api/v1/production
# refresh every 10 minutes
http:envoy.updateInterval=600000

Then have items such as these:

Number EnvoyPower             "Solar Power [%.2f W]" { http="<[envoy:600000:JSONPATH($.wattsNow)]" }
Number EnvoyEnergyToday       "Solar Energy Today [%.2f Wh]" { http="<[envoy:600000:JSONPATH($.wattHoursToday)]" }
Number EnvoyEnergy7Days       "Solar Energy 7 Days [%.2f Wh]" { http="<[envoy:600000:JSONPATH($.wattHoursSevenDays)]" }
Number EnvoyEnergyLifetime    "Solar Energy Lifetime [%.2f Wh]" { http="<[envoy:600000:JSONPATH($.wattHoursLifetime)]" }

Just add more for consumption.

Alas, the http binding is v1, so it will go obsolete with OH3 when we get there. So yes, a better long term choice is the sendHttpGetRequest as you mention. It’s the same concept. Set up a rule that runs periodically, sends out the request, and parses the result. I can see if I can find anything like this in my rules if you wish. You take the result and apply the json transformation to get the values you want similar to this:

var float solarPower= Float::parseFloat(transform("JSONPATH", "$.wattsNow", responseData))

the above pops it into a variable, but I think you could just as well get this directly to an Item.