Skip to content

Commit

Permalink
Uses get_url for webhook base
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewoudenberg committed Jun 24, 2023
1 parent 9618b72 commit ebc0df8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/loqed/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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,
Expand Down

0 comments on commit ebc0df8

Please sign in to comment.