Fix GoGoGate2 configuration URL when remote access is disabled (#98387)
This commit is contained in:
parent
d6a7127b84
commit
cb4917f880
3 changed files with 7 additions and 4 deletions
|
@ -113,9 +113,10 @@ class GoGoGate2Entity(CoordinatorEntity[DeviceDataUpdateCoordinator]):
|
|||
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))},
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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")
|
||||
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue