jesserizzo / envoy_reader

MIT License
37 stars 26 forks source link

Enphase integration not working after Envoy updated to D7.0.43 (8ed8ea) #78

Open mikeykau opened 3 years ago

mikeykau commented 3 years ago

Authentication process appears to have changed.

enkrypt3d commented 2 years ago

Following this issue.

gtdiehl commented 2 years ago

After quickly looking at some threads it appears the user retrieves a token from the Enphase site.

Here is some discussion from the Home Assistant forum.

I don't have access to an Enphase Envoy running D7.x firmware. Even when I access the Enphase site my system does not appear under commissioned envoy. I can only create a token for an uncommissioned envoy. In my test, the JWT payload contains an expiration date of 12 hours after the creation of the token. Not sure about commissioned tokens, as there is some confusion in the forum. A commissioned token had an exp of 7 days, while another was 1 hour.

In any case, even with a token that lasts at most 7 days, the envoy_reader code would need to be enhanced to retrieve a token programmatically. This Issue has some code in Go that could be ported over to Python.

For me, this is really not possible until I get access to an Envoy running D7.x firmware.

enkrypt3d commented 2 years ago

There is the token authentication as well as the SSO which works if I login directly to the envoy. The token configuration is a bit of a mystery but it does not appear to be required.

On Mon, Dec 27, 2021, 9:15 PM Greg @.***> wrote:

After quickly looking at some threads it appears the user creates a token from the Enphase http://entrez.enphaseenergy.com/ site.

Here is some discussion https://community.home-assistant.io/t/enhpase-envoy-on-2021-8-with-new-energy-feature/328668?page=18 from the Home Assistant forum.

I don't have access to an Enphase Envoy running D7.x firmware. Even when I access the Enphase http://entrez.enphaseenergy.com/ site my system does not appear under commissioned envoy. I can only create a token for an uncommissioned envoy. In my test, the JWT payload contains an expiration date of 12 hours after the creation of the token. Not sure about commissioned tokens, as there is some confusion in the forum. A commissioned token had an exp of 7 days, while another was 1 hour.

In any case, even with a token that lasts at most 7 days, the envoy_reader code would need to be enhanced to retrieve a token programmatically. This Issue https://github.com/dlmcpaul/EnphaseCollector/issues/22#issuecomment-973656321 has some code in Go that could be ported over to Python.

For me, this is really not possible until I get access to an Envoy running D7.x firmware.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1001833301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRVSOGJ4WXD5HWT2UK3UTEMTJANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

gtdiehl commented 2 years ago

What login do you use for SSO? Is it the Envoy local account like admin or installer? Or is it your login for Enphase Enlighten?

From what I'm reading in all of the forums, is that to access the backend Envoy JSON data a token is needed.

enkrypt3d commented 2 years ago

It is the same login for enlighten yes.

On Mon, Dec 27, 2021, 9:30 PM Greg @.***> wrote:

What login do you use for SSO? Is it the Envoy local account like admin or installer? Or is it your login for Enphase Enlighten?

From what I'm reading in all of the forums, is that to access the backend Envoy JSON data a token is needed.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1001836868, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRRCJ2MZIYNW2Z47W43UTEONXANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

gtdiehl commented 2 years ago

Unfortunately for me even if I had access to another's Envoy system, my Enlighten credentials would probably not work on their system. If the backend Envoy JSON data is available without a token from the Enphase site and only the Enlighten credentials tied to that system are needed, someone with the system and credentials would have to do some investigation and hack some code together to get the ball rolling.

enkrypt3d commented 2 years ago

Let me how I can assist in contributing.

gtdiehl commented 2 years ago

