parent
2511a9a087
commit
52ca14de48
3 changed files with 51 additions and 1 deletions
|
@ -6,5 +6,6 @@
|
|||
"dependencies": ["websocket_api"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/matter",
|
||||
"iot_class": "local_push",
|
||||
"requirements": ["python-matter-server==5.7.0"]
|
||||
"requirements": ["python-matter-server==5.7.0"],
|
||||
"zeroconf": ["_matter._tcp.local."]
|
||||
}
|
||||
|
|
|
@ -573,6 +573,11 @@ ZEROCONF = {
|
|||
},
|
||||
},
|
||||
],
|
||||
"_matter._tcp.local.": [
|
||||
{
|
||||
"domain": "matter",
|
||||
},
|
||||
],
|
||||
"_mediaremotetv._tcp.local.": [
|
||||
{
|
||||
"domain": "apple_tv",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
from ipaddress import ip_address
|
||||
from typing import Any
|
||||
from unittest.mock import DEFAULT, AsyncMock, MagicMock, call, patch
|
||||
|
||||
|
@ -12,6 +13,7 @@ import pytest
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.components.hassio import HassioAPIError, HassioServiceInfo
|
||||
from homeassistant.components.matter.const import ADDON_SLUG, DOMAIN
|
||||
from homeassistant.components.zeroconf import ZeroconfServiceInfo
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
|
@ -177,6 +179,48 @@ async def test_manual_already_configured(
|
|||
assert setup_entry.call_count == 1
|
||||
|
||||
|
||||
async def test_zeroconf_discovery(
|
||||
hass: HomeAssistant,
|
||||
client_connect: AsyncMock,
|
||||
setup_entry: AsyncMock,
|
||||
) -> None:
|
||||
"""Test flow started from Zeroconf discovery."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data=ZeroconfServiceInfo(
|
||||
ip_address=ip_address("fd11:be53:8d46:0:729e:5a4f:539d:1ee6"),
|
||||
ip_addresses=[ip_address("fd11:be53:8d46:0:729e:5a4f:539d:1ee6")],
|
||||
port=5540,
|
||||
hostname="CDEFGHIJ12345678.local.",
|
||||
type="_matter._tcp.local.",
|
||||
name="ABCDEFGH123456789-0000000012345678._matter._tcp.local.",
|
||||
properties={"SII": "3300", "SAI": "1100", "T": "0"},
|
||||
),
|
||||
)
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "manual"
|
||||
assert result["errors"] is None
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{
|
||||
"url": "ws://localhost:5580/ws",
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert client_connect.call_count == 1
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Matter"
|
||||
assert result["data"] == {
|
||||
"url": "ws://localhost:5580/ws",
|
||||
"integration_created_addon": False,
|
||||
"use_addon": False,
|
||||
}
|
||||
assert setup_entry.call_count == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("discovery_info", [{"config": ADDON_DISCOVERY_INFO}])
|
||||
async def test_supervisor_discovery(
|
||||
hass: HomeAssistant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue