Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.zeroconf Namespace Reference

Namespaces

 models
 
 usage
 

Classes

class  ZeroconfDiscovery
 
class  ZeroconfServiceInfo
 

Functions

HaAsyncZeroconf _async_get_instance (HomeAssistant hass, **Any zcargs)
 
None _async_register_hass_zc_service (HomeAssistant hass, HaAsyncZeroconf aio_zc, str uuid)
 
bool _async_zc_has_functional_dual_stack ()
 
tuple[ dict[str, HomeKitDiscoveredIntegration], dict[re.Pattern, HomeKitDiscoveredIntegration],] _build_homekit_model_lookups (dict[str, HomeKitDiscoveredIntegration] homekit_models)
 
re.Pattern _compile_fnmatch (str pattern)
 
str _filter_disallowed_characters (str name)
 
bool _match_against_props (dict[str, str] matcher, dict[str, str|None] props)
 
bool _memorized_fnmatch (str name, str pattern)
 
None _suppress_invalid_properties (dict properties)
 
str _truncate_location_name_to_valid (str location_name)
 
HaAsyncZeroconf async_get_async_instance (HomeAssistant hass)
 
HomeKitDiscoveredIntegration|None async_get_homekit_discovery (dict[str, HomeKitDiscoveredIntegration] homekit_model_lookups, dict[re.Pattern, HomeKitDiscoveredIntegration] homekit_model_matchers, dict[str, Any] props)
 
HaZeroconf async_get_instance (HomeAssistant hass)
 
bool async_setup (HomeAssistant hass, ConfigType config)
 
ZeroconfServiceInfo|None info_from_service (AsyncServiceInfo service)
 
bool is_homekit_paired (dict[str, Any] props)
 

Variables

tuple _HOMEKIT_MODEL_SPLITS = (None, " ", "-")
 
 _LOGGER = logging.getLogger(__name__)
 
string CONF_DEFAULT_INTERFACE = "default_interface"
 
string CONF_IPV6 = "ipv6"
 
 CONFIG_SCHEMA
 
bool DEFAULT_DEFAULT_INTERFACE = True
 
bool DEFAULT_IPV6 = True
 
string DOMAIN = "zeroconf"
 
 Final
 
string HOMEKIT_MODEL_LOWER = "md"
 
string HOMEKIT_MODEL_UPPER = "MD"
 
string HOMEKIT_PAIRED_STATUS_FLAG = "sf"
 
list HOMEKIT_TYPES
 
int MAX_NAME_LEN = 63
 
int MAX_PROPERTY_VALUE_LEN = 230
 
string ZEROCONF_TYPE = "_home-assistant._tcp.local."
 

Detailed Description

Support for exposing Home Assistant via Zeroconf.

Function Documentation

◆ _async_get_instance()

HaAsyncZeroconf homeassistant.components.zeroconf._async_get_instance ( HomeAssistant  hass,
**Any  zcargs 
)
private

Definition at line 157 of file __init__.py.

◆ _async_register_hass_zc_service()

None homeassistant.components.zeroconf._async_register_hass_zc_service ( HomeAssistant  hass,
HaAsyncZeroconf  aio_zc,
str   uuid 
)
private

Definition at line 284 of file __init__.py.

◆ _async_zc_has_functional_dual_stack()

bool homeassistant.components.zeroconf._async_zc_has_functional_dual_stack ( )
private
Return true for platforms not supporting IP_ADD_MEMBERSHIP on an AF_INET6 socket.

Zeroconf only supports a single listen socket at this time.

Definition at line 181 of file __init__.py.

◆ _build_homekit_model_lookups()

