From ebc0df8d88d3fc5e5bb076d0a7a0d6322768e75a Mon Sep 17 00:00:00 2001 From: Mike Woudenberg Date: Tue, 20 Jun 2023 21:20:58 +0200 Subject: [PATCH] Uses get_url for webhook base --- custom_components/loqed/coordinator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/loqed/coordinator.py b/custom_components/loqed/coordinator.py index ec7d546..c856b3d 100644 --- a/custom_components/loqed/coordinator.py +++ b/custom_components/loqed/coordinator.py @@ -10,6 +10,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.core import HomeAssistant, callback +from homeassistant.helpers.network import get_url from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import DOMAIN @@ -115,7 +116,8 @@ async def ensure_webhooks(self) -> None: webhook.async_register( self.hass, DOMAIN, "Loqed", webhook_id, self._handle_webhook ) - webhook_url = webhook.async_generate_url(self.hass, webhook_id) + webhook_path = webhook.async_generate_path(webhook_id) + webhook_url = f"{get_url(self.hass)}{webhook_path}" _LOGGER.info("Webhook URL: %s", webhook_url) webhooks = await self.lock.getWebhooks() @@ -134,7 +136,8 @@ async def ensure_webhooks(self) -> None: async def remove_webhooks(self) -> None: """Remove webhook from LOQED bridge.""" webhook_id = self._entry.data[CONF_WEBHOOK_ID] - webhook_url = webhook.async_generate_url(self.hass, webhook_id) + webhook_path = webhook.async_generate_path(webhook_id) + webhook_url = f"{get_url(self.hass)}{webhook_path}" webhook.async_unregister( self.hass,