Remove async_setup from gpslogger (#93893)

This commit is contained in:
Erik Montnemery 2023-06-01 12:19:14 +02:00 committed by GitHub
parent c5dd540ffc
commit 4e5902c15b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_flow
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import ConfigType
from .const import (
ATTR_ACCURACY,
@ -55,12 +54,6 @@ WEBHOOK_SCHEMA = vol.Schema(
)
async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
"""Set up the GPSLogger component."""
hass.data[DOMAIN] = {"devices": set(), "unsub_device_tracker": {}}
return True
async def handle_webhook(hass, webhook_id, request):
"""Handle incoming webhook with GPSLogger request."""
try:
@ -95,6 +88,7 @@ async def handle_webhook(hass, webhook_id, request):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Configure based on config entry."""
hass.data.setdefault(DOMAIN, {"devices": set(), "unsub_device_tracker": {}})
webhook.async_register(
hass, DOMAIN, "GPSLogger", entry.data[CONF_WEBHOOK_ID], handle_webhook
)