Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The CPU Speed integration."""
2 
3 from cpuinfo import cpuinfo
4 
5 from homeassistant.config_entries import ConfigEntry
6 from homeassistant.core import HomeAssistant
7 
8 from .const import LOGGER, PLATFORMS
9 
10 
11 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
12  """Set up from a config entry."""
13  if not await hass.async_add_executor_job(cpuinfo.get_cpu_info):
14  LOGGER.error(
15  "Unable to get CPU information, the CPU Speed integration "
16  "is not compatible with your system"
17  )
18  return False
19 
20  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
21  return True
22 
23 
24 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
25  """Unload a config entry."""
26  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:24
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:11