Enphase - Envoy V7 local API to CURL-JSON on Windows

Sorry about that! :slight_smile:

I’m trying:

Thing http:url:sol_http "Solar HTTP" [
    baseURL="http://192.168.1.xxx/production.json",
    headers="key1=Accept: application/json", "key2=Authorization: Bearer eyJra***",
    refresh=15,
    ignoreSSLErrors=true ] {
        Channels:
			Type number  : Prod "Production" [ stateTransformation="JSONPATH:$..production[1].wNow" ]
			Type number  : Use "Consumption 0" [ stateTransformation="JSONPATH:$..consumption[0].wNow" ]
			Type number  : Net "Consumption 1" [ stateTransformation="JSONPATH:$..consumption[1].wNow" ]
}

but I’m getting errors

Requesting 'https://192.168.1.xxx/production.json' (method='GET', content='null') failed: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header

My head is hurting now!!

I can probably help you once my system breaks - right now I get this output when I use http://192.168.123.22/production.json in the browser - what error do you see?

You have ignore SSL bout you are using http not https - should you be suing HTTPS?

One you figure out the http call the channel with JSON transform should work

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 30,
      "readingTime": 1681590167,
      "wNow": 1590,
      "whLifetime": 27407936
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "production",
      "readingTime": 1681590261,
      "wNow": 1344.644,
      "whLifetime": 27283081.304,
      "varhLeadLifetime": 0.407,
      "varhLagLifetime": 13683252.397,
      "vahLifetime": 36479980.518,
      "rmsCurrent": 12.228,
      "rmsVoltage": 246.065,
      "reactPwr": 614.603,
      "apprntPwr": 1504.465,
      "pwrFactor": 0.89,
      "whToday": 13406.304,
      "whLastSevenDays": 202231.304,
      "vahToday": 18466.518,
      "varhLeadToday": 0.407,
      "varhLagToday": 8150.397
    }
  ],
  "consumption": [
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "total-consumption",
      "readingTime": 1681590261,
      "wNow": 794.547,
      "whLifetime": 42299346.701,
      "varhLeadLifetime": 17312781.309,
      "varhLagLifetime": 16855437.943,
      "vahLifetime": 57268113.353,
      "rmsCurrent": 2.912,
      "rmsVoltage": 246.044,
      "reactPwr": -1456.032,
      "apprntPwr": 716.564,
      "pwrFactor": 1,
      "whToday": 19382.701,
      "whLastSevenDays": 262173.701,
      "vahToday": 26862.353,
      "varhLeadToday": 9387.309,
      "varhLagToday": 9829.943
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "net-consumption",
      "readingTime": 1681590261,
      "wNow": -550.097,
      "whLifetime": 31325550.866,
      "varhLeadLifetime": 17312780.902,
      "varhLagLifetime": 3172185.546,
      "vahLifetime": 57268113.353,
      "rmsCurrent": 9.315,
      "rmsVoltage": 246.023,
      "reactPwr": -841.429,
      "apprntPwr": 1146.291,
      "pwrFactor": -0.49,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

It just takes you to the Envoy token page.

See: https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication for details.

i’m looking over the documentation and most of the call are https - if I try this https://192.168.123.22/ivp/meters I get unable to connect but it works with http://192.168.123.22/ivp/meters (output below) - I might be able to help you when my system upgrade to V7 and I’m able to make https calls

[
    {
        "eid": 704643328,
        "state": "enabled",
        "measurementType": "production",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    },
    {
        "eid": 704643584,
        "state": "enabled",
        "measurementType": "net-consumption",
        "phaseMode": "split",
        "phaseCount": 2,
        "meteringStatus": "normal",
        "statusFlags": []
    }
]

As far as I can tell from page 7 of the manual you have to use CURL to request the HTTPS data.

The IQ Gateway APIs can be accessed via curl commands with the Authorization Bearer option and HTTPS commands.

The format of the curl command is as follows: curl -f -k -H ‘Accept: application/json’ -H 'Authorization: Bearer ’ -X
where:
– k: allow self-signed certificate
– H: add http header with token
– X: used to pass method type for API command
– f: fail on error (gives better output in case of unauthenticated redirection)
– L: follow redirects (can use http and allow https redirection)

E.g.: curl -f -k -H ‘Accept: application/json’ -H 'Authorization: Bearer eyJraWQiOi…’ -X GET https:///api/v1/production/inverters

This is not the correct way to add headers.

Check the link I posted further up.

You can make https call from “http binding” it should be equivalent to curl or wget, There is a way to specify GET/PUT/POST (GET is default) - it is just a matter of figuring out the headers format, i would turn on verbose on the http binding and see what response you are getting from using something like this or different combinations. I’m not familiar with headers formatting and i can not do any testing until the software upgrade.

Thing http:url:sol_http "Solar HTTP" [
    baseURL="https://192.168.1.xxx/production.json",
    headers="Accept: application/json", "Authorization: Bearer eyJraWQiOi...’",
    refresh=15,
    ignoreSSLErrors=true ] {
        Channels:
			Type number  : Prod "Production" [ stateTransformation="JSONPATH:$..production[1].wNow" ]
			Type number  : Use "Consumption 0" [ stateTransformation="JSONPATH:$..consumption[0].wNow" ]
			Type number  : Net "Consumption 1" [ stateTransformation="JSONPATH:$..consumption[1].wNow" ]
}

Based on this post → How to send header via HTTP binding? - #14 by mark56 you do not need “keyx”

I was using the example in the binding document. Unfortunately even your suggestion doesn’t work.

Thing http:url:sol_http "Solar HTTP" [
    baseURL="http://192.168.1.xxx/ivp/meters/readings",
    headers="Authorization=Bearer eyJraxxx", "Content-Type=application/json", "Accept=application/json",
	refresh = "10",
	delay = "1000",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	commandMethod = "GET",
	authMode = "BASIC" ] {

	Channels:
		Type string : reading_01 "Reading 01" [
			mode = "READWRITE"
			]
}
Requesting 'https://192.168.1.xxx/ivp/meters/readings' (method='GET', content='null') failed: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header

I tried with authMode set to BASIC, BASIC_PREEMPTIVE and DIGEST but that didn’t work.

I guess the authentication isn’t getting sent through. I’ll look more tomorrow,

Setting http binding to TRACE gives the following in the logs:

Requesting refresh (retry=false) from 'http://192.168.1.xxx/ivp/meters/readings' with timeout 3000ms
22:44:44.652 [TRACE] [http.internal.http.RefreshingUrlCache] - Sending to 'http://192.168.1.xxx/ivp/meters/readings': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, Authorization: Bearer eyJraxxx, Content-Type: application/json, Accept: application/json}, Content = {null}
22:44:44.985 [TRACE] [tp.internal.http.HttpResponseListener] - Received from 'https://192.168.1.xxx/ivp/meters/readings': Code = {401}, Headers = {Server: openresty/1.17.8.1, Date: Sat, 15 Apr 2023 21:45:45 GMT, Content-Type: text/html, Content-Length: 555, Connection: keep-alive}, Content = {<html>
<head><title>401 Authorization Required</title></head>
<body>
<center><h1>401 Authorization Required</h1></center>
<hr><center>Redirecting to <a id='link' href=''></a></center>
<script>
const redirect_url = window.location.protocol + '//' + window.location.host + '/home';
function redirect() { window.location.href = redirect_url; }
window.onload = function() {
    const link = document.getElementById('link');
    link.href = redirect_url;
    link.text = redirect_url;
    setTimeout(redirect, 500);
}
</script>
</body>
</html>
}
22:44:44.985 [WARN ] [tp.internal.http.HttpResponseListener] - Requesting 'https://192.168.1.xxx/ivp/meters/readings' (method='GET', content='null') failed: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header