@enkrypt3d I was looking at the Go code in my previous post and seeing how that can be ported over somehow. But you mentioned that SSO is possible, though all of the screenshots (as I don't have access to an Envoy running D7.x firmware) have the Token text field entry.

I assume this is what happens when going to http://x.x.x.x/production.json? 125347269-d4dd0000-e3ae-11eb-876d-23ef3c10311b

I was wondering can you post a screenshot showing the SSO? And how it is accessed?

enkrypt3d commented 2 years ago

@enkrypt3d I was looking at the Go code in my previous post and seeing how that can be ported over somehow. But you mentioned that SSO is possible, though all of the screenshots (as I don't have access to an Envoy running D7.x firmware) have the Token text field entry.

I assume this is what happens when going to http://x.x.x.x/production.json? 125347269-d4dd0000-e3ae-11eb-876d-23ef3c10311b

I was wondering can you post a screenshot showing the SSO? And how it is accessed?

image

Clicking the top button redirects to this page:

https://entrez.enphaseenergy.com/authorize?code_challenge=4bbwml7hgn1MJQWf9nLtyzx892MxjA1RPsPaNimflPw&client_id=envoy-ui-client&redirect_uri=https://192.168.1.69/auth/callback&scope=########&response_type=code&code_challenge_method=S256

The ###### is where the envoy serial # is.

and then this page after auth:

https://192.168.0.5/auth/callback?code=776e446b-c93f-4946-9efd-1ed557a6199f

Let me know if I can provide more details! Thanks

gtdiehl commented 2 years ago

I'm not too sure about the code after I retrieve the token. The below code scrapes a token from the Enphase site, just have to replace the userame aaaaa and password bbbbb with the credentials for the Enphase Enlighten website, and Envoy IP Address x.x.x.x.

After getting the token I'm not sure image

import requests
from bs4 import BeautifulSoup

payload = {"username": "aaaaa", "password": "bbbbb"}

session = requests.session()
r = requests.post("https://entrez.enphaseenergy.com/login", data=payload)

print("SiteLogin: " + r.text)

payload = {"uncommissioned": "true", "Site": ""}
cookies = requests.utils.cookiejar_from_dict(
    requests.utils.dict_from_cookiejar(r.cookies)
)

print("Cookie: " + str(cookies))

r = requests.post(
    "https://entrez.enphaseenergy.com/entrez_tokens", data=payload, cookies=cookies
)
print("TokenSite: " + r.text)

soup = BeautifulSoup(r.text, features="html.parser")
jwt = soup.find("textarea").contents[0]
print("Token: " + jwt)

payload = {"Authorization": "Bearer " + jwt}
r = requests.get("https://x.x.x.x/auth/check_jwt", verify=False, data=payload)
cookies = requests.utils.cookiejar_from_dict(
    requests.utils.dict_from_cookiejar(r.cookies)
)
print("AuthSite: " + r.text)
print("AuthCookie: " + str(cookies))

r = requests.get(
    "https://x.x.x.x/production.json", verify=False, data=payload, cookies=cookies
)
print("Production: " + r.text)
gtdiehl commented 2 years ago

@enkrypt3d Can you run the code against your Envoy?

It'll probably give an error when retrieving the production page.

enkrypt3d commented 2 years ago

How do I do that? I'm not a python expert so I'd need some guidance.

After authenticating, I'm able to hit that production.json:

{"production":[{"type":"inverters","activeCount":34.........

On Sat, Jan 8, 2022 at 9:41 PM Greg @.***> wrote:

@enkrypt3d https://github.com/enkrypt3d Can you run the code against your Envoy?

It'll probably give an error when retrieving the production page.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1008216803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRULFKTLAM4BEXWCEQ3UVDYUFANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

enkrypt3d commented 2 years ago

Also I think we can ignore the token authentication method. the top option only uses the enlighten manager login....

On Sat, Jan 8, 2022 at 10:13 PM Corey J @.***> wrote:

How do I do that? I'm not a python expert so I'd need some guidance.

After authenticating, I'm able to hit that production.json:

{"production":[{"type":"inverters","activeCount":34,"readingTime":0,"wNow":0,"whLifetime":149221},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1641697963,"wNow":-0.0,"whLifetime":2547550.432,"varhLeadLifetime":9.708,"varhLagLifetime":1454333.844,"vahLifetime":3614484.427,"rmsCurrent":6.029,"rmsVoltage":248.535,"reactPwr":742.428,"apprntPwr":749.07,"pwrFactor":0.0,"whToday":49074.432,"whLastSevenDays":2498476.432,"vahToday":59799.427,"varhLeadToday":1.708,"varhLagToday":16365.844}],"consumption":[{"type":"eim","activeCount":1,"measurementType":"total-consumption","readingTime":1641697963,"wNow":-57.773,"whLifetime":3317154.764,"varhLeadLifetime":2184853.326,"varhLagLifetime":1462122.356,"vahLifetime":4204961.002,"rmsCurrent":-7.788,"rmsVoltage":248.509,"reactPwr":-1905.093,"apprntPwr":-1935.294,"pwrFactor":-1.0,"whToday":40856.764,"whLastSevenDays":3276307.764,"vahToday":41020.002,"varhLeadToday":23112.326,"varhLagToday":16492.356},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1641697963,"wNow":-57.773,"whLifetime":1525239.582,"varhLeadLifetime":2184843.618,"varhLagLifetime":7788.512,"vahLifetime":4204961.002,"rmsCurrent":13.817,"rmsVoltage":248.482,"reactPwr":-1162.665,"apprntPwr":1716.703,"pwrFactor":-0.03,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}

On Sat, Jan 8, 2022 at 9:41 PM Greg @.***> wrote:

@enkrypt3d https://github.com/enkrypt3d Can you run the code against your Envoy?

It'll probably give an error when retrieving the production page.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1008216803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRULFKTLAM4BEXWCEQ3UVDYUFANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

gtdiehl commented 2 years ago

Copy the above Python code into a text editor like Notepad and change the username, password, and IP Address placeholders. Save the file as tokentest.py. From the command line, change directory to where you saved the Python file and run python tokentest.py

Assuming you have Python installed

Edit: You might have to install the modules by running from the command line pip install requests pip install bs4

enkrypt3d commented 2 years ago

@.***:~# python tokentest.py Traceback (most recent call last): File "/root/tokentest.py", line 19, in jwt = soup.find("textarea").contents[0] AttributeError: 'NoneType' object has no attribute 'contents'

On Sat, Jan 8, 2022 at 10:19 PM Greg @.***> wrote:

Copy the above Python code into a text editor like Notepad and change the username, password, and IP Address placeholders. Save the file as tokentest.py. From the command line, change directory to where you saved the Python file and run python tokentest.py

Assuming you have Python installed

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1008221088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRQSHKW6TCH3OSEEROTUVD5FJANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

gtdiehl commented 2 years ago

I wasn't expecting it to fail there. I added some print statements to the output in the above code. Not sure if you want to post the output though. You can email it to me if you feel more comfortable.

enkrypt3d commented 2 years ago

Got it - sent you the output in your inbox

On Sat, Jan 8, 2022 at 10:33 PM Greg @.***> wrote:

I wasn't expecting it to fail there. I added some print statements to the output. Not sure if you want to post the output though. You can email it to me if you feel more comfortable.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1008222321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRWSVY77PUOMTQYVI33UVD6YDANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

gtdiehl commented 2 years ago

I'm working on the changes but have run into a wall. When using the httpx.AsyncClient() it does not seem to work the same as when using httpx.Client(). When trying to get the token from Enphase I can login, but when I goto the TOKEN_URL page I get an Authentication error. Maybe some session info is not being used/saved?

My current code is located at: https://github.com/gtdiehl/envoy_reader/blob/token_firmware/envoy_reader/envoy_reader.py

Example Usage: Uncommissioned Envoy python envoy_reader.py -u email@fred.com -p password -c False

Commissioned Envoy python envoy_reader.py -u email@fred.com -p password -c True -i SiteID -s EnvoySerial

enkrypt3d commented 2 years ago

So I only need to replace the envoy_reader.py file? Or are there other changes needed?

On Wed, Jan 12, 2022 at 4:53 PM Greg @.***> wrote:

I'm working on the changes but have run into a wall. When using the httpx.AsyncClient() it does not seem to work the same as when using httpx.Client(). When trying to get the token from Enphase I can login, but when I goto the TOKEN_URL page I get an Authentication error. Maybe some session info is not being used/saved?

My current code is located at:

https://github.com/gtdiehl/envoy_reader/blob/token_firmware/envoy_reader/envoy_reader.py

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1011485973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRSGP632IKZ2SLLE5LDUVXZ5XANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

gtdiehl commented 2 years ago

No don't replace it. It can be run by itself from the command line. But at this point nothing to test as it will fail. I have to investigate how to use the async client and have it behave the same as the sync client that was in the proof of concept code.

enkrypt3d commented 2 years ago

python envoy_reader.py

Enter the Envoy IP address or host name, or press enter to use 'envoy' as default: 192.168.196.1.69 Enter the Username for Inverter data authentication, or press enter to use 'envoy' as default: #######@gmail.com Enter the Password for Inverter data authentication, or press enter to use the default password: ######## Reading... DEBUG:asyncio:Using selector: EpollSelector DEBUG:main:HTTP GET Attempt #1: http://192.168.196.1.69/production.json DEBUG:main:HTTP GET Attempt #2: http://192.168.196.1.69/production.json DEBUG:main:HTTP GET Attempt #3: http://192.168.196.1.69/production.json DEBUG:main:HTTP GET Attempt #1: http://192.168.196.1.69/api/v1/production DEBUG:main:HTTP GET Attempt #2: http://192.168.196.1.69/api/v1/production DEBUG:main:HTTP GET Attempt #3: http://192.168.196.1.69/api/v1/production DEBUG:main:HTTP GET Attempt #1: http://192.168.196.1.69/production DEBUG:main:HTTP GET Attempt #2: http://192.168.196.1.69/production DEBUG:main:HTTP GET Attempt #3: http://192.168.196.1.69/production Traceback (most recent call last): File "/root/envoy_reader.py", line 716, in TESTREADER.run_in_console() File "/root/envoy_reader.py", line 588, in run_in_console data_results = loop.run_until_complete( File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/root/envoy_reader.py", line 230, in getData await self.detect_model() File "/root/envoy_reader.py", line 318, in detect_model raise RuntimeError( RuntimeError: Could not connect or determine Envoy model. Check that the device is up at 'http://192.168.196.1.69'.

It's not looking at HTTPS?

gtdiehl commented 2 years ago

For the new firmware, additional command line arguments have to be used. In my previous comments above two examples are shown for the Uncommisioned and Commissioned Envoy token.

enkrypt3d commented 2 years ago

Sent you an email

gtdiehl commented 2 years ago

I've released the envoy_reader library with support for firmware 7.x.x.

Also I have made changes to the Home Assistant enphase_envoy sensor integration. I'll leave this Issue open until the HA side has been completed.

Before submitting the PR on the HA side it should probably be tested out. The sensor code is located at: https://github.com/gtdiehl/core/tree/envoy_new_fw/homeassistant/components/enphase_envoy

Copy over the above directory and replace it in your HA server instance.

I don't have an Envoy running this firmware so I would say the more testing the better. The areas I'm concerned with are:

Thanks!

enkrypt3d commented 2 years ago

@gtdiehl thank you! So glad this is working again! Hopefully the tokens get automatically refreshed. I'll let you know how it looks tomorrow.

gtdiehl commented 2 years ago

It looks like the code when used in Home Assistant, is hitting the Enphase server every polling cycle. Before wide usage this should probably be resolved! I'll give an update once this is resolved.

IshmaelObeso commented 2 years ago

@gtdiehl I'm running this on my HA instance now, looks like it's working. Hit me up if you want to test anything or check on specific issues :)

gtdiehl commented 2 years ago

@IshmaelObeso Did you setup the Envoy using Commissioned or Uncommisioned?

Also I just updated the HA integration code yesterday so that it should only hit the Enphase server when the token expires. In the earlier code it was hit them every polling cycle!

IshmaelObeso commented 2 years ago

Commissioned, it works fine so far only thing is it seems to forget the configuration every ~12 hours and I have to reinput the credentials. I'll update the code after the weekend and test it out and let you know if anything pops up. My system also has batteries if you ever want to do testing on those.

enkrypt3d commented 2 years ago

Commissioned, it works fine so far only thing is it seems to forget the configuration every ~12 hours and I have to reinput the credentials. I'll update the code after the weekend and test it out and let you know if anything pops up. My system also has batteries if you ever want to do testing on those.

Not having that issue here. Mine also has batteries.

gtdiehl commented 2 years ago

Ok great thank you! I’ll look into the credential issue. It seems others are seeing the same issue so I hope I can track it down

On Wed, Jan 26, 2022 at 6:08 PM enkrypt3d @.***> wrote:

Commissioned, it works fine so far only thing is it seems to forget the configuration every ~12 hours and I have to reinput the credentials. I'll update the code after the weekend and test it out and let you know if anything pops up. My system also has batteries if you ever want to do testing on those.

Not having that issue here. Mine also has batteries.

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1022777226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKY4BJPBAFGRHYLNU2M53LUYCSJXANCNFSM465KDKNA . You are receiving this because you were mentioned.Message ID: @.***>

IshmaelObeso commented 2 years ago

@gtdiehl Sounds good, hit me up if you need me to pull logs or anything. The configuration issue seems to be happening more often after I updated the code to your newest version.

djk121 commented 2 years ago

Commissioned, with batteries. I pulled the enphase_envoy directory @gtdiehl mentioned above on Saturday, that caused the integration to work for me. It worked until last night, when it hit an auth error:

2022-02-08 22:53:25 ERROR (MainThread) [homeassistant.components.enphase_envoy] Authentication failed while fetching envoy Envoy data: Client error '401 Unauthorized' for url 'https://192.168.2.85/api/v1/production/inverters'

When I go to integrations in HA, it says "Attention Required" and re-starts the setup flow. Doing that and inputting all of the same information yields an error in the UI that says "Invalid flow specified"

djk121 commented 2 years ago

I've been watching how @gtdiehl's patch above works for about 10 days now, and I think there are two things that cause things to fail:

  1. If there are any network changes on the envoy, a new JWT is required.
  2. Because python, sometimes there's a big enough delay between when token validity is checked and when the request is sent to the envoy.

Both of these result in the envoy sending back a 401, which turns into an exception to HA.

https://github.com/jesserizzo/envoy_reader/pull/90 to retry these (after fetching a new JWT) instead.

djk121 commented 2 years ago

I've been running with #90 for the last couple of days, and it does seem to keep the integration working for me. I'm not sure why the Envoy is throwing the 401s it is occasionally handing out, but reacting to them by fetching a new token and retrying seems to paper over the issue.

enkrypt3d commented 2 years ago

I believe I have fixed most of my issues with this integration, but getting this error when I Try to add consumption? The production numbers are working well though:

image

briancmpbll commented 2 years ago

Before submitting the PR on the HA side it should probably be tested out. The sensor code is located at: https://github.com/gtdiehl/core/tree/envoy_new_fw/homeassistant/components/enphase_envoy

Copy over the above directory and replace it in your HA server instance.

Pardon my ignorance, but where does this directory get copied into? I'm running hass os on a raspberry pi and I don't see a directory that would match this one in the file system.

I just got a enphase system installed with 7.x.x and would like to help test this.

enkrypt3d commented 2 years ago

/usr/src/homeassistant/homeassistant/components/enphase_envoy/

This is the path in my docker container. yours may be a little different. be sure to empty that folder out and ensure u have all files:

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/__init__.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/config_flow.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/const.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/manifest.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/strings.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/sensor.py

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/translations/en.json
enkrypt3d commented 2 years ago

Anyone know how to monitor batteries with this integration?

del13r commented 2 years ago

@enkrypt3d Have you tried checking this link http://envoy/production.json There is a storage section of that json file hosted on the Envoy. Mine is blank as I don’t have a battery.

"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}

del13r commented 2 years ago

@enkrypt3d also try http://envoy.local/ivp/ensemble/inventory where you will see information like this “percentFull”: 3, “temperature”: 13, “maxCellTemp”: 14,

enkrypt3d commented 2 years ago

Yes I'm able to see these values, just trying to figure out how to create entities in home assistant with these batteries. I have 3 encharge 10's (9 total batteries)

On Fri, Feb 25, 2022 at 8:01 PM del13r @.***> wrote:

@enkrypt3d https://github.com/enkrypt3d also try http://envoy.local/ivp/ensemble/inventory where you will see information like this “percentFull”: 3, “temperature”: 13, “maxCellTemp”: 14,

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1051408232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRQSMM6LS72ITPJ23VTU5AQ6HANCNFSM465KDKNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

michaelgaultjr commented 2 years ago

/usr/src/homeassistant/homeassistant/components/enphase_envoy/

This is the path in my docker container. yours may be a little different. be sure to empty that folder out and ensure u have all files:

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/__init__.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/config_flow.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/const.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/manifest.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/strings.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/sensor.py

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/translations/en.json

Hello, I've been using this integration for a few days on two combiners, one running D5.x.x firmware, the other running a D7.x.x firmware in "Commissioned" mode, and it's mostly been working fine except for every morning around 4am-5am the D7.x.x combiner integration disconnects with a 401 unauthorized error.

rjnca commented 2 years ago

Has there been any movement on this? I'm still getting the "unexpected error" message both with the core integration and with the custom component. Is there something I'm missing?

enkrypt3d commented 2 years ago

Did you try deleting the integration, wget'ing the files, then restart HA, then re-add the integration? You have to login with your enlighten account now....

On Thu, Mar 24, 2022 at 2:23 PM Ron @.***> wrote:

Has there been any movement on this? I'm still getting the "unexpected error" message both with the core integration and with the custom component. Is there something I'm missing?

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1077917307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRUN64N2EWGC6EAUKCTVBSXILANCNFSM465KDKNA . You are receiving this because you were mentioned.Message ID: @.***>

michaelgaultjr commented 2 years ago

Has there been any movement on this? I'm still getting the "unexpected error" message both with the core integration and with the custom component. Is there something I'm missing?

I've been using the branch by @DanBeard and it's been working perfectly for me, the only issues I've experienced are issues with Enphase combiners themselves. Just keep in mind you may have to delete version in the python cache as described here https://github.com/jesserizzo/envoy_reader/pull/91#issuecomment-1065942291

newburns commented 2 years ago

/usr/src/homeassistant/homeassistant/components/enphase_envoy/

This is the path in my docker container. yours may be a little different. be sure to empty that folder out and ensure u have all files:

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/__init__.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/config_flow.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/const.py
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/manifest.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/strings.json
wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/sensor.py

wget https://raw.githubusercontent.com/gtdiehl/core/envoy_new_fw/homeassistant/components/enphase_envoy/translations/en.json

Is it possible to do this with HomeAssistant OS? There is no components or homeassistant folder that I can find. I'm guessing it's structure is different in the OS version (HAOS).

I am trying to do this through custom_components folder. Not sure if I need to add something to configuration.yaml for that

enkrypt3d commented 2 years ago

You should be able to do a "locate enphase_envoy" and it should find the location. I'm using docker on a raspberry Pi 4. It's the default integration, not a custom component.

@gtdiehl any way to get the batteries added like it is in this repo?

https://github.com/DanBeard/enphase_envoy

I tried his but it didn't work for me for some reason.

briancmpbll commented 2 years ago

I packaged this up as a HACS custom component for use with HASS OS: https://github.com/briancmpbll/home_assistant_custom_envoy

@newburns take a look at see if this will work for you.

enkrypt3d commented 2 years ago

Peterwalkowiak, Is there some documentation that shows this integration is now merged with HA Core? Can't seem to find anything.

On Tue, Apr 12, 2022 at 1:59 AM peterwalkowiak @.***> wrote:

This looks like it has been officially adopted now. HACS component stopped working and the official integration now works! Thank you all!

— Reply to this email directly, view it on GitHub https://github.com/jesserizzo/envoy_reader/issues/78#issuecomment-1096117822, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHLHRQTTVEAYK344OFMCYLVEUGLHANCNFSM465KDKNA . You are receiving this because you were mentioned.Message ID: @.***>