1 """The Brother component."""
3 from __future__
import annotations
5 from brother
import Brother, SnmpError
13 from .coordinator
import BrotherDataUpdateCoordinator
15 PLATFORMS = [Platform.SENSOR]
17 type BrotherConfigEntry = ConfigEntry[BrotherDataUpdateCoordinator]
21 """Set up Brother from a config entry."""
22 host = entry.data[CONF_HOST]
23 printer_type = entry.data[CONF_TYPE]
27 brother = await Brother.create(
28 host, printer_type=printer_type, snmp_engine=snmp_engine
30 except (ConnectionError, SnmpError, TimeoutError)
as error:
31 raise ConfigEntryNotReady
from error
34 await coordinator.async_config_entry_first_refresh()
36 entry.runtime_data = coordinator
38 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
44 """Unload a config entry."""
45 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, BrotherConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, BrotherConfigEntry entry)
SnmpEngine async_get_snmp_engine(HomeAssistant hass)