-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grid Import/Export missing #83
Comments
Have you seen the discussion on this in the closed Pull Request 32 on this topic? That was intended to add Grid Import/Export but never got to that point. @gmcmicken, the author of the pr, cancelled it and went with using rest integration and pulling the data. Think that's a long answer for it's not available as far as I know. (In the discussion they also reference pr 55). Adding it based on @gmcmicken work is probably doable, but I have no meters to test it with. |
Hi Thanks for this, I am happy to test anything if that helps others. I am not sure my coding skills are up to doing the work myself but i will take a look and see if i can figure it out. The Enphase API docs https://developer-v4.enphase.com/docs.html look fairly good in terms of what data we can pull locally. |
Be aware that the link you refer to is the Enphase website api, not the local envoy API. A bit of documentaion on the ENVOY API is available, but not overwhelming detailed. |
Thanks, just an FYI for anyone that is interested. I managed to get this working but it was a bit of a faf, im sure there is a better way. To get the grid import export data, i was able to point my browser to https://envoy.local/production.json, this forced me to login with the token and then i was able to go back to to https://envoy.local/production.json which gave the following: {"production":[{"type":"inverters","activeCount":16,"readingTime":1687882970,"wNow":1733,"whLifetime":681110},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1687883208,"wNow":468.578,"whLifetime":3098513.294,"varhLeadLifetime":1.308,"varhLagLifetime":1283828.397,"vahLifetime":3995087.225,"rmsCurrent":2.399,"rmsVoltage":240.297,"reactPwr":259.839,"apprntPwr":576.629,"pwrFactor":0.81,"whToday":18950.294,"whLastSevenDays":207118.294,"vahToday":21059.225,"varhLeadToday":0.308,"varhLagToday":4598.397}],"consumption":[{"type":"eim","activeCount":1,"measurementType":"total-consumption","readingTime":1687883208,"wNow":398.222,"whLifetime":3821839.652,"varhLeadLifetime":3009371.321,"varhLagLifetime":1284781.663,"vahLifetime":4855487.015,"rmsCurrent":-0.724,"rmsVoltage":240.185,"reactPwr":-895.945,"apprntPwr":-173.911,"pwrFactor":1.0,"whToday":18111.652,"whLastSevenDays":179644.652,"vahToday":12041.015,"varhLeadToday":10457.321,"varhLagToday":4598.663},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1687883208,"wNow":-70.356,"whLifetime":1752235.192,"varhLeadLifetime":3009370.013,"varhLagLifetime":953.266,"vahLifetime":4855487.015,"rmsCurrent":3.123,"rmsVoltage":240.074,"reactPwr":-636.105,"apprntPwr":750.483,"pwrFactor":-0.11,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]} This didn't work well with a curl command because it required a session cookie, i managed to figure that part out by first issuing the curl command to set the session cookie: curl -kiH "Accept:application/json" -H "Authorization: Bearer " "https://envoy.local/auth/check_jwt" -b cookie -c cookie Then i was able to use the curl command to get the JSON data above: curl -kiH "Accept:application/json" -H "Authorization: Bearer " "https://envoy.local/production.json" -b cookie -c cookie however putting this into HASS was driving me nuts, as the session cookie needs to be refreshed quite often and i just couldn't figure out how to do this. So i looked into node-red as a way to do this and found that someone had already created a flow to gather this data, the flow gets the token, gets the session cookie using the auth check, then gets the production.json data. I just added a node to filter out what i wanted and change the timing so it checks the production.json every 5 seconds: consumption[1].wNow Then passed this to HASS with a sensor node. I am sure there must be a way to add this into this github without the need for node-red but for now at least im using a combination of this and node-red to get the data i need. The link to the github for the node-red flow for this is here: https://github.com/Maarten234/Enphase-Envoy-D7.0.X-node-red/tree/main |
@Bonehead999 you should have read the closed PR that was linked to you above, would have saved you a lot of time! The token lasts a year, so you don't need to script it's retrieval you can just go to your envoy web page and login once a year and update your token in the config. You can use home assistants built in rest and integral like I had done and shown in the closed PR and replace the entire integration with this method |
@gmcmicken I actually did read it but could not get it to work for me, the issue was not the token as that as you say is valid for a year, it was the session cookie needed to reach the https://envoy.local/production.json. If used the curl command with the bearer token it always failed with a HTTP/1.1 401 Unauthorized, this was due to needing a session cookie. For some reason the https://envoy.local/production.json URL is the only one that needs the session cookie, all others listed in the API docs do not need this. I don't really understand in the linked PR how you got around the need for the session cookie. This is all fairly new to me, and happy to learn along the way. |
@Bonehead999, looks like this envoy customization by @vincentwolsink has logic for the cookie added, amongst other things. |
Grid Import and Export is available as of V0.0.17. |
This integration is great and provides a lot of info already. It is however missing the import/export grid data.
I have checked in my Envoy-s Metered and the data is there.
The text was updated successfully, but these errors were encountered: