1 """The 1-Wire component."""
5 from pyownet
import protocol
12 from .const
import DOMAIN, PLATFORMS
13 from .onewirehub
import CannotConnect, OneWireHub
15 _LOGGER = logging.getLogger(__name__)
16 type OneWireConfigEntry = ConfigEntry[OneWireHub]
20 """Set up a 1-Wire proxy for a config entry."""
23 await onewire_hub.initialize(entry)
28 raise ConfigEntryNotReady
from exc
30 entry.runtime_data = onewire_hub
32 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
34 entry.async_on_unload(entry.add_update_listener(options_update_listener))
40 hass: HomeAssistant, config_entry: OneWireConfigEntry, device_entry: dr.DeviceEntry
42 """Remove a config entry from a device."""
43 onewire_hub = config_entry.runtime_data
44 return not device_entry.identifiers.intersection(
45 (DOMAIN, device.id)
for device
in onewire_hub.devices
or []
50 hass: HomeAssistant, config_entry: OneWireConfigEntry
52 """Unload a config entry."""
53 return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
57 hass: HomeAssistant, entry: OneWireConfigEntry
59 """Handle options update."""
60 _LOGGER.debug(
"Configuration options updated, reloading OneWire integration")
61 await hass.config_entries.async_reload(entry.entry_id)
bool async_remove_config_entry_device(HomeAssistant hass, OneWireConfigEntry config_entry, dr.DeviceEntry device_entry)
bool async_setup_entry(HomeAssistant hass, OneWireConfigEntry entry)
None options_update_listener(HomeAssistant hass, OneWireConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, OneWireConfigEntry config_entry)