1 """Zeroconf usage utility to warn about multiple instances."""
9 from .models
import HaZeroconf
13 """Wrap the Zeroconf class to return the shared instance.
15 Only if if multiple instances are detected.
18 def new_zeroconf_new(self: zeroconf.Zeroconf, *k: Any, **kw: Any) -> HaZeroconf:
21 "attempted to create another Zeroconf instance. Please use the shared"
23 " homeassistant.components.zeroconf.async_get_instance(hass)"
25 exclude_integrations={
"zeroconf"},
26 core_behavior=ReportBehavior.LOG,
30 def new_zeroconf_init(self: zeroconf.Zeroconf, *k: Any, **kw: Any) ->
None:
33 zeroconf.Zeroconf.__new__ = new_zeroconf_new
34 zeroconf.Zeroconf.__init__ = new_zeroconf_init
None install_multiple_zeroconf_catcher(HaZeroconf hass_zc)
None report_usage(str what, *str|None breaks_in_ha_version=None, ReportBehavior core_behavior=ReportBehavior.ERROR, ReportBehavior core_integration_behavior=ReportBehavior.LOG, ReportBehavior custom_integration_behavior=ReportBehavior.LOG, set[str]|None exclude_integrations=None, str|None integration_domain=None, int level=logging.WARNING)