mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove async_setup from locative (#93895)
* Remove async_setup from locative * Micro-optimize async_setup_entry
This commit is contained in:
parent
23ca26ae56
commit
bb5430ff59
@ -21,7 +21,6 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.helpers import config_entry_flow
|
from homeassistant.helpers import config_entry_flow
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.typing import ConfigType
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -61,12 +60,6 @@ WEBHOOK_SCHEMA = vol.All(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
|
|
||||||
"""Set up the Locative component."""
|
|
||||||
hass.data[DOMAIN] = {"devices": set(), "unsub_device_tracker": {}}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def handle_webhook(hass, webhook_id, request):
|
async def handle_webhook(hass, webhook_id, request):
|
||||||
"""Handle incoming webhook from Locative."""
|
"""Handle incoming webhook from Locative."""
|
||||||
try:
|
try:
|
||||||
@ -117,6 +110,8 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Configure based on config entry."""
|
"""Configure based on config entry."""
|
||||||
|
if DOMAIN not in hass.data:
|
||||||
|
hass.data[DOMAIN] = {"devices": set(), "unsub_device_tracker": {}}
|
||||||
webhook.async_register(
|
webhook.async_register(
|
||||||
hass, DOMAIN, "Locative", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
hass, DOMAIN, "Locative", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user