Add support for managing the silabs multiprotocol add-on (#82170)
* Add support for managing the silabs multiprotocol add-on * Fix passing context when starting option flow * Allow unloading a ha yellow config entry * Fix tests * Log data passed to ZHA option flow * Improve ZHA migration logic * Move tests * Improve test coverage * Remove dead code * Drop automatic ZHA migration
This commit is contained in:
parent
607a0e7697
commit
aaec464627
21 changed files with 1329 additions and 9 deletions
|
@ -3,7 +3,9 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow
|
||||
from homeassistant.components.homeassistant_hardware import silabs_multiprotocol_addon
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import FlowResult
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -14,9 +16,31 @@ class HomeAssistantYellowConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
VERSION = 1
|
||||
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: ConfigEntry,
|
||||
) -> HomeAssistantYellowOptionsFlow:
|
||||
"""Return the options flow."""
|
||||
return HomeAssistantYellowOptionsFlow(config_entry)
|
||||
|
||||
async def async_step_system(self, data: dict[str, Any] | None = None) -> FlowResult:
|
||||
"""Handle the initial step."""
|
||||
if self._async_current_entries():
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
||||
return self.async_create_entry(title="Home Assistant Yellow", data={})
|
||||
|
||||
|
||||
class HomeAssistantYellowOptionsFlow(silabs_multiprotocol_addon.OptionsFlowHandler):
|
||||
"""Handle an option flow for Home Assistant Yellow."""
|
||||
|
||||
async def _async_serial_port_settings(
|
||||
self,
|
||||
) -> silabs_multiprotocol_addon.SerialPortSettings:
|
||||
"""Return the radio serial port settings."""
|
||||
return silabs_multiprotocol_addon.SerialPortSettings(
|
||||
device="/dev/ttyAMA1",
|
||||
baudrate="115200",
|
||||
flow_control=True,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue