[OH3] Enphase, Envoy-S-Metered via HTTP binding

This is how I have, with some help from the community, started to integrate my Enphase PV system into openHAB. There are a few posts scattered around about accessing the JSON data on the Envoy directly and I liked the idea of getting the data from my LAN rather than via the Enphase website API. I also like the idea of refreshing the data every minute or so rather than the 15 minutes via the Enphase website.

Apart from an Enphase Envoy I have used the HTTP binding and the JsonPath transformation.

LAN pages that I have come across, (of course change to your Envoy IP)
http://192.168.1.216/production.json?details=1
http://192.168.1.216/api/v1/consumption
http://192.168.1.216/api/v1/production
http://192.168.1.216/production.json

Individual inverter data,
http://192.168.1.216/api/v1/production/inverters
User: envoy
Pass: 123456 (last 6 digits of the serial number)

I have used 2 of the links above,

Data Link:
http://192.168.1.216/production.json?details=1

1. Create HTTP thing

2. Create Channels

There is quite a lot of data available that can be added as separate channels under the areas of production, consumption & storage. Consumption of course requires your install to have the consumption CT’s installed, storage the same likely requires your install to have the Enphase storage installed.

The below is the data I have linked to Channels however there is more data and can be explored via loading the JSON data into a evaluator like this one, https://jsonpath.herokuapp.com

i. Select, Add Channel. Give it a name, most will be Number Channels, add the appropriate JSONPATH and Save.

ii. Under the New Channel,

  • ‘Add Link to Item’
  • ‘Create New Item’
  • Profile, select ‘Default’

After a short time you should see your item populate with its data,

The ones I have used are below,
Production:
JSONPATH:$.production.[0].activeCount
JSONPATH:$.production.[1].whToday
JSONPATH:$.production.[1].whLifetime
JSONPATH:$.production.[1].whLastSevenDays
JSONPATH:$.production.[1].rmsCurrent
JSONPATH:$.production.[1].pwrFactor
JSONPATH:$.production.[1].lines.[0].wNow
JSONPATH:$.production.[1].lines.[1].wNow
JSONPATH:$.production.[1].lines.[2].wNow
JSONPATH:$.production.[1].lines.[0].rmsCurrent
JSONPATH:$.production.[1].lines.[1].rmsCurrent
JSONPATH:$.production.[1].lines.[2].rmsCurrent
JSONPATH:$.production.[1].lines.[0].rmsVoltage
JSONPATH:$.production.[1].lines.[1].rmsVoltage
JSONPATH:$.production.[1].lines.[2].rmsVoltage
Consumption:
JSONPATH:$.consumption.[0].wNow
JSONPATH:$.consumption.[0].whToday
JSONPATH:$.consumption.[0].whLastSevenDays
JSONPATH:$.consumption.[0].rmsCurrent
JSONPATH:$.consumption.[0].lines.[0].wNow
JSONPATH:$.consumption.[0].lines.[1].wNow
JSONPATH:$.consumption.[0].lines.[2].wNow
JSONPATH:$.consumption.[0].lines.[0].rmsCurrent
JSONPATH:$.consumption.[0].lines.[1].rmsCurrent
JSONPATH:$.consumption.[0].lines.[2].rmsCurrent
JSONPATH:$.consumption.[0].lines.[0].rmsVoltage
JSONPATH:$.consumption.[0].lines.[1].rmsVoltage
JSONPATH:$.consumption.[0].lines.[2].rmsVoltage
Net Consumption:
JSONPATH:$.consumption.[1].wNow
JSONPATH:$.consumption.[1].rmsCurrent

Individual inverter data can also be collected from,
http://192.168.1.216/api/v1/production/inverters
User: envoy
Pass: 123456 (last 6 digits of the serial number)

1. Create HTTP thing
This URL requires authentication, click ‘Show Advanced’ and add the user/pass(last 6 digits of Envoy serial)
Select, ‘Digest Authentication’ and save.

Similar process for adding channels.
The channels available for each inverter are,

JSONPATH:$.[0]serialNumber
JSONPATH:$.[0]lastReportWatts
JSONPATH:$.[0]maxReportWatts
JSONPATH:$.[0]lastReportDate

The above should help getting your Enphase data into Items within your openHAB, I tried a few different refresh times and settled on 70 seconds. In my testing it all seemed work fine with a refresh time of 5 seconds but seemed a bit unnecessary.

After modifying a chart from the openHAB demo site I have made the below that shows some data in a useful format,

config:
  chartType: day
  label: Solar Chart
  sidebar: true
  order: ""
slots:
  grid:
    - component: oh-chart-grid
      config:
        bottom: 80
        top: "120"
  xAxis:
    - component: oh-category-axis
      config:
        gridIndex: 0
        categoryType: day
        weekdayFormat: default
        monthFormat: default
        axisPointer:
          snap: true
          handle:
            show: true
            backgroundColor: blue
          label:
            show: true
            backgroundColor: "#2196f3"
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: W
  series:
    - component: oh-aggregate-series
      config:
        name: Consumption (Day Before)
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: line
        color: red
        item: EnphaseDetailed_EnphaseConsumptionwNow
        dimension1: hour
        offsetAmount: 1
        offsetUnit: day
        smooth: true
        lineStyle:
          type: dotted
          opacity: 0.8
    - component: oh-aggregate-series
      config:
        name: Consumption (Current)
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: line
        color: red
        item: EnphaseDetailed_EnphaseConsumptionwNow
        dimension1: hour
        smooth: true
        lineStyle:
          width: 3
        areaStyle:
          opacity: 0.2
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - type: min
              name: min
            - type: max
              name: max
    - component: oh-aggregate-series
      config:
        name: Net Consumption
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        color: blue
        item: EnphaseDetailed_EnphaseNetConsumptionwNow
        dimension1: hour
    - component: oh-aggregate-series
      config:
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: line
        color: green
        name: Production (Current)
        item: EnphaseDetailed_EnphasewNow1
        dimension1: hour
        smooth: true
        lineStyle:
          width: 3
        areaStyle:
          opacity: 0.2
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - type: min
              name: min
            - type: max
              name: max
    - component: oh-aggregate-series
      config:
        name: Production (Day before)
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: line
        color: green
        item: EnphaseDetailed_EnphasewNow1
        dimension1: hour
        offsetAmount: 1
        offsetUnit: day
        smooth: true
        lineStyle:
          type: dotted
          opacity: 0.8
  tooltip:
    - component: oh-chart-tooltip
      config:
        show: true
        orient: vertical
        confine: true
  title:
    - component: oh-chart-title
      config:
        show: true
        subtext: Sampled every hour
        text: Solar Chart
  visualMap: []
  legend:
    - component: oh-chart-legend
      config:
        show: true
        orient: horizontal
        bottom: left

I have only installed about a third of my system and I am still looking for other ways to display the data in interesting ways and thinking up some rules I can put in place to use the solar production more intelligently.

If you have any ideas please post them.

2 Likes

Part of this could be done in fewer steps by using the Enphase binding that is submitted to be included:

I have more or less followed your process and it is working well. I have the IQ Envoy.

This page: http://192.168.0.126/api/v1/production shows this:

{
  "wattHoursToday": 14049,
  "wattHoursSevenDays": 183047,
  "wattHoursLifetime": 10087637,
  "wattsNow": 4957
}

So channels are:
JSONPATH:$.wattHoursToday
etc…

Related to this, I am having trouble converting Wh to kWh. Starting with this:


from

I want to convert to kWh. So;


becomes

All good. But after the next update (I have it at 120 sec), it reverts back to this:

I’m sure I am missing something, hoping someone can tell me what that is.

Thanks for the instructional. Working well overall.

Hello,
your solar chart is very nice. I also got it to work. I added additional the battery consuption.

But I would like to display an average every quarter of an hour and I struggle with the entry “dimension1”. Where is this coming from? What do I have to do to change from hour to quarter of an hour?

Any update for the new api with firmware 7 ? thanks a lot

1 Like