mirror of
https://github.com/elisspace/core.git
synced 2026-08-30 16:12:01 +00:00
* Move constant values to separate file * Move constant values to separate file * Add config flow to lastfm * Add tests * Add config flow to lastfm * Add tests * Add tests * Add tests * Add extra form for main user and autofill with friends * Add extra form for main user and autofill with friends * Add extra form for main user and autofill with friends * Add extra form for main user and autofill with friends * Add OptionsFlow * Add tests * Fix feedback * Fix feedback * Fix feedback * Fix feedback * Fix test * Apply suggestions from code review Co-authored-by: G Johansson <goran.johansson@shiftit.se> * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update homeassistant/components/lastfm/config_flow.py Co-authored-by: G Johansson <goran.johansson@shiftit.se> * Add tests * Cleanup * Update config_flow.py * Update config_flow.py * Update config_flow.py * Fix test * Fix feedback * Codeowner lastfm * Fix feedback * Fix feedback * Parametrize errors * Parametrize errors * Parametrize errors * Finish tests --------- Co-authored-by: G Johansson <goran.johansson@shiftit.se>
28 lines
848 B
Python
28 lines
848 B
Python
"""The lastfm component."""
|
|
from __future__ import annotations
|
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .const import PLATFORMS
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Set up lastfm from a config entry."""
|
|
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Unload lastfm config entry."""
|
|
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
|
|
|
|
|
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
"""Handle options update."""
|
|
await hass.config_entries.async_reload(entry.entry_id)
|