diff --git a/homeassistant/components/rest/binary_sensor.py b/homeassistant/components/rest/binary_sensor.py index 60d9a2d8504..0c1f4df6093 100644 --- a/homeassistant/components/rest/binary_sensor.py +++ b/homeassistant/components/rest/binary_sensor.py @@ -67,7 +67,7 @@ async def async_setup_platform( if isinstance(rest.last_exception, ssl.SSLError): _LOGGER.error( "Error connecting %s failed with %s", - conf[CONF_RESOURCE], + rest.url, rest.last_exception, ) return diff --git a/homeassistant/components/rest/data.py b/homeassistant/components/rest/data.py index 8f1dd937391..95086f68d70 100644 --- a/homeassistant/components/rest/data.py +++ b/homeassistant/components/rest/data.py @@ -50,6 +50,11 @@ class RestData: self.last_exception: Exception | None = None self.headers: httpx.Headers | None = None + @property + def url(self) -> str: + """Get url.""" + return self._resource + def set_url(self, url: str) -> None: """Set url.""" self._resource = url diff --git a/homeassistant/components/rest/sensor.py b/homeassistant/components/rest/sensor.py index ead5a5893f4..6fc0b69d1fd 100644 --- a/homeassistant/components/rest/sensor.py +++ b/homeassistant/components/rest/sensor.py @@ -71,7 +71,7 @@ async def async_setup_platform( if isinstance(rest.last_exception, ssl.SSLError): _LOGGER.error( "Error connecting %s failed with %s", - conf[CONF_RESOURCE], + rest.url, rest.last_exception, ) return