Getting TOU totals from Enphase

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

philip

Well-known member
Joined
Nov 27, 2012
Messages
131
Location
El Cajon, CA
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/0...n-script-to-get-time-of-use-solar-production/
 
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 said:
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 said:
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 Enlighten. 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 said:
Authorization URL
https://enlighten.enphaseenergy.com/app_user_auth/new?app_id=XXXXXXXXXXXXX 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?
 
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/topics/per-inverter-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.
 
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/
 
Back
Top