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

fix: create correct url when using ipv6 #753

Merged
merged 3 commits into from
Sep 6, 2023
Merged

Conversation

skgsergio
Copy link
Contributor

@skgsergio skgsergio commented Sep 6, 2023

Currently when using IPv6 I get the following errors:

2023-08-31 00:59:25.359 ERROR (MainThread) [custom_components.google_home] Request from Cocina device error: https://2a02:9140:4d80:xxxx:2880:fef1:8065:ad8d:8443/setup/assistant/alarms
2023-08-31 00:59:25.361 ERROR (MainThread) [custom_components.google_home] Request from Cocina device error: https://2a02:9140:4d80:xxxx:2880:fef1:8065:ad8d:8443/setup/assistant/alarms/volume
2023-08-31 00:59:25.364 ERROR (MainThread) [custom_components.google_home] Request from Cocina device error: https://2a02:9140:4d80:xxxx:2880:fef1:8065:ad8d:8443/setup/assistant/notifications
2023-08-31 00:59:25.368 ERROR (MainThread) [custom_components.google_home] Request from Dormitorio device error: https://2a02:9140:4d80:xxxx:7ed9:5cff:fe1b:dcef:8443/setup/assistant/alarms
2023-08-31 00:59:25.371 ERROR (MainThread) [custom_components.google_home] Request from Dormitorio device error: https://2a02:9140:4d80:xxxx:7ed9:5cff:fe1b:dcef:8443/setup/assistant/alarms/volume
2023-08-31 00:59:25.374 ERROR (MainThread) [custom_components.google_home] Request from Dormitorio device error: https://2a02:9140:4d80:xxxx:7ed9:5cff:fe1b:dcef:8443/setup/assistant/notifications
2023-08-31 00:59:25.376 ERROR (MainThread) [custom_components.google_home] Request from Salón device error: https://2a02:9140:4d80:xxxx:3944:b4e3:bed3:fce:8443/setup/assistant/alarms
2023-08-31 00:59:25.379 ERROR (MainThread) [custom_components.google_home] Request from Salón device error: https://2a02:9140:4d80:xxxx:3944:b4e3:bed3:fce:8443/setup/assistant/alarms/volume
2023-08-31 00:59:25.381 ERROR (MainThread) [custom_components.google_home] Request from Salón device error: https://2a02:9140:4d80:xxxx:3944:b4e3:bed3:fce:8443/setup/assistant/notifications

This is due to a malformed URL when using IPv6, as the IPv6 needs to be placed between [], for example https://[2a02:9140:4d80:xxxx:3944:b4e3:bed3:fce]:8443/setup/assistant/notifications.

This PR detects if the IP is IPv6 and adds them.

Copy link
Owner

@leikoilja leikoilja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for fixing it 🙌

@KapJI
Copy link
Collaborator

KapJI commented Sep 6, 2023

Please fix warnings found by linters.

@skgsergio
Copy link
Contributor Author

Done! I did the PR not from my usual system and I had no linters installed 🤦🏼‍♂️

@KapJI
Copy link
Collaborator

KapJI commented Sep 6, 2023

There is another warning about using isinstance instead of type.

Hassfest errors are unrelated to this change.

@KapJI KapJI added the bug Something isn't working label Sep 6, 2023
@skgsergio
Copy link
Contributor Author

Ok, I've ended up installing pre-commit it locally. I missed that one in the action log. That should be it. Sorry for the noise.

@KapJI KapJI merged commit cfa0eb1 into leikoilja:master Sep 6, 2023
4 of 5 checks passed
@skgsergio skgsergio deleted the fix/ipv6 branch September 6, 2023 16:04
@Dillton
Copy link

Dillton commented Sep 20, 2023

Hello, just a note.

This error does not appear only when IPv6 is used.
I have my home network completely on IPv4 with IPv6 disabled on my router and this error appears only on HA startup/reboot in my case.
So I would like to know where the IPv6 adresses are coming from on Google devices.

Anyway it looks like this PR fixes my issue also so thank you very much @skgsergio
and I will keep monitoring this for few more days.

@KapJI
Copy link
Collaborator

KapJI commented Sep 20, 2023

It seems zeroconf may return ipv6 addresses sometimes when discovering Google Home devices. I guess it should be possible to disable this in zeroconf or make this configurable from integration settings. If someone is interested in working on this, PR is welcome.

@leikoilja
Copy link
Owner

i also noticed that we are a few minor versions behind with zeroconf leikoilja/glocaltokens#437 , so might be worth checking the release notes if there were meaningful fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants