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 GoGoGate2 configuration URL when remote access is disabled #98387

Merged
merged 2 commits into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions homeassistant/components/gogogate2/common.py
Expand Up @@ -113,9 +113,10 @@ def door_status(self) -> AbstractDoor:
def device_info(self) -> DeviceInfo:
"""Device info for the controller."""
data = self.coordinator.data
configuration_url = (
f"https://{data.remoteaccess}" if data.remoteaccess else None
)
if data.remoteaccessenabled:
configuration_url = f"https://{data.remoteaccess}"
else:
configuration_url = f"http://{self._config_entry.data[CONF_IP_ADDRESS]}"
return DeviceInfo(
configuration_url=configuration_url,
identifiers={(DOMAIN, str(self._config_entry.unique_id))},
Expand Down
2 changes: 1 addition & 1 deletion tests/components/gogogate2/__init__.py
Expand Up @@ -77,7 +77,7 @@ def _mocked_ismartgate_closed_door_response():
ismartgatename="ismartgatename0",
model="ismartgatePRO",
apiversion="",
remoteaccessenabled=False,
remoteaccessenabled=True,
remoteaccess="abc321.blah.blah",
firmwareversion="555",
pin=123,
Expand Down
2 changes: 2 additions & 0 deletions tests/components/gogogate2/test_cover.py
Expand Up @@ -340,6 +340,7 @@ async def test_device_info_ismartgate(
assert device.name == "mycontroller"
assert device.model == "ismartgatePRO"
assert device.sw_version == "555"
assert device.configuration_url == "https://abc321.blah.blah"


@patch("homeassistant.components.gogogate2.common.GogoGate2Api")
Expand Down Expand Up @@ -375,3 +376,4 @@ async def test_device_info_gogogate2(
assert device.name == "mycontroller"
assert device.model == "gogogate2"
assert device.sw_version == "222"
assert device.configuration_url == "http://127.0.0.1"