Config flow for homekit (#34560)

* Config flow for homekit

Allows multiple homekit bridges to run

HAP-python state is now stored at .storage/homekit.{entry_id}.state
aids is now stored at .storage/homekit.{entry_id}.aids

Overcomes 150 device limit by supporting
multiple bridges.

Name and port are now automatically allocated
to avoid conflicts which was one of the main
reasons pairing failed.

YAML configuration remains available in order to offer entity
specific configuration.

Entries created by config flow can add and remove
included domains and entities without having to restart

* Fix services as there are multiple now

* migrate in executor

* drop title from strings

* Update homeassistant/components/homekit/strings.json

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Make auto_start advanced mode only, add coverage

* put back title

* more references

* delete port since manual config is no longer needed

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston 2020-04-30 23:05:06 -05:00 committed by GitHub
parent 5699cb8a09
commit 793592b2b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1754 additions and 322 deletions

View file

@ -0,0 +1,34 @@
"""Test util for the homekit integration."""
from asynctest import patch
from homeassistant.components.homekit.const import DOMAIN
from homeassistant.const import CONF_NAME, CONF_PORT
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
PATH_HOMEKIT = "homeassistant.components.homekit"
async def async_init_integration(hass: HomeAssistant) -> MockConfigEntry:
"""Set up the homekit integration in Home Assistant."""
with patch(f"{PATH_HOMEKIT}.HomeKit.async_start"):
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
return entry
async def async_init_entry(hass: HomeAssistant, entry: MockConfigEntry):
"""Set up the homekit integration in Home Assistant."""
with patch(f"{PATH_HOMEKIT}.HomeKit.async_start"):
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
return entry