1 """The AfterShip integration."""
3 from __future__
import annotations
5 from pyaftership
import AfterShip, AfterShipException
13 PLATFORMS: list[Platform] = [Platform.SENSOR]
15 type AfterShipConfigEntry = ConfigEntry[AfterShip]
19 """Set up AfterShip from a config entry."""
22 aftership = AfterShip(api_key=entry.data[CONF_API_KEY], session=session)
25 await aftership.trackings.list()
26 except AfterShipException
as err:
27 raise ConfigEntryNotReady
from err
29 entry.runtime_data = aftership
31 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
37 """Unload a config entry."""
38 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, AfterShipConfigEntry entry)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)