Skip to content

Commit 24270d7

Browse files
committed
fix(webhook): Fix deprecated has.components.webhook
Fixes #258
1 parent be694f2 commit 24270d7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

custom_components/nodered/websocket.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
InvalidDeviceAutomationConfig,
2626
)
2727
from homeassistant.components.device_automation.trigger import TRIGGER_SCHEMA
28-
from homeassistant.components.webhook import SUPPORTED_METHODS
28+
from homeassistant.components.webhook import (
29+
async_register as webhook_async_register,
30+
async_unregister as webhook_async_unregister,
31+
SUPPORTED_METHODS,
32+
)
2933
from homeassistant.components.websocket_api import (
3034
async_register_command,
3135
async_response,
@@ -55,6 +59,7 @@
5559
from homeassistant.helpers.typing import HomeAssistantType
5660
import voluptuous as vol
5761

62+
5863
from .const import (
5964
CONF_ATTRIBUTES,
6065
CONF_COMPONENT,
@@ -271,7 +276,7 @@ async def handle_webhook(hass, id, request):
271276
def remove_webhook() -> None:
272277
"""Remove webhook command."""
273278
try:
274-
hass.components.webhook.async_unregister(webhook_id)
279+
webhook_async_unregister(hass, webhook_id)
275280

276281
except ValueError:
277282
pass
@@ -280,7 +285,8 @@ def remove_webhook() -> None:
280285
connection.send_message(result_message(msg[CONF_ID]))
281286

282287
try:
283-
hass.components.webhook.async_register(
288+
webhook_async_register(
289+
hass,
284290
DOMAIN,
285291
msg[CONF_NAME],
286292
webhook_id,

0 commit comments

Comments
 (0)