2021-12-28 20:17:53 +00:00
|
|
|
"""The CPU Speed integration."""
|
2021-12-29 17:54:47 +00:00
|
|
|
from cpuinfo import cpuinfo
|
|
|
|
|
2021-12-28 20:17:53 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2021-12-29 17:54:47 +00:00
|
|
|
from .const import LOGGER, PLATFORMS
|
2021-12-28 20:17:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
|
"""Set up from a config entry."""
|
2021-12-29 17:54:47 +00:00
|
|
|
if not await hass.async_add_executor_job(cpuinfo.get_cpu_info):
|
|
|
|
LOGGER.error(
|
|
|
|
"Unable to get CPU information, the CPU Speed integration "
|
|
|
|
"is not compatible with your system"
|
|
|
|
)
|
|
|
|
return False
|
|
|
|
|
2022-07-09 15:27:42 +00:00
|
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
2021-12-28 20:17:53 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
|
"""Unload a config entry."""
|
|
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|