Git Product home page Git Product logo

Comments (6)

stratus-ss avatar stratus-ss commented on August 10, 2024 1

I might be able to help with this. I know both languages with some fluency (Python more than Go). I'll see if I can get some time to poke through this

from home_assistant_custom_envoy.

stratus-ss avatar stratus-ss commented on August 10, 2024 1

This seems like a fun weekend project. Might be able to steal a few hours. I just started using this integration and would love to completely bypass the online requirement portion. Sadly I bought Enphase after talking to them specifically about the local API access.

I have a vested interest in seeing if we can get close to a total off-line state.

from home_assistant_custom_envoy.

briancmpbll avatar briancmpbll commented on August 10, 2024

Thanks for the code! I don't know go at all, so it will take me quite a while to port this. I don't have a ton of time to work on this but I can make an attempt at some point.

from home_assistant_custom_envoy.

edasque avatar edasque commented on August 10, 2024

To be honest this Go code is pretty self explanatory, I am happy to write it up as pseudo code. It's essentially:

  1. POST the enlighten email & password to the login endpoint of the page with the log form. Hold on to the cookies
  2. With the cookies in hand, GET https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=ENVOYSERIAL" - which returns a JSON document. The Token property of the JSON is a JWT token that will last 6 months (you'd renew it by going through the process again)
  3. With the JWT token, you'll POST it to the endpoint of a form which is https://entrez.enphaseenergy.com/entrez_tokens
  4. You grab those cookies and equipped with that, you can hit your local envoy endpoints

from home_assistant_custom_envoy.

stratus-ss avatar stratus-ss commented on August 10, 2024

When looking at @briancmpbll code, isn't he already getting the 6month jwt?

image

This seems pretty close to my own quick hack:

>>> import requests
>>> payload = { "user[email]":"[email protected]","user[password]":"Taco-Playlist"}
>>> with requests.Session() as s:
...  p = s.post('https://enlighten.enphaseenergy.com//login/login', data=payload)
...  r = s.get('https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=SOMESERIAL')


>>> r.text
'{"generation_time":1656279809,"token":"REDACTED","expires_at":1671831809}'

Which translates to an expiry Dec 23, 2022.

I haven't stepped through the original code, but presumably if its using the same url, it should also be a 6 month expiry should it not?

from home_assistant_custom_envoy.

briancmpbll avatar briancmpbll commented on August 10, 2024

Closing this as stale. If you want to open a PR for this change please create another issue with the PR.

from home_assistant_custom_envoy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.