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 Reolink DHCP IP update #103654
Fix Reolink DHCP IP update #103654
Conversation
@@ -113,7 +113,9 @@ async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowRes | |||
raise AbortFlow("already_configured") | |||
|
|||
# check if the camera is reachable at the new IP | |||
host = ReolinkHost(self.hass, existing_entry.data, existing_entry.options) | |||
new_config = dict(existing_entry.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is missing test coverage if it can be changed without updating tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well there is a check that goes over this code, but since the test controlls if a ConnectionError
occurs or not it does not mather if the IP is valid or not.
The IP that is eventually saved to the config is checked, but that is correct, see line 142:
self._abort_if_unique_id_configured(updates={CONF_HOST: discovery_info.ip})
Where the correct discovery_info.ip
is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added some extra assertions (assert_called_with
) in the tests so that it would now fail if this would be changed in the future.
Breaking change
Proposed change
When DHCP indicates the IP adress of a Reolink camera has changed, first a connection is attempted to confirm the new IP actually works.
Unfortunetly the old IP is used in this attempt instead of the newly discovered IP, sorry my mistake when writing that code...
This fixes that mistake.
Tested in my production enviroment (changed the IP to some random value in core.config_entries file and let the DHCP set it back correctly).
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: