Add support for discovery via DHCP (#45087)
* Add support for discovery via DHCP * additional tesla ouis * merge tests * dhcp test * merge requirements test * dhcp test * dhcp discovery * dhcp discovery * pylint * pylint * pylint * fix * Add matching tests * 100% cover * cleanup * fix codespell * Update exception handling * remove unneeded comment * fix options handling exception * fix options handling exception
This commit is contained in:
parent
402a0ea7da
commit
da677f7d5a
38 changed files with 843 additions and 17 deletions
|
@ -25,6 +25,7 @@ from typing import (
|
|||
cast,
|
||||
)
|
||||
|
||||
from homeassistant.generated.dhcp import DHCP
|
||||
from homeassistant.generated.mqtt import MQTT
|
||||
from homeassistant.generated.ssdp import SSDP
|
||||
from homeassistant.generated.zeroconf import HOMEKIT, ZEROCONF
|
||||
|
@ -171,6 +172,20 @@ async def async_get_zeroconf(hass: "HomeAssistant") -> Dict[str, List[Dict[str,
|
|||
return zeroconf
|
||||
|
||||
|
||||
async def async_get_dhcp(hass: "HomeAssistant") -> List[Dict[str, str]]:
|
||||
"""Return cached list of dhcp types."""
|
||||
dhcp: List[Dict[str, str]] = DHCP.copy()
|
||||
|
||||
integrations = await async_get_custom_components(hass)
|
||||
for integration in integrations.values():
|
||||
if not integration.dhcp:
|
||||
continue
|
||||
for entry in integration.dhcp:
|
||||
dhcp.append({"domain": integration.domain, **entry})
|
||||
|
||||
return dhcp
|
||||
|
||||
|
||||
async def async_get_homekit(hass: "HomeAssistant") -> Dict[str, str]:
|
||||
"""Return cached list of homekit models."""
|
||||
|
||||
|
@ -356,6 +371,11 @@ class Integration:
|
|||
"""Return Integration zeroconf entries."""
|
||||
return cast(List[str], self.manifest.get("zeroconf"))
|
||||
|
||||
@property
|
||||
def dhcp(self) -> Optional[list]:
|
||||
"""Return Integration dhcp entries."""
|
||||
return cast(List[str], self.manifest.get("dhcp"))
|
||||
|
||||
@property
|
||||
def homekit(self) -> Optional[dict]:
|
||||
"""Return Integration homekit entries."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue