2024-02-26 16:10:11 +00:00
|
|
|
"""The Webmin integration."""
|
|
|
|
|
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
|
|
from homeassistant.const import Platform
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
|
|
from .coordinator import WebminUpdateCoordinator
|
|
|
|
|
|
|
|
PLATFORMS = [Platform.SENSOR]
|
|
|
|
|
2024-05-17 13:42:58 +00:00
|
|
|
type WebminConfigEntry = ConfigEntry[WebminUpdateCoordinator]
|
2024-02-26 16:10:11 +00:00
|
|
|
|
2024-05-08 07:04:20 +00:00
|
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: WebminConfigEntry) -> bool:
|
2024-02-26 16:10:11 +00:00
|
|
|
"""Set up Webmin from a config entry."""
|
|
|
|
|
|
|
|
coordinator = WebminUpdateCoordinator(hass, entry)
|
|
|
|
await coordinator.async_config_entry_first_refresh()
|
|
|
|
await coordinator.async_setup()
|
2024-05-08 07:04:20 +00:00
|
|
|
entry.runtime_data = coordinator
|
2024-02-26 16:10:11 +00:00
|
|
|
|
|
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2024-05-08 07:04:20 +00:00
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: WebminConfigEntry) -> bool:
|
2024-02-26 16:10:11 +00:00
|
|
|
"""Unload a config entry."""
|
2024-05-08 07:04:20 +00:00
|
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|