Which uses key=value pairs, but you used key=key:value

The headers seem to be sent, at least, judging by the trace logging

Note that your CURL example didn’t send a Content-Type header, so you may wish to try without on the HTTP Binding.

And just checking: your baseURL is http but your log shows a receipt from https. Do you need to send to https, as per your manual extract?

That was it!!

After all the messing around I’d pasted the wrong URL missing off the ‘s’ of the http bit.

Thing http:url:sol_http "Solar HTTP" [
    baseURL="https://192.168.1.xxx/ivp/meters/readings",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ] {

	Channels:
		Type string : reading_01 "Reading 01" [
			mode = "READWRITE"
			]
}

The above doesn’t give any errors. Later today I’ll see it I can get data into the channel/item.

1 Like

I understand that this is not required any longer nevertheless this error message normally means that the porgram ( curl ) cannot be found via the PATH variable. Using the full path and the executable should solve it.

Yep, adding C:\Windows\System32\curl.exe seems to work.

Thanks.

After some playing around the http binding route seems the best. I have:

Thing http:url:sol_http "Solar HTTP" [
    baseURL="https://192.168.1.xxx/ivp/meters/readings",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "100",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ] {

	Channels:
		Type number  : reading_01 "Reading 01" [ 
		mode = "READONLY",
		stateTransformation="JSONPATH:$.apparentPower" 
		]
}

In the logs, every 10 seconds I get:

2023-04-16 19:06:56.655 [WARN ] [.transform.SingleValueTransformation] - Executing transformation ChannelStateTransformation{pattern='$.apparentPower', serviceName='JSONPATH'} failed: Invalid path '$.apparentPower' in '[
{
"eid": 704643328,
"timestamp": 1681668479,
"actEnergyDlvd": 182213.465,
"actEnergyRcvd": 0.000,
"apparentEnergy": 208439.291,
"reactEnergyLagg": 35347.642,
"reactEnergyLead": 0.094,
"instantaneousDemand": 117.260,
"activePower": 117.260,
"apparentPower": 231.539,
"reactivePower": 199.604,
"pwrFactor": 0.548,
"voltage": 248.462,
"current": 0.931,
"freq": 50.125,
"channels": [
{
"eid": 1778385169,
"timestamp": 1681668479,
"actEnergyDlvd": 182213.465,
"actEnergyRcvd": 0.000,
"apparentEnergy": 208439.291,
"reactEnergyLagg": 35347.642,
"reactEnergyLead": 0.094,
"instantaneousDemand": 117.260,
"activePower": 117.260,
"apparentPower": 231.539,
"reactivePower": 199.604,
"pwrFactor": 0.548,
"voltage": 248.462,
"current": 0.931,
"freq": 50.125
},
{
"eid": 1778385170,
"timestamp": 1681668479,
"actEnergyDlvd": 91.431,
"actEnergyRcvd": 0.000,
"apparentEnergy": 240.741,
"reactEnergyLagg": 16.735,
"reactEnergyLead": 0.059,
"instantaneousDemand": 0.000,
"activePower": 0.000,
"apparentPower": 0.991,
"reactivePower": 0.000,
"pwrFactor": 0.000,
"voltage": 6.227,
"current": 0.159,
"freq": 50.125
},
{
"eid": 1778385171,
"timestamp": 1681668479,
"actEnergyDlvd": 0.000,
"actEnergyRcvd": 69.574,
"apparentEnergy": 109.760,
"reactEnergyLagg": 16.698,
"reactEnergyLead": 0.035,
"instantaneousDemand": 0.000,
"activePower": 0.000,
"apparentPower": 0.444,
"reactivePower": -0.000,
"pwrFactor": 0.000,
"voltage": 3.361,
"current": 0.132,
"freq": 50.125
}
]
},
{
"eid": 704643584,
"timestamp": 1681668479,
"actEnergyDlvd": 69479.639,
"actEnergyRcvd": 94971.972,
"apparentEnergy": 272627.664,
"reactEnergyLagg": 33.081,
"reactEnergyLead": 171732.087,
"instantaneousDemand": 400.540,
"activePower": 400.540,
"apparentPower": 977.709,
"reactivePower": -834.471,
"pwrFactor": 0.388,
"voltage": 248.366,
"current": 3.932,
"freq": 50.125,
"channels": [
{
"eid": 1778385425,
"timestamp": 1681668479,
"actEnergyDlvd": 69479.639,
"actEnergyRcvd": 94971.972,
"apparentEnergy": 272627.664,
"reactEnergyLagg": 33.081,
"reactEnergyLead": 171732.087,
"instantaneousDemand": 400.540,
"activePower": 400.540,
"apparentPower": 977.709,
"reactivePower": -834.471,
"pwrFactor": 0.388,
"voltage": 248.366,
"current": 3.932,
"freq": 50.125
},
{
"eid": 1778385426,
"timestamp": 1681668479,
"actEnergyDlvd": 0.000,
"actEnergyRcvd": 699.135,
"apparentEnergy": 0.920,
"reactEnergyLagg": 16.475,
"reactEnergyLead": 0.013,
"instantaneousDemand": 0.000,
"activePower": 0.000,
"apparentPower": -0.000,
"reactivePower": 0.000,
"pwrFactor": 0.000,
"voltage": 1.192,
"current": -0.000,
"freq": 50.125
},
{
"eid": 1778385427,
"timestamp": 1681668479,
"actEnergyDlvd": 0.000,
"actEnergyRcvd": 929.976,
"apparentEnergy": 226.311,
"reactEnergyLagg": 16.488,
"reactEnergyLead": 0.000,
"instantaneousDemand": -0.537,
"activePower": -0.537,
"apparentPower": 0.920,
"reactivePower": 0.000,
"pwrFactor": -1.000,
"voltage": 4.946,
"current": 0.187,
"freq": 50.125
}
]
}
]'

Can anyone please help convert the output into the individual values?

This code is working for me - please correct the things definition file for your setting since i had to change to back to http since my version is older.

Thing http:url:sol_http "Solar HTTP" [
    baseURL="https://192.168.1.xxx/ivp/meters/readings",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = 30,
	delay = "100",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ] {

	Channels:
			Type number  : ACTPWR0 "ActivePower" [ stateTransformation="JSONPATH:$.[0].activePower" ]
			Type number  : APPPWR0 "ApparentPower" [ stateTransformation="JSONPATH:$.[0].apparentPower" ]
			Type number  : RECPWR0 "ReactivePower" [ stateTransformation="JSONPATH:$.[0].reactivePower" ]
			Type number  : VOLT0 "Voltage" [ stateTransformation="JSONPATH:$.[0].voltage" ]
			Type number  : AMP0 "Current" [ stateTransformation="JSONPATH:$.[0].current" ]
			Type number  : FREQ0 "Freq" [ stateTransformation="JSONPATH:$.[0].freq" ]

			Type number  : ACTPWR00 "ActivePower" [ stateTransformation="JSONPATH:$.[0].channels[0].activePower" ]



			Type number  : ACTPWR1 "ActivePower" [ stateTransformation="JSONPATH:$.[1].activePower" ]
			Type number  : APPPWR1 "ApparentPower" [ stateTransformation="JSONPATH:$.[1].apparentPower" ]
			Type number  : RECPWR1 "ReactivePower" [ stateTransformation="JSONPATH:$.[1].reactivePower" ]
			Type number  : VOLT1 "Voltage" [ stateTransformation="JSONPATH:$.[1].voltage" ]
			Type number  : AMP1 "Current" [ stateTransformation="JSONPATH:$.[1].current" ]
			Type number  : FREQ1 "Freq" [ stateTransformation="JSONPATH:$.[1].freq" ]
}

There are two elements you you access each one with the first [x]

Type number  : ACTPWR0 "ActivePower" [ stateTransformation="JSONPATH:$.[0].activePower" ]

Inside each element theres are 3 channels you can acces each one with [x].channels[y]

Type number  : ACTPWR00 "ActivePower" [ stateTransformation="JSONPATH:$.[0].channels[0].activePower" ]

Items should look like this

Number   SolarHTTPACTPWR0    "Active power"     {channel="http:url:sol_http:ACTPWR0"}
Number   SolarHTTPAPPPWR0    "Apparent power"   {channel="http:url:sol_http:APPPWR0"}
Number   SolarHTTPRECPWR0    "Reactive power"   {channel="http:url:sol_http:RECPWR0"}
Number   SolarHTTPVOLT0      "Voltage"          {channel="http:url:sol_http:VOLT0"}
Number   SolarHTTPAMP0       "Current"          {channel="http:url:sol_http:AMP0"}
Number   SolarHTTPFREQ0      "Freq"             {channel="http:url:sol_http:FREQ0"}
Number   SolarHTTPACTPWR00   "Active power"     {channel="http:url:sol_http:ACTPWR00"}
Number   SolarHTTPACTPWR1    "Active power"     {channel="http:url:sol_http:ACTPWR1"}
Number   SolarHTTPAPPPWR1    "Apparent power"   {channel="http:url:sol_http:APPPWR1"}
Number   SolarHTTPRECPWR1    "Reactive power"   {channel="http:url:sol_http:RECPWR1"}
Number   SolarHTTPVOLT1      "Voltage"          {channel="http:url:sol_http:VOLT1"}
Number   SolarHTTPAMP1       "Current"          {channel="http:url:sol_http:AMP1"}
Number   SolarHTTPFREQ1      "Freq"             {channel="http:url:sol_http:FREQ1"}


image

Perfect!

I’d just worked out it is an array JSON.

It all seems to be working for the first entry I tested.

Hopefully all this will help others as they get upgraded to V7 on their envoys.

Thanks all for your assistance so far, it’s very much appreciated.

The final decision, with thanks to all who have had an input and @LORDUDE for his specific Enphase information, was to go down the HTTP Binding route. The two current transformers (CTs) in my system record production from the solar PV and net-consumption. The net-consumption is a negative value when power is being exported to the grid and positive when being imported from the grid. Both CTs report 3 phase values but only phase one has any real data and is not needed in my setup.

The URLs I have found to be most useful are:

  • Below gives EID of the (CTs) that are connected to the system
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/ivp/meters
  • Below gives all values for enabled CT channels listed in previous request
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/ivp/meters/readings
  • Below gives today, 7 days, lifetime, now Watt Hours production
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/api/v1/production
  • Below gives today, 7 days, lifetime, now Watt Hours consumption
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/api/v1/consumption
  • Gives cumulative production in WHs plus current production values
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/ivp/meters/reports/production
  • Gives cumulative consumption in WHs plus current consumption values that the house load is using.
curl -f -k -H "Accept: application/json" -H "Authorization: Bearer YOUR TOKEN HERE" -X GET https://ENVOY IP HERE/ivp/meters/reports/consumption

Using the following Things, Items and Sitemap I think I have all the useful data I need. I will look to create some Rules to convert consumption values into cost and another to take production values away from net-consumtion (power to/from the grid) to give a house consumption value.

Although parts of the Enphase manual say that most data is updated every 5 minutes, using a refresh rate of 10 seconds to the binding gives new values that match the ‘live’ data in the Enphase app when querying /ivp/meters/readings. The data when querying api/v1/production doesn’t seem to change often so probably doesn’t get updated until each 5 minute cycle.

Solar_http.things

Thing http:url:sol_http "Solar HTTP" [
    baseURL="https://192.168.1.xxx/ivp/meters/readings",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ]  {

	Channels:
		Type number : ACTPWR0 "ActivePower - Production" [ stateTransformation="JSONPATH:$.[0].activePower" ] 				
		Type number : VOLT0 "Voltage - Production" [ stateTransformation="JSONPATH:$.[0].voltage" ] 
		Type number : AMP0 "Current - Production" [ stateTransformation="JSONPATH:$.[0].current" ] 
		Type number : FREQ0 "Freq - Production" [ stateTransformation="JSONPATH:$.[0].freq" ]
		Type number : ACTPWR1 "ActivePower - Net-Consumption (GRID)" [ stateTransformation="JSONPATH:$.[1].activePower" ]
		Type number : VOLT1 "Voltage - Net-Consumption" [ stateTransformation="JSONPATH:$.[1].voltage" ]
		Type number : AMP1 "Current - Net-Consumption" [ stateTransformation="JSONPATH:$.[1].current" ]
		Type number : FREQ1 "Freq - Net-Consumption" [ stateTransformation="JSONPATH:$.[1].freq" ]
		Type number : ACTPWR00 "ActivePower - Prod PH 1" [ stateTransformation="JSONPATH:$.[0].channels[0].activePower" ]
		Type number : ACTPWR01 "ActivePower - Prod PH 2" [ stateTransformation="JSONPATH:$.[0].channels[1].activePower" ]
		Type number : ACTPWR02 "ActivePower - Prod PH 3" [ stateTransformation="JSONPATH:$.[0].channels[2].activePower" ]
}

Solar_http.items

