Skip to content

Commit

Permalink
Fix GoGoGate2 configuration URL when remote access is disabled (#98387)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindwe committed Aug 17, 2023
1 parent d6a7127 commit cb4917f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
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"

0 comments on commit cb4917f

Please sign in to comment.