philip
Posts: 126
Joined: Tue Nov 27, 2012 8:18 pm
Delivery Date: 25 Aug 2015
Leaf Number: 327341
Location: El Cajon, CA

Getting TOU totals from Enphase

Mon Sep 28, 2015 3:04 pm

I wanted to be able to separate my daily PV production for peak and off-peak to keep track of my solar "financial payback". Since adding up the data from the enlighten site is sub-optimal, I signed up for their API and wrote a html/javascript page to do the work.

It may prove useful to someone else, any improvements and feedback is appreciated.

http://philip.spigelmire.com/2015/09/28 ... roduction/
2015 SV
Old 11/11/15: 2012SL, SOH76% 49.97AHr 35,644mi vin 26790
LEAF press kits

User avatar
RegGuheert
Posts: 6419
Joined: Mon Mar 19, 2012 4:12 am
Delivery Date: 16 Mar 2012
Leaf Number: 5926
Location: Northern VA

Re: Getting TOU totals from Enphase

Tue Sep 29, 2015 7:21 am

Thanks, Philip! Very cool!

I had a bit of trouble getting up and running (mainly because of Enphase' terse instructions), so here are some tips for other trying to get this to work:

You wrote:
Philip wrote:Sign up for an enlighten API key
To do this, go to the Enphase Developer website and click the "Register" hotlink at the upper right. On the page that appears, I used an alias as the "Organization Name" and forewent all fields which were not required. Once you click "Register" on this page, you will receive an email entitled "Account Activation for developer.enphase.com" which contains a link you must click to activate the account.

So far, so good...
Philip wrote:Edit the file fill in the var’s at the top of the script with your API key, User Id, System Id,...
This is where things start to get tricky. You need these three values, but where do they come from? Actually, they come from various places:

API key:

To find this, go the Applications tab of your Enphase developer webpage and click on the name of your default application. (If you do not have a default application, you need to select a plan. I used the "Watt" plan.) You will find the API key right on that page.

User Id

To find this value, you need to log into [url=https:\\enlighten.enphaseenergy.com[/url]Enlighten[/url]. Once logged in, click "My Account" at the very top right of the page and open "Enlighten Settings". Scroll to the bottom of that page and you will find your User Id there.

System Id

To find this value, go back to the Enlighten webpage and click the "System" tab at the top of the page. Then read the URL and the System Id is the numbers immediately following "https://enlighten.enphaseenergy.com/systems/".

Great! Now you have all the values to put into the script so that you can save it as an html and run it. Unfortunately, it still does not work! There are a couple more steps you need to complete to have success:

- First, enable API access to your system. To do this, go to your system's Enlighten webpage which you just logged into and click the tab with a picture of a gear on it. Scroll down to the "Privacy Settings" block and and put a checkmark in the box next to "Enable API access to my system data" and click "Save". Verify this step by going back to the top of the page and clicking "My Account" at the very top right of the page and open "Enlighten Settings". Scroll to the bottom of that page and click the link which says "Show systems that allow API access > >."

- Second, you will need to give your default application in the developer console API access to your account. If you click the "Show applications which have API access > >" link which is just above the one you clicked in the previous step it should read "You haven't granted access to any applications." To resolve that, go back to the webpage for your default application, which is found under the Applications tab of your Enphase developer webpage. Click the name of your default application to get to your application page. At the bottom of this page you will find the following text:
developer.enphase.com wrote:Authorization URL
https://enlighten.enphaseenergy.com/app ... XXXXXXXXXX Include this in your application so that Enlighten users can authorize your application to make API requests on their behalf.
This confused me, since there was no such statement included in the script provided by Philip. Further, the link provided is NOT clickable. Ultimately, you need to open a new tab in your browser and then paste that link into that page and hit the "Enter" key. You will get a webpage which says: "Allow the application 'Organization's App' to access your system data?" Click "Yes, allow access" to enable access. FWIW, it shows you your User Id when you do this. Finally, to verify you have access, go back to Enlighten and if you are still in the "Enlighten Settings" page, click the "System" tab and then get back into "Enlighten Settings" (under "My Account") and click the ""Show applications which have API access > >" link and it should now list "Organization's App".

Once you have done all of the above, you should then be able to open the *.html file which you created and successfully run the script Philip has provided.

Since I do not have TOU metering here, this application is not particularly useful to me. I have always wanted to be able to look at the production of the different subarrays separately since they do not point in the same directions. Unfortunately, I do not see an API access function which will allow me to accomplish that. Does anyone see a way to get production information from less than the full system?
RegGuheert
2011 Leaf SL Demo vehicle
10K mi. on 041413; 20K mi. (55.7Ah) on 080714; 30K mi. (52.0Ah) on 123015; 40K mi. (49.8Ah) on 020817; 50K mi. (47.2Ah) on 120717; 60K mi. (43.66Ah) on 091918.
Enphase Inverter Measured MTBF: M190, M215, M250, S280

philip
Posts: 126
Joined: Tue Nov 27, 2012 8:18 pm
Delivery Date: 25 Aug 2015
Leaf Number: 327341
Location: El Cajon, CA

Re: Getting TOU totals from Enphase

Tue Sep 29, 2015 9:40 am

Thanks for adding that additional info, I forgot a lot of those steps as I did them a while back. I'll add some additional info to my blog post when I get a chance.

As far as getting subarray level information, there is no way to do this with the current API - I've read a lot of posts on users wanting data on a micro-inverter level, so maybe enphase will add this in the future. There is a post on the enlighten developer forum about this:https://developer.enphase.com/forum/top ... rter-stats (Must be logged in with your developer credentials).

The only way I can think of to do this now is by possible running multiple envoys, and that can get expensive.
2015 SV
Old 11/11/15: 2012SL, SOH76% 49.97AHr 35,644mi vin 26790
LEAF press kits

philip
Posts: 126
Joined: Tue Nov 27, 2012 8:18 pm
Delivery Date: 25 Aug 2015
Leaf Number: 327341
Location: El Cajon, CA

Re: Getting TOU totals from Enphase

Tue Sep 29, 2015 1:13 pm

Not sure if this method still works, but someone wrote a man in the middle proxy to intercept the traffic from the envoy. It relies on the envoy not checking the validity of the certificate though - not sure if Enphase fixed that (According to the comments, it looks like it still works). You may be able to parse out individual inverter stats from it.

http://blog.oddbit.com/2012/02/22/capturing-envoy-data/
2015 SV
Old 11/11/15: 2012SL, SOH76% 49.97AHr 35,644mi vin 26790
LEAF press kits

Return to “Solar”