Include addon name in otbr config entry title (#96786)

This commit is contained in:
Erik Montnemery 2023-07-17 21:26:15 +02:00 committed by GitHub
parent 8559af8232
commit 863b36c0c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -51,10 +51,10 @@ async def _title(hass: HomeAssistant, discovery_info: HassioServiceInfo) -> str:
device = addon_info.get("options", {}).get("device") device = addon_info.get("options", {}).get("device")
if _is_yellow(hass) and device == "/dev/TTYAMA1": if _is_yellow(hass) and device == "/dev/TTYAMA1":
return "Home Assistant Yellow" return f"Home Assistant Yellow ({discovery_info.name})"
if device and "SkyConnect" in device: if device and "SkyConnect" in device:
return "Home Assistant SkyConnect" return f"Home Assistant SkyConnect ({discovery_info.name})"
return discovery_info.name return discovery_info.name

View file

@ -261,7 +261,7 @@ async def test_hassio_discovery_flow_yellow(
} }
assert result["type"] == FlowResultType.CREATE_ENTRY assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == "Home Assistant Yellow" assert result["title"] == "Home Assistant Yellow (Silicon Labs Multiprotocol)"
assert result["data"] == expected_data assert result["data"] == expected_data
assert result["options"] == {} assert result["options"] == {}
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -269,7 +269,7 @@ async def test_hassio_discovery_flow_yellow(
config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0] config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0]
assert config_entry.data == expected_data assert config_entry.data == expected_data
assert config_entry.options == {} assert config_entry.options == {}
assert config_entry.title == "Home Assistant Yellow" assert config_entry.title == "Home Assistant Yellow (Silicon Labs Multiprotocol)"
assert config_entry.unique_id == HASSIO_DATA.uuid assert config_entry.unique_id == HASSIO_DATA.uuid
@ -307,7 +307,7 @@ async def test_hassio_discovery_flow_sky_connect(
} }
assert result["type"] == FlowResultType.CREATE_ENTRY assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == "Home Assistant SkyConnect" assert result["title"] == "Home Assistant SkyConnect (Silicon Labs Multiprotocol)"
assert result["data"] == expected_data assert result["data"] == expected_data
assert result["options"] == {} assert result["options"] == {}
assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1
@ -315,7 +315,9 @@ async def test_hassio_discovery_flow_sky_connect(
config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0] config_entry = hass.config_entries.async_entries(otbr.DOMAIN)[0]
assert config_entry.data == expected_data assert config_entry.data == expected_data
assert config_entry.options == {} assert config_entry.options == {}
assert config_entry.title == "Home Assistant SkyConnect" assert (
config_entry.title == "Home Assistant SkyConnect (Silicon Labs Multiprotocol)"
)
assert config_entry.unique_id == HASSIO_DATA.uuid assert config_entry.unique_id == HASSIO_DATA.uuid