-
-
Notifications
You must be signed in to change notification settings - Fork 742
Add IPv6 to WifiInfoSensor #4198
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
Comments
The current sensor is designed to show the IPv4 address. If you would like to add one for IPv6 please make sure its a new sensor 😃 . The other sensor needs to continue to use the deprecated method to support older devices but a new sensor can be setup to show the IPv6 address as its state. |
That seems reasonable to me. It'll probably take me a little extra fiddling to get it right, but I can get working on that then. Thanks for the quick response! |
This might be a silly question, but is there somewhere specific I can add unit tests to? I'm not able to find the testcase files in the repository. |
There are currently no unit tests in the project. |
Is your feature request related to a problem? Please describe.
My core personal issue is that my phone regularly drops it's IPv6 address. This drives me nuts. I want to be able to detect when this happens and automatically cycle the wifi to regain an IPv6 assignment. I thought, well Home Assistant should have access to this data and is always running on my phone anyway. After checking the sensor for WifiInfo wifi_ip_address, I noted it was only the IPv4 address. This struck me as odd. I went to check the code in case there was a hidden option that I maybe missed.
This was not the case. It turns out that the companion app only retrieves the IPv4 address and additionally relies on a deprecated (as of version 31) way to get the address.
https://github.com/home-assistant/android/blob/master/common/src/main/java/io/homeassistant/companion/android/common/sensors/NetworkSensorManager.kt#L345
Describe the solution you'd like
Update the NetworkSensorManager to use LinkAddress to retrieve the inet addresses and display both types of addresses as part of the wifiInfo sensor. I am happy to open a PR for this change as well.
Describe alternatives you've considered, if any
Doing it manually instead of using home-assistant. I feel like the simple check and cycle is exactly the kind of automation that fits the goals of the home-assistant project.
Additional context
I am happy to make the code changes, which should be rather minimal. Just want a go ahead from someone before putting in the work.
The text was updated successfully, but these errors were encountered: