Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/otbr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from . import homeassistant_hardware, websocket_api
from .const import DOMAIN
from .services import async_setup_services
from .types import OTBRConfigEntry
from .util import (
GetBorderAgentIdNotSupported,
Expand All @@ -34,6 +35,7 @@
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Open Thread Border Router component."""
websocket_api.async_setup(hass)
async_setup_services(hass)

async_register_firmware_info_provider(hass, DOMAIN, homeassistant_hardware)

Expand Down
11 changes: 11 additions & 0 deletions homeassistant/components/otbr/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from .const import DEFAULT_CHANNEL, DOMAIN
from .util import (
async_get_dataset_lock,
compose_default_network_name,
generate_random_pan_id,
get_allowed_channel,
Expand Down Expand Up @@ -87,6 +88,16 @@ class OTBRConfigFlow(ConfigFlow, domain=DOMAIN):

async def _set_dataset(self, api: python_otbr_api.OTBR, otbr_url: str) -> None:
"""Connect to the OTBR and create or apply a dataset if it doesn't have one."""
# Held across the read and the write: the preferred dataset this adopts
# can be repointed by a network migration, and a router provisioned from
# the old pointer would come up on the network everything else just left.
async with async_get_dataset_lock(self.hass):
await self._async_set_dataset(api, otbr_url)
Comment thread
LorbusChris marked this conversation as resolved.

async def _async_set_dataset(
self, api: python_otbr_api.OTBR, otbr_url: str
) -> None:
"""Create or apply a dataset. The caller holds the dataset lock."""
if await api.get_active_dataset_tlvs() is None:
allowed_channel = await get_allowed_channel(self.hass, otbr_url)

Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/otbr/icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"services": {
"migrate_network": {
"service": "mdi:swap-horizontal-variant"
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/otbr/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"documentation": "https://www.home-assistant.io/integrations/otbr",
"integration_type": "service",
"iot_class": "local_polling",
"requirements": ["python-otbr-api==2.10.0"]
"requirements": ["python-otbr-api==2.11.0"]
}
Loading
Loading