mirror of
https://github.com/home-assistant/core.git
synced 2026-07-03 04:36:04 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
36 lines
886 B
Python
36 lines
886 B
Python
"""The dhcp integration."""
|
|
|
|
from collections.abc import Callable
|
|
from functools import partial
|
|
|
|
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
|
|
|
from .models import DATA_DHCP, DHCPAddressData
|
|
|
|
|
|
@callback
|
|
def async_register_dhcp_callback_internal(
|
|
hass: HomeAssistant,
|
|
callback_: Callable[[dict[str, DHCPAddressData]], None],
|
|
) -> CALLBACK_TYPE:
|
|
"""Register a dhcp callback.
|
|
|
|
For internal use only.
|
|
This is not intended for use by integrations.
|
|
"""
|
|
callbacks = hass.data[DATA_DHCP].callbacks
|
|
callbacks.add(callback_)
|
|
return partial(callbacks.remove, callback_)
|
|
|
|
|
|
@callback
|
|
def async_get_address_data_internal(
|
|
hass: HomeAssistant,
|
|
) -> dict[str, DHCPAddressData]:
|
|
"""Get the address data.
|
|
|
|
For internal use only.
|
|
This is not intended for use by integrations.
|
|
"""
|
|
return hass.data[DATA_DHCP].address_data
|