tuple[ dict[str, HomeKitDiscoveredIntegration], dict[re.Pattern, HomeKitDiscoveredIntegration], ] homeassistant.components.zeroconf._build_homekit_model_lookups ( dict[str, HomeKitDiscoveredIntegration homekit_models)
private
Build lookups for homekit models.

Definition at line 257 of file __init__.py.

◆ _compile_fnmatch()

re.Pattern homeassistant.components.zeroconf._compile_fnmatch ( str  pattern)
private
Compile a fnmatch pattern.

Definition at line 659 of file __init__.py.

◆ _filter_disallowed_characters()

str homeassistant.components.zeroconf._filter_disallowed_characters ( str  name)
private
Filter disallowed characters from a string.

. is a reversed character for zeroconf.

Definition at line 276 of file __init__.py.

◆ _match_against_props()

bool homeassistant.components.zeroconf._match_against_props ( dict[str, str]  matcher,
dict[str, str | None]  props 
)
private
Check a matcher to ensure all values in props.

Definition at line 329 of file __init__.py.

◆ _memorized_fnmatch()

bool homeassistant.components.zeroconf._memorized_fnmatch ( str  name,
str  pattern 
)
private
Memorized version of fnmatch that has a larger lru_cache.

The default version of fnmatch only has a lru_cache of 256 entries.
With many devices we quickly reach that limit and end up compiling
the same pattern over and over again.

Zeroconf has its own memorized fnmatch with its own lru_cache
since the data is going to be relatively the same
since the devices will not change frequently

Definition at line 665 of file __init__.py.

◆ _suppress_invalid_properties()

None homeassistant.components.zeroconf._suppress_invalid_properties ( dict  properties)
private
Suppress any properties that will cause zeroconf to fail to startup.

Definition at line 622 of file __init__.py.

◆ _truncate_location_name_to_valid()

str homeassistant.components.zeroconf._truncate_location_name_to_valid ( str  location_name)
private
Truncate or return the location name usable for zeroconf.

Definition at line 642 of file __init__.py.

◆ async_get_async_instance()

HaAsyncZeroconf homeassistant.components.zeroconf.async_get_async_instance ( HomeAssistant  hass)
Zeroconf instance to be shared with other integrations that use it.

Definition at line 152 of file __init__.py.

◆ async_get_homekit_discovery()

HomeKitDiscoveredIntegration | None homeassistant.components.zeroconf.async_get_homekit_discovery ( dict[str, HomeKitDiscoveredIntegration homekit_model_lookups,
dict[re.Pattern, HomeKitDiscoveredIntegration homekit_model_matchers,
dict[str, Any]  props 
)
Handle a HomeKit discovery.

Return the domain to forward the discovery data to

Definition at line 562 of file __init__.py.

◆ async_get_instance()

HaZeroconf homeassistant.components.zeroconf.async_get_instance ( HomeAssistant  hass)
Zeroconf instance to be shared with other integrations that use it.

Definition at line 146 of file __init__.py.

◆ async_setup()

bool homeassistant.components.zeroconf.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Set up Zeroconf and make Home Assistant discoverable.

Definition at line 191 of file __init__.py.

◆ info_from_service()

ZeroconfServiceInfo | None homeassistant.components.zeroconf.info_from_service ( AsyncServiceInfo  service)
Return prepared info from mDNS entries.

Definition at line 588 of file __init__.py.

◆ is_homekit_paired()

bool homeassistant.components.zeroconf.is_homekit_paired ( dict[str, Any]  props)
Check properties to see if a device is homekit paired.

Definition at line 338 of file __init__.py.

Variable Documentation

◆ _HOMEKIT_MODEL_SPLITS

tuple homeassistant.components.zeroconf._HOMEKIT_MODEL_SPLITS = (None, " ", "-")
private

Definition at line 62 of file __init__.py.

◆ _LOGGER

homeassistant.components.zeroconf._LOGGER = logging.getLogger(__name__)
private

Definition at line 52 of file __init__.py.

◆ CONF_DEFAULT_INTERFACE

string homeassistant.components.zeroconf.CONF_DEFAULT_INTERFACE = "default_interface"

Definition at line 65 of file __init__.py.

◆ CONF_IPV6

string homeassistant.components.zeroconf.CONF_IPV6 = "ipv6"

Definition at line 66 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.zeroconf.CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  DOMAIN: vol.All(
4  cv.deprecated(CONF_DEFAULT_INTERFACE),
5  cv.deprecated(CONF_IPV6),
6  vol.Schema(
7  {
8  vol.Optional(CONF_DEFAULT_INTERFACE): cv.boolean,
9  vol.Optional(CONF_IPV6, default=DEFAULT_IPV6): cv.boolean,
10  }
11  ),
12  )
13  },
14  extra=vol.ALLOW_EXTRA,
15 )

Definition at line 88 of file __init__.py.

◆ DEFAULT_DEFAULT_INTERFACE

bool homeassistant.components.zeroconf.DEFAULT_DEFAULT_INTERFACE = True

Definition at line 67 of file __init__.py.

◆ DEFAULT_IPV6

bool homeassistant.components.zeroconf.DEFAULT_IPV6 = True

Definition at line 68 of file __init__.py.

◆ DOMAIN

string homeassistant.components.zeroconf.DOMAIN = "zeroconf"

Definition at line 54 of file __init__.py.

◆ Final

homeassistant.components.zeroconf.Final

Definition at line 81 of file __init__.py.

◆ HOMEKIT_MODEL_LOWER

string homeassistant.components.zeroconf.HOMEKIT_MODEL_LOWER = "md"

Definition at line 71 of file __init__.py.

◆ HOMEKIT_MODEL_UPPER

string homeassistant.components.zeroconf.HOMEKIT_MODEL_UPPER = "MD"

Definition at line 72 of file __init__.py.

◆ HOMEKIT_PAIRED_STATUS_FLAG

string homeassistant.components.zeroconf.HOMEKIT_PAIRED_STATUS_FLAG = "sf"

Definition at line 70 of file __init__.py.

◆ HOMEKIT_TYPES

list homeassistant.components.zeroconf.HOMEKIT_TYPES
Initial value:
1 = [
2  "_hap._tcp.local.",
3  # Thread based devices
4  "_hap._udp.local.",
5 ]

Definition at line 57 of file __init__.py.

◆ MAX_NAME_LEN

int homeassistant.components.zeroconf.MAX_NAME_LEN = 63

Definition at line 79 of file __init__.py.

◆ MAX_PROPERTY_VALUE_LEN

int homeassistant.components.zeroconf.MAX_PROPERTY_VALUE_LEN = 230

Definition at line 76 of file __init__.py.

◆ ZEROCONF_TYPE

string homeassistant.components.zeroconf.ZEROCONF_TYPE = "_home-assistant._tcp.local."

Definition at line 56 of file __init__.py.