Skip to content
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

Unable to connect #81

Closed
Tomadoggy opened this issue May 17, 2023 · 32 comments
Closed

Unable to connect #81

Tomadoggy opened this issue May 17, 2023 · 32 comments

Comments

@Tomadoggy
Copy link

I have tried all versions of data to get the Enphase Envoy (DEV) to connect, but to no success. I have the proper host (IP address), my username, password, and the full serial number. Have also tried both envoy and installer with blank passwords, nothing is letting me connect. Can someone offer me assistance?
image

@catsmanac
Copy link
Collaborator

What version of the integration are you using? Your screenshot shows an older gui explanation text. @briancmpbll V0.010 has below information text referring to the D7.0.0 software, provided you use english language. And what firmware does your envoy have?

"For newer models, enter username envoy without a password. For older models, enter username installer without a password. For all other models, enter a valid username and password. For firmware D7.0.0 and above check use enlighten"

Is there any information in the log file?

@Tomadoggy
Copy link
Author

Tomadoggy commented May 17, 2023

Thanks for your reply,

My Envoy is: IQ Gateway Software Version 7.3.120
Version of the integration: v0.0.10
I am assuming the check use enlighten is the box that I have checked that shows no text in my first screen shot.

@Tomadoggy
Copy link
Author

Tomadoggy commented May 17, 2023

image

trying this again, but it says that it already exists in the store

@Tomadoggy
Copy link
Author

Log shows this:

`This error originated from a custom integration.

Logger: custom_components.enphase_envoy.config_flow
Source: custom_components/enphase_envoy/envoy_reader.py:246
Integration: Enphase Envoy (DEV)
First occurred: 1:52:42 PM (2 occurrences)
Last logged: 1:53:32 PM

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/config_flow.py", line 150, in async_step_user
envoy_reader = await validate_input(self.hass, user_input)
File "/config/custom_components/enphase_envoy/config_flow.py", line 42, in validate_input
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 368, in getData
await self._getEnphaseToken()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 261, in _getEnphaseToken
token_json = await self._fetch_owner_token_json()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 246, in _fetch_owner_token_json
resp_json = resp.json()
File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 756, in json
return jsonlib.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`

@catsmanac
Copy link
Collaborator

Ok you have the correct one. Your firmware is above 7.0.

In the configuration screen: Host is ip of the envoy. Username and password are the enphase website username and password. Envoy serial number is what it states. Check the box 'Use Enlighten' to have it go out and connect to enlighten website to get a token to access the envoy locally when hitting the submit button. That token is a very long string of characters but you don't see it.

@catsmanac
Copy link
Collaborator

It seems as if it can't connect successfully to enphase website to obtain the token needed.

Have you tried getting a token manually to confirm enphase website knows your serial number? Go here: https://entrez.enphaseenergy.com/

@Tomadoggy
Copy link
Author

  • I have the correct IP address and have verified it in my DHCP server, it is also static for my Envoy
  • Also validated that I am using the correct username and password by logging out of and back into the Enphase portal
  • Serial number taken directly off of the unit and also validated in the Enphase portal
  • The box at the bottom of the integration shows no text, but I am assuming that is the "use enlighten" checkbox
  • I successfully used your link to generate a token, but not sure if I need to input that anywhere
  • Tried again and got the Failed to connect error message again

Thank you for your assistance.

@Tomadoggy
Copy link
Author

Wow...on the 5th try using all the same information...it finally worked!!!!

@Tomadoggy
Copy link
Author

image

@Tomadoggy
Copy link
Author

Would there be a way to show my production as a graph?
image

@catsmanac
Copy link
Collaborator

Yes you can create a history-graph card like:
afbeelding

@Tomadoggy
Copy link
Author

Looks like just what I want but I am a total NOOB (3 days in) for Home Assistant. I understand somewhat the file editor etc. but if you would be so kind as to guide me a bit here I would be very appreciative of your time.

@catsmanac
Copy link
Collaborator

As a first step you need take control of the windows. By default HA just inserts all entities into the Overview Home window. By taking control of it you can build your own windows by inserting these cards.

@Tomadoggy
Copy link
Author

Tomadoggy commented May 17, 2023

Yes...I have done that already. Looks like I have to edit my configuration.yaml file, then create the graph card. Looks like I need a sensor and entity???

@catsmanac
Copy link
Collaborator

You can configure the window interactively in the gui. Go to the window and click ... menu in right hand top
afbeelding
Select configure gui. Now you can add cards and configure

@catsmanac
Copy link
Collaborator

The entities are your envoy entities. There's current watts for each convertor. Then there envoy lifetime production in wh, last 7 day production in wh and todays production in wh. Use the envoy lifetime production in the energy dashboard.

@Tomadoggy
Copy link
Author

I have this configured...but was wanting to create a graph of both the power consumption and power production.
image

@Tomadoggy
Copy link
Author

Sheeesh I figured it out...sorry if I wasted your time
image

@catsmanac
Copy link
Collaborator

👍 No time wasted, I was solid a sleep here in Europe while you were having fun. Search for home assistant on youtube, there's some good stuff there showing what you can do with home assistant.

As for this issue you reported the conclusion is that it took multiple attempts before first token was successfully obtained. That has been reported in various other places as well. Not sure if enphase website has some throttle or if it is just running at capacity.

The code itself retrieving the token is missing error handling and errors with unexpected error and the section in the log that you found. It needs a second test detecting no token was returned and just tell the user to try again.

@btyeung
Copy link

btyeung commented May 22, 2023