Number   SolarHTTPACTPWR0    "Active power - Production [%d W]"     {channel="http:url:sol_http:ACTPWR0"}
Number   SolarHTTPVOLT0      "Voltage - Production [%d V]"          {channel="http:url:sol_http:VOLT0"}
Number   SolarHTTPAMP0       "Current - Production [%.2f A]"          {channel="http:url:sol_http:AMP0"}
Number   SolarHTTPFREQ0      "Freq - Production [%d Hz]"             {channel="http:url:sol_http:FREQ0"}
Number   SolarHTTPACTPWR1    "Active power - Net-Consumption (GRID) [%d W]"     {channel="http:url:sol_http:ACTPWR1"}
Number   SolarHTTPVOLT1      "Voltage - Net-Consumption [%d V]"          {channel="http:url:sol_http:VOLT1"}
Number   SolarHTTPAMP1       "Current - Net-Consumption [%.2f A]"          {channel="http:url:sol_http:AMP1"}
Number   SolarHTTPFREQ1      "Freq - Net-Consumption [%d Hz]"             {channel="http:url:sol_http:FREQ1"}
Number   SolarHTTPACTPWR00   "Active power - Prod PH01 [%d W]"     {channel="http:url:sol_http:ACTPWR00"}
Number   SolarHTTPACTPWR01   "Active power - Prod PH02 [%d W]"     {channel="http:url:sol_http:ACTPWR01"}
Number   SolarHTTPACTPWR02   "Active power - Prod PH03 [%d W]"     {channel="http:url:sol_http:ACTPWR02"}

Solar_apiv1_http.things

Thing http:url:sol_http_apiv1_prod "Solar HTTP API Production" [
    baseURL="https://192.168.1.xxx/api/v1/production",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ]  {

	Channels:
		Type number : PROD_WH_DAY "WATT HOURS TODAY - Production" [ stateTransformation="JSONPATH:$.wattHoursToday" ] 			
		Type number : PROD_WH_7DAY "WATT HOURS LAST 7 DAYS - Production" [ stateTransformation="JSONPATH:$.wattHoursSevenDays" ]
		Type number : PROD_WH_LTIME "WATT HOURS LIFETIME - Production" [ stateTransformation="JSONPATH:$.wattHoursLifetime" ]
		Type number : PROD_WH_NOW "WATT HOURS NOW - Production" [ stateTransformation="JSONPATH:$.wattsNow" ]
}

Thing http:url:sol_http_apiv1_consum "Solar HTTP API Consumption" [
    baseURL="https://192.168.1.xxx/api/v1/consumption",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ]  {

	Channels:
		Type number : CONSUM_WH_DAY "WATT HOURS TODAY - Consumption" [ stateTransformation="JSONPATH:$.wattHoursToday" ] 			
		Type number : CONSUM_WH_7DAY "WATT HOURS LAST 7 DAYS - Consumption" [ stateTransformation="JSONPATH:$.wattHoursSevenDays" ]
		Type number : CONSUM_WH_LTIME "WATT HOURS LIFETIME - Consumption" [ stateTransformation="JSONPATH:$.wattHoursLifetime" ]
		Type number : CONSUM_WH_NOW "WATT HOURS NOW - Consumption" [ stateTransformation="JSONPATH:$.wattsNow" ]
}

Solar_apiv1_http.items

Number   SolarPROD_WH_DAY    "WATT HOURS TODAY- Production [%d WH]"     {channel="http:url:sol_http_apiv1_prod:PROD_WH_DAY"}
Number   SolarPROD_WH_7DAY    "WATT HOURS LAST 7 DAYS - Production [%d WH]"   {channel="http:url:sol_http_apiv1_prod:PROD_WH_7DAY"}
Number   SolarPROD_WH_LTIME    "WATT HOURS LIFETIME - Production [%d WH]"   {channel="http:url:sol_http_apiv1_prod:PROD_WH_LTIME"}
Number   SolarPROD_WH_NOW     "WATT HOURS NOW - Production [%d WH]"          {channel="http:url:sol_http_apiv1_prod:PROD_WH_NOW"}

Number   SolarCONSUM_WH_DAY    "WATT HOURS TODAY- Consumption [%d WH]"     {channel="http:url:sol_http_apiv1_consum:CONSUM_WH_DAY"}
Number   SolarCONSUM_WH_7DAY    "WATT HOURS LAST 7 DAYS - Consumption [%d WH]"   {channel="http:url:sol_http_apiv1_consum:CONSUM_WH_7DAY"}
Number   SolarCONSUM_WH_LTIME    "WATT HOURS LIFETIME - Consumption [%d WH]"   {channel="http:url:sol_http_apiv1_consum:CONSUM_WH_LTIME"}
Number   SolarCONSUM_WH_NOW     "WATT HOURS NOW - Consumption [%d WH]"          {channel="http:url:sol_http_apiv1_consum:CONSUM_WH_NOW"}

