Enphase Envoy-S data scraping (2016)
thecomputerperson.wordpress.com
thecomputerperson.wordpress.com
their documentation is close to inexistant too. There were a couple opensource projects, with some snippets of code to get inspiration from to connect and scrape the data directly from the local API.
I did this and pushed data to grafana, but never took the time to share it.
Since my last attempt, it seems that more projects showed up that did a better job than me making it reusable :)
- https://github.com/petercable/solar-observatory
My GitHub repo serves 2 purposes:
1. To provide a reusable wrapper (currently only Python, https://github.com/Matthew1471/Enphase-API/blob/main/Documen...) to talk to the LAN API, it's even installable via pip.
2. To document what the LAN API returns and all the URL endpoints (https://github.com/Matthew1471/Enphase-API/tree/main/Documen...).
I would like to see more people using the wrapper so we have a common way of talking to the IQ Gateway (there's a lot of tightly coupled projects on GitHub), but most people seem more interested in the docs I provide and rolling their own wrapper.
I always have plans to add more to it - I found multiple security vulnerabilities in the IQ Gateway and that allowed me to get a dump of the firmware - so there's plenty more URLs for me to write about :)
Great that you're able to update settings... not just read data. I assume that changes to settings are synced with Enphase's cloud as if done with the cloud-based API.
I assume it's not possible or advisable to disconnect from Enphase's cloud altogether (please let me know if that's actually no big deal). [EDIT: Thanks for addressing this in your other comment.]
Enphase released a better EV charger* a few months ago, that's integrated with the other IQ stuff. It can dynamically send excess solar production into the EV instead of exporting to the grid (and can be set to top off the EV battery with grid imports in the middle of the night). I'll finish installing mine this week. ...Please consider incorporating that into your wrapper :)
I too am pretty quick to roll my own stuff. But I'll try to practice restraint, and leverage your wrapper (and treat it as a standard).
* https://enphase.com/store/ev-chargers/connected-ev-chargers-...
The work exploring the APi is excellent, and a very good write up. You should still read it.
The IQ Gateway authentication is done entirely offline - but you do have to have a device online (laptop, pi, mobile etc) to obtain a JWT to present to it.
Installer tokens are 12 hours, Owner tokens are a year. Some endpoints are only accessible with roles higher than Owner however, see https://github.com/Matthew1471/Enphase-API/blob/main/Documen.... for my scripts (available as the "examples") they're set to renew the tokens automatically where required.
(As an aside, assuming the system gets its time from NTP, I wonder if you could extend a token's access time indefinitely by returning a looping timestamp from a local server)