mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-16 13:46:31 +00:00
Add matter discovery (#4002)
This commit is contained in:
parent
4afbedfa3d
commit
348fb56cb5
13
supervisor/discovery/services/matter.py
Normal file
13
supervisor/discovery/services/matter.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"""Discovery service for Matter Server."""
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from ...validate import network_port
|
||||||
|
from ..const import ATTR_HOST, ATTR_PORT
|
||||||
|
|
||||||
|
# pylint: disable=no-value-for-parameter
|
||||||
|
SCHEMA = vol.Schema(
|
||||||
|
{
|
||||||
|
vol.Required(ATTR_HOST): str,
|
||||||
|
vol.Required(ATTR_PORT): network_port,
|
||||||
|
}
|
||||||
|
)
|
22
tests/discovery/test_matter.py
Normal file
22
tests/discovery/test_matter.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
"""Test Matter Server discovery."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from supervisor.discovery.validate import valid_discovery_config
|
||||||
|
|
||||||
|
|
||||||
|
def test_good_config():
|
||||||
|
"""Test good Matter Server config."""
|
||||||
|
|
||||||
|
valid_discovery_config(
|
||||||
|
"matter",
|
||||||
|
{"host": "test", "port": 3812},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_bad_config():
|
||||||
|
"""Test bad Matter Server config."""
|
||||||
|
|
||||||
|
with pytest.raises(vol.Invalid):
|
||||||
|
valid_discovery_config("matter", {"host": "test"})
|
Loading…
x
Reference in New Issue
Block a user