solar_http.sitemap

sitemap solar_http label="Solar Values From Envoy"
{
Frame label="Solar - Grid Power Values" { 	
	Default item=SolarHTTPACTPWR0
	Default item=SolarHTTPVOLT0
	Default item=SolarHTTPAMP0
	Default item=SolarHTTPFREQ0
	Default item=SolarHTTPACTPWR1
	Default item=SolarHTTPVOLT1
	Default item=SolarHTTPAMP1
	Default item=SolarHTTPFREQ1
	Default item=SolarHTTPACTPWR00
	Default item=SolarHTTPACTPWR01
	Default item=SolarHTTPACTPWR02
}
Frame label="Solar - API V1 Values" { 
	Default item=SolarPROD_WH_DAY
	Default item=SolarPROD_WH_7DAY
	Default item=SolarPROD_WH_LTIME
	Default item=SolarPROD_WH_NOW
	Default item=SolarCONSUM_WH_DAY
	Default item=SolarCONSUM_WH_7DAY
	Default item=SolarCONSUM_WH_LTIME
	Default item=SolarCONSUM_WH_NOW	
}
}

solar_report_http.things

Thing http:url:sol_http_report_prod "Solar HTTP Report Production" [
    baseURL="https://192.168.1.xxx/ivp/meters/reports/production",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ]  {

	Channels:
		Type number : PRODREP_CURRW "CURRENT WATTS - Production" [ stateTransformation="JSONPATH:$.cumulative.currW" ]		
		Type number : PRODREP_WHDLVDCUM "WATT HOURS CUMLATIVE - Production" [ stateTransformation="JSONPATH:$.cumulative.whDlvdCum" ]
}

Thing http:url:sol_http_report_consum "Solar HTTP Report Consumption" [
    baseURL="https://192.168.1.xxx/ivp/meters/reports/consumption",
    headers="Accept=application/json", "Authorization=Bearer eyJraxxx",
	refresh = "10",
	delay = "10",
	ignoreSSLErrors = "true",
	stateMethod = "GET",
	authMode = "BASIC" ]  {

	Channels:
		Type number  : CONSUMREP_AT_TIME "Report Created At - Consumption" [ stateTransformation="JSONPATH:$.[0].createdAt" ]
		Type number : CONSUMREP_CURRW "CURRENT WATTS - Consumption" [ stateTransformation="JSONPATH:$.[0].cumulative.currW" ]		
		Type number : CONSUMREP_WHDLVDCUM "WATT HOURS CUMLATIVE - Consumption" [ stateTransformation="JSONPATH:$.[0].cumulative.whDlvdCum" ]
}

solar_report_http.items

Number   SolarPRODREP_CURRW    "Report Current W - Production [%d W]"     {channel="http:url:sol_http_report_prod:PRODREP_CURRW"}
Number   SolarPRODREP_WHDLVDCUM "WATT HOURS CUMLATIVE - Production [%d WH]"     {channel="http:url:sol_http_report_prod:PRODREP_WHDLVDCUM"}

DateTime   SolarCONSUMREP_AT_TIME "Time report was taken - Consumption [%1$ta %1$tF %1$tT]"     {channel="http:url:sol_http_report_consum:CONSUMREP_AT_TIME"}
Number   SolarCONSUMREP_CURRW    "Report Current W - Consumption [%d W]"     {channel="http:url:sol_http_report_consum:CONSUMREP_CURRW"}
Number   SolarCONSUMREP_WHDLVDCUM "WATT HOURS CUMLATIVE - Consumption [%d WH]"     {channel="http:url:sol_http_report_consum:CONSUMREP_WHDLVDCUM"}
3 Likes

Are you using persistence to track historical usage? You can generate cool plots to track usage and production. I use rrd4j, it is fast and simple

Yes, I’m feeding it into influxdb and can then use grafana to show charts etc.

I’m going to give this enphase to MQTT script a go at some point: GitHub - mcrapts/enphase-to-mqtt: Read solar production data from your Enphase Envoy gateway and publish on MQTT

I need to find some spare time to install and setup docker etc.

this work too with version 7 ?

i have this error:

Requesting 'https://192.168.2.122/ivp/meters/readings' (method='GET', content='null') failed: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header