Hi, for some reason the authentication stopped working (was working well up till today), and curious where do I go to update the credentials or IP address of my envoy in Home assistant? I couldn't find a config button or file to modify. Thanks!

@catsmanac
Copy link
Collaborator

To update delete the envoy integration from the Settings / Integrations window. Restart HA and then in Integrations window configure it again. All data is kept and will show again once it's configured.

@btyeung
Copy link

btyeung commented May 22, 2023 via email

catsmanac added a commit to catsmanac/home_assistant_custom_envoy that referenced this issue May 23, 2023
…s what do you put in the unlabeled boxes? briancmpbll#73 and Unable to connect briancmpbll#81
@shanerehm1234
Copy link

I'm experiencing a very similar issue to this. I keep getting an "Unexpected Error" when trying to sign in.
I verified I can log into the website just fine, I can also generate a token.

Everything is updated to current versions, I tried removing and reinstalling the HACS integration, but no help.

Enphase Envoy (DEV): 0.0.10
Home Assistant 2023.5.4
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest

image

Any ideas what is going on? Thanks!

Log details:

Logger: custom_components.enphase_envoy.config_flow
Source: custom_components/enphase_envoy/envoy_reader.py:189
Integration: Enphase Envoy
First occurred: 3:54:51 PM (10 occurrences)
Last logged: 4:05:53 PM

Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/httpx/_urlparse.py", line 346, in normalize_port
port_as_int = int(port)
ValueError: invalid literal for int() with base 10: '1607:4ac6:ace2:82f5:b5ff:fe6e:1f4c'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/config_flow.py", line 150, in async_step_user
envoy_reader = await validate_input(self.hass, user_input)
File "/config/custom_components/enphase_envoy/config_flow.py", line 42, in validate_input
await envoy_reader.getData()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 376, in getData
await self.detect_model()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 408, in detect_model
await self.get_serial_number()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 473, in get_serial_number
full_serial = await self.get_full_serial_number()
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 483, in get_full_serial_number
response = await self._async_fetch_with_retry(
File "/config/custom_components/enphase_envoy/envoy_reader.py", line 189, in _async_fetch_with_retry
resp = await client.get(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1517, in request
request = self.build_request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 346, in build_request
url = self._merge_url(url)
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 376, in _merge_url
merge_url = URL(url)
File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 113, in init
self._uri_reference = urlparse(url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/httpx/_urlparse.py", line 246, in urlparse
parsed_port: typing.Optional[int] = normalize_port(port, scheme)
File "/usr/local/lib/python3.10/site-packages/httpx/_urlparse.py", line 348, in normalize_port
raise InvalidURL(f"Invalid port: {port!r}")
httpx.InvalidURL: Invalid port: '1607:4ac6:ace2:82f5:b5ff:fe6e:1f4c'

@catsmanac
Copy link
Collaborator

The issue is the detected IPv6 address of the Envoy. See the Invalid Port Issue. HA doesn't work well with IPv6. To get it going you need to get it to using an IPv4 address.

raise InvalidURL(f"Invalid port: {port!r}")
httpx.InvalidURL: Invalid port: '1607:4ac6:ace2:82f5:b5ff:fe6e:1f4c'

@phsluis
Copy link

phsluis commented Jun 16, 2023

I have the error unable to setup, is this a known error?

2023-06-14 17:35:52.811 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: http://192.168.30.215/api/v1/production: Header:None
2023-06-14 17:35:52.824 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from http://192.168.30.215/api/v1/production: <Response [301 Moved Permanently]>:

<title>301 Moved Permanently</title>

301 Moved Permanently


openresty/1.17.8.1

@catsmanac
Copy link
Collaborator

Was it working before or is this a new installation? What firmware are you using in the Envoy?

@catsmanac
Copy link
Collaborator

It connects on HTTP and Envoy tells to go to HTTPS by using the 301 status code.

@phsluis
Copy link

phsluis commented Jun 17, 2023

It is a new installation, I tried the other custom integration (Enphase Envoy Installer) and that seems to work fine.

@catsmanac
Copy link
Collaborator

This one has the logic to use https as well. That gets enabled when you check the 'use enlighten' option in the configuration screen.

@leonmeijer
Copy link

Ok you have the correct one. Your firmware is above 7.0.

In the configuration screen: Host is ip of the envoy. Username and password are the enphase website username and password. Envoy serial number is what it states. Check the box 'Use Enlighten' to have it go out and connect to enlighten website to get a token to access the envoy locally when hitting the submit button. That token is a very long string of characters but you don't see it.

Thanks for the hint. The integration's text suggested to enter the username envoy, but you need to enter your Enlighten account credentials (email).

@phsluis
Copy link

phsluis commented Jun 18, 2023

This one has the logic to use https as well. That gets enabled when you check the 'use enlighten' option in the configuration screen.

Do you think there is an adavance to try this integration again or it is fine to leave it with the other integration?

@catsmanac
Copy link
Collaborator

This one has the logic to use https as well. That gets enabled when you check the 'use enlighten' option in the configuration screen.

Do you think there is an adavance to try this integration again or it is fine to leave it with the other integration?

If it's providing what you need there's little need. There are a couple of envoy custom integrations that are based on same origin and pretty well compatible and even have code exchanged between them in the past (as I don't know which you are using I can't tell if yours is one of these). Only question if it is maintained when home assistant requires it to be changed in the future.

briancmpbll added a commit that referenced this issue Jun 24, 2023
Fix for Invalid port #75 and readme updates to #73 and #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants