Update board file list to reflect currently available boards (#72085)

* Update board file list to reflect currently available boards

* Warn if board does not exist and migrate Intel NUC to Generic x86-64

* Remove integration in case a old board is referenced

* Don't remove the config entry automatically/fix logging message

* Address pylint issue
This commit is contained in:
Stefan Agner 2022-05-23 14:28:56 +02:00 committed by GitHub
parent 071f6d7099
commit 6ec755a79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View file

@ -1,6 +1,8 @@
"""The Version integration."""
from __future__ import annotations
import logging
from pyhaversion import HaVersion
from homeassistant.config_entries import ConfigEntry
@ -18,16 +20,29 @@ from .const import (
)
from .coordinator import VersionDataUpdateCoordinator
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up the version integration from a config entry."""
board = entry.data[CONF_BOARD]
if board not in BOARD_MAP:
_LOGGER.error(
'Board "%s" is (no longer) valid. Please remove the integration "%s"',
board,
entry.title,
)
return False
coordinator = VersionDataUpdateCoordinator(
hass=hass,
api=HaVersion(
session=async_get_clientsession(hass),
source=entry.data[CONF_SOURCE],
image=entry.data[CONF_IMAGE],
board=BOARD_MAP[entry.data[CONF_BOARD]],
board=BOARD_MAP[board],
channel=entry.data[CONF_CHANNEL].lower(),
),
)