Get-EnphaseProduction-v7.py

Enphase has caused an ongoing kerfuffle by changing the authorisation mechanism of their Envoy solar controllers, usually without notice, by virtue of a firmware update.

Where previously you could login to your Enphase solar setup with basic username and password authorisation, now you need to provide an authorisation token created by the Enphase website.

We fell foul of the same update and have lost some data, but here I present the updated version of the script.

If you’re still running v5, this script is the one you need. To determine your own Envoy version, login to the Enlighten website, click the hamburger then System / Devices / Gateway.

Additional Pre-Requisites

The pre-requisites for this script are the same as for v5, but with some extras:

  • You need to provide the script with your (Enphase/Enlighten) username, password, and the serial number of your Envoy.
  • Your Envoy now needs access to the Internet (so it can request the token as required). The tokens are “long-lived”, and could last a year, so if you’re concerned by the open internet access you can allow it for the setup, then block it until it stops working and requires another token. (The script automatically attempts to update the token if the one it’s been using dies.)

Download and install the Script

You’ll find the script Get-EnphaseProduction-v7.py on Github.

Setup

The PRTG side of things is unchanged from the v5 version here.

Where the v5 version had your *local* credentials baked into the script, now it requires your *online* cred’s, as outlined above. Don’t forget to edit the script with these details before proceeding. You’ll find them at around line 30.

Revision History

26th July 2023. This is the initial publication.
 
– Greig.

5 Comments

  1. Hi Greig. Don’t know if you are still looking at comments on here, but I was curious about a couple of points. I have recently installed a system almost identical to yours. I have already implemented a monitoring system using the Tesla API but wanted to go further using the Enphase API too. I looked at their API when I got the system and was happy I could get acceptable results with it, but having only got around to looking at it I was a bit pissed when I discovered that as well as requiring a token (no big deal), they also reduced the number of free hits per month from 10000 to 1000 (not what I signed up for). Has that change had a significant impact on the quality of your graphs (unless you have a commercial account) ?

    Secondly, you implied that the fault shown in the last graph (https://greiginsydney.com/get-enphasedata-py/) you experienced when your battery was first installed was “fixed” by Enphase. Can I ask what loads you have on your system, in particular, how much power are you allowed to feed into the grid by your supplier? In my case it is 5kW, so in the morning most of the solar goes into charging the battery (also a maximum of 5kW at any instant). If the battery is not charged before the solar capacity exceeds the house (about 350W) + battery (5kW), the rest goes into the grid, but once the battery is fully charged the solar capacity immediately drops to feed the grid (5kW) + houre (350W) and stays there until evening. If we use other appliances, the amount generated increases above that to the maximum of the system (about 7kW I think, but that rarely happens). This means my usage appears similar to the first half of your “faulty” graph. The only way I can imagine your graphs going up to about 7kW would be if the limit you are allowed to put into the grid is maybe 10kW (which I know is allowed in some areas).
    Sorry for the long message.

    • Hi Peter,

      Sorry for the delay replying.

      Ausgrid’s our network supplier, and they don’t apply any limiting to solar installations of < 10kW/phase. [Reference].

      By way of demonstration of this, around lunchtime today I noticed the battery had reached 100% and we were exporting over 6kW for a brief period. (It was a very grey day, but I was able to plug the car in to soak some of that up). So yes we’re definitely allowed to export more than 5kW.

      – G.

      • Thanks for that information, Greig. It all makes a lot more sense now. Here we are with United Energy. I have still to understand exactly what is going on with our system, hence the interest in monitoring the panels. I have seen a peak of a fraction over 7kW, but at the moment the house is using about 2.4 kW and the grid is getting 3.8 (very sunny and the battery is fully charged), so only about 6.2.

        Thanks again for the help and for making your code public.

  2. To answer your first question, the limited number of hits to get data only appears to apply to accessing their cloud service, presumably to save them bandwidth. We referred to the following document from Enphase that details how you can use the token to access the local gateway directly, without any limits.

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

    I’ll let Greig answer the second part of your question. He’s more across the numbers for our system than I am.

  3. Thank you for that reference, Rocky. I have just started working on this project so it is very timely. Also thanks for making the code from your project available. It has also provided a great place to start.

Leave a Reply

Your email address will not be published. Required fields are marked *

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.